Debian Codegraph @

lib/mlrisc-lib/MLRISC/Tools/FakeSMLAst/ast.sml

raw
1 structure MDLAst : MDL_AST =
2 struct
3
4 type loc = SourceMapping.location
5
6 datatype decl =
7 DATATYPEdecl of datatypebind list * typebind list
8 | EXCEPTIONdecl of exceptionbind list
9 | FUNdecl of funbind list
10 | RTLdecl of pat * exp * loc
11 | RTLSIGdecl of id list * ty
12 | VALdecl of valbind list
13 | VALSIGdecl of id list * ty
14 | TYPESIGdecl of id * tyvar list
15 | LOCALdecl of decl list * decl list
16 | SEQdecl of decl list
17 | STRUCTUREdecl of id * decl list * sigconstraint option * structexp
18 | FUNCTORdecl of id * decl list * sigconstraint option * structexp
19 | STRUCTURESIGdecl of id * sigexp
20 | SIGNATUREdecl of id * sigexp
21 | SHARINGdecl of share list
22 | OPENdecl of ident list
23 | FUNCTORARGdecl of id * sigconstraint
24 | INCLUDESIGdecl of sigexp
25 | INFIXdecl of int * id list
26 | INFIXRdecl of int * id list
27 | NONFIXdecl of id list
28 | MARKdecl of loc * decl
29
30 (* MD extensions *)
31 | ARCHdecl of id * decl list (* architecture spec *)
32 | $ of string list (* verbatim code *)
33 | BITSORDERINGdecl of range (* declare bits ordering *)
34 | FORMATdecl of int option * formatbind list
35 (* declare instruction formats *)
36 | ARCHKINDdecl of archKind (* superscalar/vliw *)
37 | ENDIANESSdecl of endianess (* little/big endian *)
38 | STORAGEdecl of storagedecl list (* cell declarations *)
39 | LOCATIONSdecl of locbind list (* location declarations *)
40 | NAMEdecl of string (* name of architecture *)
41 | VERSIONdecl of string (* version number *)
42 | ASSEMBLYCASEdecl of assemblycase (* lower/uppercase *)
43 | INSTRUCTIONdecl of consbind list (* instruction definition *)
44 | DEBUGdecl of id (* turn on debugging *)
45 | RESOURCEdecl of id list (* resource declaration *)
46 | CPUdecl of cpubind list (* cpu declaration *)
47 | PIPELINEdecl of pipelinebind list (* pipeline declaration *)
48 | LATENCYdecl of latencybind list (* latency declaration *)
49
50 and sigexp = IDsig of ident
51 | WHEREsig of sigexp * ident * structexp
52 | WHERETYPEsig of sigexp * ident * ty
53 | DECLsig of decl list
54
55 and share = TYPEshare of ident list
56 | STRUCTshare of ident list
57
58 and literal = WORDlit of word
59 | WORD32lit of Word32.word
60 | INTlit of int
61 | INT32lit of Int32.int
62 | INTINFlit of IntInf.int
63 | STRINGlit of string
64 | CHARlit of char
65 | BOOLlit of bool
66 | REALlit of string
67
68 and exp = LITexp of literal
69 | IDexp of ident
70 | CONSexp of ident * exp option
71 | LISTexp of exp list * exp option
72 | TUPLEexp of exp list
73 | VECTORexp of exp list
74 | RECORDexp of (id * exp) list
75 | APPexp of exp * exp
76 | IFexp of exp * exp * exp
77 | LETexp of decl list * exp list
78 | SEQexp of exp list
79 | RAISEexp of exp
80 | HANDLEexp of exp * clause list
81 | CASEexp of exp * clause list
82 | TYPEDexp of exp * ty
83 | LAMBDAexp of clause list
84 | MARKexp of loc * exp
85
86 (* MDL extensions *)
87 | BITSLICEexp of exp * range list
88 | LOCexp of id * exp * id option
89 | ASMexp of assembly
90 | TYPEexp of ty
91 | RTLexp of rtl
92 | CONTexp of exp * id
93
94 and ety = I8 | I16 | I32 | I64 | FSINGLE | FDOUBLE
95
96 and assemblycase = LOWERCASE | UPPERCASE | VERBATIM
97
98 and structexp = IDsexp of ident
99 | APPsexp of structexp * structexp
100 | DECLsexp of decl list
101 | CONSTRAINEDsexp of structexp * sigexp
102
103 and ty = IDty of ident
104 | TYVARty of tyvar
105 | INTVARty of int
106 | VARty of tvkind * int * int ref * ty option ref
107 | APPty of ident * ty list
108 | FUNty of ty * ty
109 | TUPLEty of ty list
110 | RECORDty of (id * ty) list
111 | POLYty of ty list * ty
112 | LAMBDAty of ty list * ty
113
114 | CELLty of id
115
116 and tvkind = INTkind | TYPEkind
117
118 and pat = IDpat of id
119 | CONSpat of ident * pat option
120 | WILDpat
121 | ASpat of id * pat
122 | LITpat of literal
123 | LISTpat of pat list * pat option
124 | TUPLEpat of pat list
125 | VECTORpat of pat list
126 | RECORDpat of (id * pat) list * bool
127 | TYPEDpat of pat * ty
128 | NOTpat of pat
129 | ORpat of pat list
130 | ANDpat of pat list
131 | WHEREpat of pat * exp
132 | NESTEDpat of pat * exp * pat
133
134 and ident = IDENT of id list * id
135
136 and clause = CLAUSE of pat list * guard * exp
137
138 and funbind = FUNbind of id * clause list
139
140 and storagedecl =
141 CELLdecl of {id:id, nickname:id,
142 from:int ref,to:int ref,
143 alias:id option,
144 count:int option,bits:int,print:exp,
145 aggregable:bool,
146 defaults:(int*exp) list}
147
148 and locbind = LOCbind of id * pat option * exp
149
150 and endianess = LITTLE | BIG
151
152 and archKind = VLIW | SUPERSCALAR
153
154 and formatbind = FORMATbind of id * field list * exp option
155
156 and field = FIELD of {id:id,width:width,sign:signedness,
157 cnv:cnv, value:Word32.word option}
158
159 and width = WIDTH of int | RANGE of int * int
160
161 and cnv = NOcnv
162 | CELLcnv of id
163 | FUNcnv of id
164
165 and datatypebind = DATATYPEbind of
166 {id:id,tyvars:tyvar list,mc : opcodeencoding,asm : bool,
167 field:id option,cbs:consbind list}
168 | DATATYPEEQbind of {id:id, tyvars:tyvar list, ty:ty}
169
170 and exceptionbind = EXCEPTIONbind of id * ty option
171 | EXCEPTIONEQbind of id * ident
172
173 and consbind =
174 CONSbind of {id : id,ty:ty option,mc : mc option,
175 asm : assembly option,
176 rtl : exp option,
177 nop : flag,
178 nullified : flag,
179 delayslot : exp option,
180 delaycand : exp option,
181 sdi : exp option,
182 latency : exp option,
183 pipeline : exp option,
184 loc : loc
185 }
186
187 and flag = FLAGon | FLAGoff | FLAGid of id * bool * exp
188
189 and delayslot = DELAY_ERROR
190 | DELAY_NONE
191 | DELAY_ALWAYS
192 | DELAY_TAKEN
193 | DELAY_NONTAKEN
194 | DELAY_IF of branching * delayslot * delayslot
195
196 and branching = BRANCHforwards
197 | BRANCHbackwards
198
199 and mc = WORDmc of Word32.word
200 | EXPmc of exp
201
202 and assembly = STRINGasm of string
203 | ASMasm of asm list
204
205 and asm = TEXTasm of string
206 | EXPasm of exp
207
208 and typebind = TYPEbind of id * tyvar list * ty
209
210 and valbind = VALbind of pat * exp
211
212 and signedness = SIGNED | UNSIGNED
213
214 and tyvar = VARtv of id
215 | INTtv of id
216
217 and rtlterm = LITrtl of id
218 | IDrtl of id
219 | COMPOSITErtl of id
220
221 and cpubind = CPUbind of {name:id, aliases:string list, maxIssues:int,
222 resources: (int * id) list}
223 and pipelinebind = PIPELINEbind of id * (pat * pipelineexp) list
224
225 and latencybind = LATENCYbind of id * (pat * exp) list
226
227 and pipelineexp = PIPELINE of cycle list
228
229 and cycle = ORcycle of cycle * cycle
230 | REPEATcycle of cycle * int
231 | IDcycle of id
232
233
234 withtype range = int * int
235 and id = string
236 and guard = exp option
237 and opcodeencoding = int list option
238 and cellset = bool
239 and rtl = rtlterm list
240 and sigconstraint = {abstract: bool, sigexp:sigexp}
241
242 end