C:\Users\brock\Documents\CSCI 255\NetBeans\RL Solution\RLparse.h
/* Do NOT modify this file! */

/*
 * Include file for RL Assignment
 *
 * Copyright J. Dean Brock, 2010
 * This file released under terms of the GNU General Public License
 *
 */

#ifndef _RLPARSE_H
#define _RLPARSE_H

#include <stdio.h>

/* For maintaining the RL parse structure */
#define RLVARSIZE 10

/* For printf-style printing */
#define RLVARF   "-10s"
#define RLCONSTF "10.0f"

/* enumeration for the operator type, + or | */
enum OperatorType { optorSer,                /* Series (+) operator */
                    optorPar                 /* Parallel (|) operator */
} ;

/* enumeration for the operand type, variable or constant */
enum OperandType  { oprndVar,                /* Operand is a variable */
                    oprndConst               /* Operand is a constant */
} ;

/* union for the two kinds of operands */
union operand {
    char VarName[RLVARSIZE] ;              /* Name of variable */
    double ConstValue ;                    /* Value of constant */
};

/* Structure to hold RL assignment statement.
 * Note heavy use of union's                    */
struct RLAssignment {
    char Target[RLVARSIZE] ;
    enum OperatorType operator ;
    enum OperandType  op1Type ;
    enum OperandType  op2Type ;
    union operand arg1 ;
    union operand arg2 ;
};

/* Node for linked list of RL assignments. */
struct RLAssignmentNode {
    struct RLAssignment value ;
    struct RLAssignmentNode *next ;
};


/* Prototypes here */
/* Parse an RL program */
struct RLAssignmentNode *parseRL(FILE *) ;

/* Print an RL program */
void printRLprog(struct RLAssignmentNode *, FILE * f) ;

#endif  /* _RLPARSE_H */