home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / intercal.zip / src / ick.h < prev    next >
C/C++ Source or Header  |  1996-06-19  |  2KB  |  90 lines

  1. /* ick.h -- compilation types for intercal parser */
  2.  
  3. /* Comment this out if your version of lex automatically supplies yylineno. */
  4. #define YYLINENO_BY_HAND
  5.  
  6. /* Comment this out if your version of lex doesn't use yyrestart(). */
  7. #define USE_YYRESTART
  8.  
  9. typedef int    bool;
  10. #define TRUE    1
  11. #define FALSE    0
  12.  
  13. /*
  14.  * We choose this value for maximum number of possible source lines on
  15.  * the theory that no human mind could grok more lines of INTERCAL than
  16.  * this and still retain any vestige of sanity.
  17.  */
  18. #define MAXLINES    1000
  19.  
  20. /*
  21.  * Similarly for maximum number of variables
  22.  */
  23. #define MAXVARS        100
  24.  
  25. /*
  26.  * Maximum supported statement types; should be equal to (COME_FROM - GETS + 1)
  27.  */
  28. #define MAXTYPES    17
  29.  
  30. typedef struct node_t
  31. {
  32.     int            opcode;        /* operator or type code */
  33.     unsigned long    constant;    /* constant data attached */
  34.     int            width;        /* is this 32-bit data? */
  35.     struct node_t    *lval, *rval;    /* attached expression nodes */
  36. } node;
  37.  
  38. typedef struct tuple_t
  39. {
  40.     unsigned int    label;        /* label # of this statement */
  41.     unsigned int    comefrom;    /* if NZ, a COME FROM touches this */
  42.     int             exechance;    /* chance of execution */
  43.     unsigned int    type;        /* statement type */
  44.     union
  45.     {
  46.     unsigned int    target;        /* for NEXT statements */
  47.     node        *node;        /* attached expression node(s) */
  48.     } u;
  49.     int lineno;             /* source line for error messages */
  50.     bool sharedline;            /* if NZ, two statements on a line */
  51. } tuple;
  52.  
  53. /* this maps the `external' name of a variable to an internal array index */
  54. typedef struct
  55. {
  56.     int    type;
  57.     int extindex;
  58.     int intindex;
  59. }
  60. atom;
  61.  
  62. typedef struct
  63. {
  64.     int    value;
  65.     char *name;
  66. }
  67. assoc;
  68.  
  69. extern atom oblist[MAXVARS], *obdex;
  70. extern int nonespots, ntwospots, ntails, nhybrids;
  71.  
  72. extern tuple tuples[MAXLINES];
  73.  
  74. extern char *enablers[MAXTYPES];
  75. extern assoc vartypes[];
  76.  
  77. /* the lexical analyzer keeps copies of the source logical lines */
  78. extern char *textlines[MAXLINES];
  79. extern int yylineno;
  80.  
  81. /* compilation options */
  82. extern bool compile_only;  /* just compile into C, don't run the linker */
  83. extern bool nocompilerbug; /* set possibility of E774 to zero */
  84. extern int traditional;    /* compile as INTERCAL-72 */
  85. extern int yydebug;        /* print debugging information while parsing */
  86.  
  87. extern int politesse;
  88.  
  89. /* ick.h ends here */
  90.