1 /* ick.h -- compilation types for intercal parser */ 2 3 #include "ick_bool.h" 4 5 #ifdef ICKNOSEARCH 6 #define ICKINCLUDEDIR "." 7 #define ICKLIBDIR "." 8 #define ICKBINDIR "." 9 #define YYDEBUG 1 10 #endif 11 12 /* AIS: This is now detected by autoconf and doesn't need to be set by the 13 user. */ 14 #ifdef NEED_YYRESTART 15 # define USE_YYRESTART 16 #endif 17 18 #define YY_NO_UNPUT 19 20 #define ALLOC_CHUNK 256 21 22 /* 23 * We choose this value for maximum number of possible variables on 24 * the theory that no human mind could grok a more complex INTERCAL 25 * program than this and still retain any vestige of sanity. 26 #define MAXVARS 100 27 */ 28 29 /* 30 * Maximum supported statement types; should be equal to (FROM - GETS + 1) 31 * AIS: Changed this when I added new statements. 32 */ 33 #define MAXTYPES 32 34 35 /* AIS: Maximum supported spark/ears nesting, divided by 32. The value given 36 allows for 3200 nested spark/ears groupings, which should be enough. */ 37 #define SENESTMAX 100 38 39 enum onceagain {onceagain_NORMAL, onceagain_ONCE, onceagain_AGAIN}; /* AIS */ 40 41 typedef struct node_t 42 { 43 int opcode; /* operator or type code */ 44 unsigned long constant; /* constant data attached */ 45 unsigned long optdata; /* AIS: Temp used by the optimizer */ 46 int width; /* is this 32-bit data? */ 47 struct node_t *lval, *rval; /* attached expression nodes */ 48 struct node_t *nextslat; /* AIS: The next node with a slat */ 49 } node; 50 51 typedef struct tuple_t 52 { 53 unsigned int label; /* label # of this statement */ 54 unsigned int ncomefrom; /* AIS: How many noncomputed COME FROMS 55 have this line as a suck-point */ 56 int exechance; /* chance of execution, initial abstain, 57 (AIS) MAYBE details */ 58 bool maybe; /* AIS: Where MAYBE details go when 59 exechance has been parsed */ 60 bool abstainable; /* AIS: Is it possible for this line to 61 be abstained from? */ 62 bool initabstain; /* AIS: Is this line initially 63 abstained from? */ 64 bool nextable; /* AIS: Can this line be a NEXT 65 target? */ 66 bool optversion; /* AIS: Use an optimized version? (Only 67 set if the optimizer thinks that 68 it's safe.) */ 69 bool preproc; /* AIS: Is this line a nonexistent one 70 that was added to implement a 71 command in the parser? */ 72 bool warn112:1; /* AIS: Should this line produce warning 73 112 during degeneration? */ 74 bool warn128:1, warn534:1, warn018:1, warn016:1, warn276:1, warn239:1, 75 warn622:1; /* AIS: As warn112. The warnings are a bitfield to save space. */ 76 unsigned int type; /* statement type */ 77 struct 78 { /* AIS: Struct, not union needed because ABSTAIN expr FROM (line) has both */ 79 unsigned int target; /* for NEXT statements */ 80 node *node; /* attached expression node(s) */ 81 } u; 82 unsigned int nexttarget; /* AIS: The target tuple of a NEXT must 83 also be recorded for optimizef */ 84 int ick_lineno; /* source line for error messages */ 85 bool sharedline; /* if NZ, two statements on a line */ 86 enum onceagain onceagainflag; /* AIS: ONCE / AGAIN */ 87 int ppnewtype; /* AIS: 'real' type of this line when 88 the preprocessor is used; 0 on all 89 statements but the 'real' 90 statement */ 91 signed setweave; /* AIS: +1 to turn weaving on, -1 to 92 turn it off, before this command */ 93 } tuple; 94 95 /* this maps the `external' name of a variable to an internal ick_array index */ 96 typedef struct 97 { 98 int type; 99 unsigned long extindex; 100 unsigned long intindex; 101 int ignorable; /* AIS: Can this variable be IGNOREd? */ 102 int memloc; /* AIS: Where does a PIC store this in memory? */ 103 } 104 atom; 105 106 typedef struct 107 { 108 int value; 109 /*@null@*/const char *name; 110 } 111 assoc; 112 113 /*@null@*/ /*@owned@*/ /*@partial@*/ extern atom *oblist; 114 /*@null@*/ /*@dependent@*/ /*@partial@*/ extern atom *obdex; 115 extern int obcount, nonespots, ntwospots, ntails, nhybrids; 116 extern int nmeshes; /* AIS */ 117 118 /*@only@*/ extern tuple *tuples; 119 extern int tuplecount; 120 121 /*@dependent@*/ extern tuple *optuple; /* AIS: The tuple currently being optimized */ 122 123 extern const char **enablers; 124 /*@observer@*/ extern const char *enablersm1[MAXTYPES+1]; 125 extern const assoc vartypes[]; 126 127 /* the lexical analyzer keeps copies of the source logical lines */ 128 /*@only@*/ extern char **textlines; 129 extern int textlinecount; 130 extern int iyylineno; 131 132 /* AIS: These are needed to sort out a grammar near-ambiguity */ 133 extern unsigned long sparkearsstack[SENESTMAX]; 134 extern int sparkearslev; 135 136 /* compilation options */ 137 extern bool compile_only; /* just compile into C, don't run the linker */ 138 extern bool nocompilerbug; /* set possibility of IE774 to zero */ 139 extern bool ick_traditional; /* compile as INTERCAL-72 */ 140 extern int yydebug; /* print debugging information while parsing */ 141 142 extern int politesse; 143 144 145 /* AIS: I added these */ 146 extern bool yukdebug; /* debug the code with yuk */ 147 extern bool yukprofile; /* profile the code with yuk */ 148 extern int compucomecount; /* number of computed COME FROMs */ 149 extern bool compucomesused; /* are computed COME FROMs used? */ 150 extern bool nextfromsused; /* is NEXT FROM used? */ 151 extern bool gerucomesused; /* is COME FROM gerund used? */ 152 extern bool opoverused; /* is operand overloading used? */ 153 extern bool useickec; /* are external calls used? */ 154 extern bool createsused; /* are CREATEs used? */ 155 /*@null@*/ extern node* firstslat; /* the ick_first node with a slat */ 156 /*@null@*/ extern node* prevslat; /* the last node so far with a slat */ 157 extern bool multithread; /* is the program multithreaded? */ 158 extern bool variableconstants; /* is any assignment allowed? */ 159 extern bool ick_coreonerr; /* dump core on IE778? */ 160 extern int optdebug; /* debug the optimizer */ 161 extern bool flowoptimize; /* optimize program flow */ 162 extern bool ick_checkforbugs; /* check for bugs */ 163 extern bool coopt; /* constant-output optimizer */ 164 165 /* ick.h ends here */ 166