Debian Codegraph @

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

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