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