SOURCE FILE: eNode.h


// ********************************************************
// Header file eNode.h for the expression tree node item
// ********************************************************

#ifndef eNode_H
#define eNode_H

#include <string>

enum symbolType {op, var, num} ;

class    eNodeClass ;
typedef  eNodeClass *  eNodePtrType;

/* The idea is for a node to contain one token: either an
   operator code, a variable, or a literal integer.  We
   simply provide a separate field for each possibility.
   (Sometime we may change the implementation to use a
   union.  This would save some space.)  The purpose of the
   "symbol" field is for determining what is stored in the
   node.
*/

class eNodeClass  /* node in an expression tree */
{  

  public :

/* ###################################################### */

       /* Default constructor.  */

    eNodeClass() ;
    
/* ###################################################### */

       /* Give it an initial value for the op or var,
	  depending on the value of "symbol."  */

    eNodeClass(symbolType symbol, char chr) ;
    
/* ###################################################### */
       /* Give it an initial value for the num, tipped by
	  the value of "symbol."  */

    eNodeClass(symbolType symbol, int value) ;

/* ###################################################### */

/*   private :      */

     symbolType         symbol ;     /* what is stored here? */
     char                   op_f ;   /* storage for an operator */
     char                  var_f ;   /* storage for a variable  */
     int                   num_f ;   /* storage for a number */ 

};  // end struct

#endif
/*

---------1---------2---------3---------4---------5---------6
123456789012345678901234567890123456789012345678901234567890

*/