home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / fweb153.zip / fweb-1.53 / web / val.hweb < prev    next >
Text File  |  1995-09-23  |  1KB  |  45 lines

  1. @z --- val.hweb ---
  2.  
  3. FWEB version 1.53 (September 23, 1995)
  4.  
  5. Based on version 0.5 of S. Levy's CWEB [copyright (C) 1987 Princeton University]
  6.  
  7. @x-----------------------------------------------------------------------------
  8.  
  9. @ Here are declarations needed for \.{eval.web}.
  10.  
  11. @<Typedef declarations@>=
  12.  
  13. /* Precedence of the various operators. */
  14. typedef enum {BAD_TOKEN,OR_OR,AND_AND,BIT_OR,BIT_XOR,BIT_AND,LOG_EQ,LOG_LT,
  15.     BIT_SHIFT,PLUS_MINUS,TIMES,EXP,UNARY,HIGHEST_UNARY} @]PRECEDENCE;
  16.  
  17. /* An operator, together with its precedence. */
  18. typedef struct
  19.     {
  20.     eight_bits token;
  21.     PRECEDENCE precedence;
  22.     } @]OP;
  23.  
  24. /* The actual data value. */
  25. typedef union
  26.     {
  27.     long i; // All integers are long, to humor the pc people.
  28.     double d; // We handle just one floating-point type.
  29.     sixteen_bits id; // An identifier token.
  30.     OP op;
  31.     } @]VALUE;
  32.  
  33. /* Type of the data value. The relative order must be preserved here,
  34. because it is used in the type promotion routine |promote|. */
  35. typedef enum {Int,Double,Id,Op} @]TYPE;
  36.  
  37. /* Complete data structure for the token; includes links to the next and
  38. last |VAL| structures. */
  39. typedef struct val
  40.     {
  41.     VALUE value; // The actual data value or operator token.
  42.     TYPE type;    // The type of value stored in |value|.
  43.     struct val HUGE *last, HUGE *next;// Link to the last and next values. 
  44.     } @]VAL;
  45.