Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Annotation of /sml/trunk/src/compiler/Parse/ast/ast.sig
ViewVC logotype

Annotation of /sml/trunk/src/compiler/Parse/ast/ast.sig

Parent Directory Parent Directory | Revision Log Revision Log


Revision 109 - (view) (download) (as text)

1 : monnier 16 (* Copyright 1992 by AT&T Bell Laboratories
2 :     *
3 :     *)
4 :    
5 :     signature AST =
6 :     sig
7 :     type fixity
8 :     type symbol (* = Symbol.symbol *)
9 :     val infixleft : int -> fixity
10 :     val infixright : int -> fixity
11 :     type literal = IntInf.int
12 :    
13 :     (* to mark positions in files *)
14 :     type srcpos (* = int *)
15 :     type region (* = srcpos * srcpos *)
16 :     (* symbolic path (SymPath.spath) *)
17 :     type path
18 :     type 'a fixitem (* = {item: 'a, fixity: symbol option, region: region} *)
19 :    
20 :     datatype 'a sigConst
21 :     = NoSig
22 :     | Transparent of 'a
23 :     | Opaque of 'a
24 :    
25 :     (* EXPRESSIONS *)
26 :    
27 :     datatype exp
28 :     = VarExp of path (* variable *)
29 :     | FnExp of rule list (* abstraction *)
30 :     | FlatAppExp of exp fixitem list
31 :     (* expressions prior to fixity parsing *)
32 :     | AppExp of {function:exp,argument:exp}
33 :     (* application *)
34 :     | CaseExp of{expr:exp,rules:rule list}
35 :     (* case expression *)
36 :     | LetExp of {dec:dec,expr:exp} (* let expression *)
37 :     | SeqExp of exp list (* sequence of expressions *)
38 :     | IntExp of literal (* integer *)
39 :     | WordExp of literal (* word literal *)
40 :     | RealExp of string (* floating point coded by its string *)
41 :     | StringExp of string (* string *)
42 :     | CharExp of string (* char *)
43 :     | RecordExp of (symbol * exp) list (* record *)
44 :     | ListExp of exp list (* [list,in,square,brackets] *)
45 :     | TupleExp of exp list (* tuple (derived form) *)
46 :     | SelectorExp of symbol (* selector of a record field *)
47 :     | ConstraintExp of {expr:exp,constraint:ty}
48 :     (* type constraint *)
49 :     | HandleExp of {expr:exp, rules:rule list}
50 :     (* exception handler *)
51 :     | RaiseExp of exp (* raise an exception *)
52 :     | IfExp of {test:exp, thenCase:exp, elseCase:exp}
53 :     (* if expression (derived form) *)
54 :     | AndalsoExp of exp * exp (* andalso (derived form) *)
55 :     | OrelseExp of exp * exp (* orelse (derived form) *)
56 :     | VectorExp of exp list (* vector *)
57 :     | WhileExp of {test:exp,expr:exp}
58 :     (* while (derived form) *)
59 :     | MarkExp of exp * region (* mark an expression *)
60 :    
61 :     (* RULE for case functions and exception handler *)
62 :     and rule = Rule of {pat:pat,exp:exp}
63 :    
64 :     (* PATTERN *)
65 :     and pat = WildPat (* empty pattern *)
66 :     | VarPat of path (* variable pattern *)
67 :     | IntPat of literal (* integer *)
68 :     | WordPat of literal (* word literal *)
69 :     | StringPat of string (* string *)
70 :     | CharPat of string (* char *)
71 :     | RecordPat of {def:(symbol * pat) list, flexibility:bool}
72 :     (* record *)
73 :     | ListPat of pat list (* [list,in,square,brackets] *)
74 :     | TuplePat of pat list (* tuple *)
75 :     | FlatAppPat of pat fixitem list
76 :     (* patterns prior to fixity parsing *)
77 :     | AppPat of {constr:pat,argument:pat}(* application *)
78 :     | ConstraintPat of {pattern:pat,constraint:ty}
79 :     (* constraint *)
80 :     | LayeredPat of {varPat:pat,expPat:pat} (* as expressions *)
81 :     | VectorPat of pat list (* vector pattern *)
82 :     | MarkPat of pat * region (* mark a pattern *)
83 :     | OrPat of pat list (* or-pattern *)
84 :    
85 :     (* STRUCTURE EXPRESSION *)
86 :     and strexp = VarStr of path (* variable structure *)
87 :     | BaseStr of dec (* defined structure *)
88 :     | ConstrainedStr of strexp * sigexp sigConst (* signature constrained *)
89 :     | AppStr of path * (strexp * bool) list (* application (external) *)
90 :     | AppStrI of path * (strexp * bool) list (* application (internal) *)
91 :     | LetStr of dec * strexp (* let in structure *)
92 :     | MarkStr of strexp * region (* mark *)
93 :    
94 :     (* FUNCTOR EXPRESSION *)
95 :     and fctexp = VarFct of path * fsigexp sigConst (* functor variable *)
96 :     | BaseFct of { (* definition of a functor *)
97 :     params : (symbol option * sigexp) list,
98 :     body : strexp,
99 :     constraint : sigexp sigConst}
100 :     | LetFct of dec * fctexp
101 :     | AppFct of path * (strexp * bool) list * fsigexp sigConst
102 :     (* application *)
103 :     | MarkFct of fctexp * region (* mark *)
104 :    
105 :     (* WHERE SPEC *)
106 :     and wherespec = WhType of symbol list * tyvar list * ty
107 :     | WhStruct of symbol list * symbol list
108 :    
109 :     (* SIGNATURE EXPRESSION *)
110 :     and sigexp = VarSig of symbol (* signature variable *)
111 :     | AugSig of sigexp * wherespec list (* sig augmented with where spec *)
112 :     | BaseSig of spec list (* defined signature *)
113 :     | MarkSig of sigexp * region (* mark *)
114 :    
115 :     (* FUNCTOR SIGNATURE EXPRESSION *)
116 :     and fsigexp = VarFsig of symbol (* funsig variable *)
117 :     | BaseFsig of {param: (symbol option * sigexp) list, result:sigexp}
118 :     (* defined funsig *)
119 :     | MarkFsig of fsigexp * region (* mark a funsig *)
120 :    
121 :     (* SPECIFICATION FOR SIGNATURE DEFINITIONS *)
122 :     and spec = StrSpec of (symbol * sigexp * path option) list
123 :     (* structure *)
124 :     | TycSpec of ((symbol * tyvar list * ty option) list * bool)
125 :     (* type *)
126 :     | FctSpec of (symbol * fsigexp) list (* functor *)
127 :     | ValSpec of (symbol * ty) list (* value *)
128 :     | DataSpec of {datatycs: db list, withtycs: tb list} (* datatype *)
129 :     | ExceSpec of (symbol * ty option) list (* exception *)
130 :     | ShareStrSpec of path list (* structure sharing *)
131 :     | ShareTycSpec of path list (* type sharing *)
132 :     | IncludeSpec of sigexp (* include specif *)
133 :     | MarkSpec of spec * region (* mark a spec *)
134 :    
135 :     (* DECLARATIONS (let and structure) *)
136 :     and dec = ValDec of (vb list * tyvar list) (* values *)
137 :     | ValrecDec of (rvb list * tyvar list) (* recursive values *)
138 :     | FunDec of (fb list * tyvar list) (* recurs functions *)
139 :     | TypeDec of tb list (* type dec *)
140 :     | DatatypeDec of {datatycs: db list, withtycs: tb list}
141 :     (* datatype dec *)
142 :     | AbstypeDec of {abstycs: db list, withtycs: tb list, body: dec}
143 :     (* abstract type *)
144 :     | ExceptionDec of eb list (* exception *)
145 :     | StrDec of strb list (* structure *)
146 :     | AbsDec of strb list (* abstract struct *)
147 :     | FctDec of fctb list (* functor *)
148 :     | SigDec of sigb list (* signature *)
149 :     | FsigDec of fsigb list (* funsig *)
150 :     | LocalDec of dec * dec (* local dec *)
151 :     | SeqDec of dec list (* sequence of dec *)
152 :     | OpenDec of path list (* open structures *)
153 :     | OvldDec of symbol * ty * exp list (* overloading (internal) *)
154 :     | FixDec of {fixity: fixity, ops: symbol list} (* fixity *)
155 :     | MarkDec of dec * region (* mark a dec *)
156 :    
157 :     (* VALUE BINDINGS *)
158 : monnier 109 and vb = Vb of {pat:pat, exp:exp, lazyp:bool}
159 : monnier 16 | MarkVb of vb * region
160 :    
161 :     (* RECURSIVE VALUE BINDINGS *)
162 :     and rvb = Rvb of {var:symbol, fixity: (symbol * region) option,
163 : monnier 109 exp:exp, resultty: ty option, lazyp: bool}
164 : monnier 16 | MarkRvb of rvb * region
165 :    
166 :     (* RECURSIVE FUNCTIONS BINDINGS *)
167 : monnier 109 and fb = Fb of (clause list * bool)
168 : monnier 16 | MarkFb of fb * region
169 :    
170 :     (* CLAUSE: a definition for a single pattern in a function binding *)
171 :     and clause = Clause of {pats: pat fixitem list, resultty: ty option, exp:exp}
172 :    
173 :     (* TYPE BINDING *)
174 :     and tb = Tb of {tyc : symbol, def : ty, tyvars : tyvar list}
175 :     | MarkTb of tb * region
176 :    
177 :     (* DATATYPE BINDING *)
178 : monnier 109 and db = Db of {tyc : symbol, tyvars : tyvar list, rhs : dbrhs, lazyp: bool}
179 : monnier 16 | MarkDb of db * region
180 :    
181 :     (* DATATYPE BINDING RIGHT HAND SIDE *)
182 :     and dbrhs = Constrs of (symbol * ty option) list
183 :     | Repl of symbol list
184 :    
185 :     (* EXCEPTION BINDING *)
186 :     and eb = EbGen of {exn: symbol, etype: ty option} (* Exception definition *)
187 :     | EbDef of {exn: symbol, edef: path} (* defined by equality *)
188 :     | MarkEb of eb * region
189 :    
190 :     (* STRUCTURE BINDING *)
191 :     and strb = Strb of {name: symbol,def: strexp,constraint: sigexp sigConst}
192 :     | MarkStrb of strb * region
193 :    
194 :     (* FUNCTOR BINDING *)
195 :     and fctb = Fctb of {name: symbol,def: fctexp}
196 :     | MarkFctb of fctb * region
197 :    
198 :     (* SIGNATURE BINDING *)
199 :     and sigb = Sigb of {name: symbol,def: sigexp}
200 :     | MarkSigb of sigb * region
201 :    
202 :     (* FUNSIG BINDING *)
203 :     and fsigb = Fsigb of {name: symbol,def: fsigexp}
204 :     | MarkFsigb of fsigb * region
205 :    
206 :     (* TYPE VARIABLE *)
207 :     and tyvar = Tyv of symbol
208 :     | MarkTyv of tyvar * region
209 :    
210 :     (* TYPES *)
211 :     and ty
212 :     = VarTy of tyvar (* type variable *)
213 :     | ConTy of symbol list * ty list (* type constructor *)
214 :     | RecordTy of (symbol * ty) list (* record *)
215 :     | TupleTy of ty list (* tuple *)
216 :     | MarkTy of ty * region (* mark type *)
217 :    
218 :     end (* signature AST *)
219 :    
220 :    
221 :     (*
222 :     * $Log: ast.sig,v $
223 : monnier 109 * Revision 1.2 1998/05/15 03:23:55 dbm
224 :     * Eliminated obsolete FixSpec and ImportDec constructors.
225 :     * Eliminated LVb, LRVb, LFb, LDb constructors. Use lazyp flag instead.
226 :     *
227 : monnier 95 * Revision 1.1.1.1 1998/04/08 18:39:19 george
228 :     * Version 110.5
229 : monnier 16 *
230 :     *)

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0