SCM Repository
Annotation of /sml/trunk/src/cm/parse/cm.grm
Parent Directory
|
Revision Log
Revision 356 - (view) (download)
1 : | blume | 267 | (* -*- sml -*- |
2 : | * | ||
3 : | * ML-Yacc grammar for CM description files | ||
4 : | * | ||
5 : | * (C) 1999 Lucent Technologies, Bell Laboratories | ||
6 : | * | ||
7 : | * Author: Matthias Blume (blume@kurims.kyoto-u.ac.jp) | ||
8 : | *) | ||
9 : | blume | 262 | |
10 : | blume | 265 | structure S = CMSemant |
11 : | blume | 262 | |
12 : | blume | 265 | %% |
13 : | blume | 262 | |
14 : | %term EOF | ||
15 : | blume | 265 | | FILE_STANDARD of string |
16 : | | FILE_NATIVE of string | ||
17 : | | CM_ID of string | ||
18 : | | ML_ID of string | ||
19 : | blume | 262 | | NUMBER of int |
20 : | | ALIAS | GROUP | LIBRARY | IS | ||
21 : | blume | 265 | | LPAREN | RPAREN | COLON |
22 : | blume | 274 | | IF | ELIF | ELSE | ENDIF |
23 : | blume | 266 | | ERROR of string |
24 : | blume | 262 | | STRUCTURE | SIGNATURE | FUNCTOR | FUNSIG |
25 : | | DEFINED | ||
26 : | blume | 265 | | PLUS | MINUS | TIMES | DIV | MOD | TILDE |
27 : | blume | 262 | | ANDALSO | ORELSE | NOT |
28 : | | LT | LE | GT | GE | EQ | NE | ||
29 : | |||
30 : | blume | 265 | %nonterm description of S.group |
31 : | | alias of S.group | ||
32 : | | group of S.group | ||
33 : | blume | 348 | | gprivspec of S.privilegespec |
34 : | | lprivspec of S.privilegespec | ||
35 : | | wrapspec of S.privilegespec -> S.privilegespec | ||
36 : | blume | 282 | | opt_exports of S.exports option |
37 : | blume | 265 | | exports of S.exports |
38 : | | export of S.exports | ||
39 : | | guarded_exports of S.exports * S.exports | ||
40 : | | else_exports of S.exports | ||
41 : | | members of S.members | ||
42 : | | member of S.members | ||
43 : | | guarded_members of S.members * S.members | ||
44 : | | else_members of S.members | ||
45 : | | aexp of S.aexp | ||
46 : | | boolexp of S.exp | ||
47 : | | exp of S.exp | ||
48 : | | ml_symbol of S.ml_symbol | ||
49 : | | pathname of S.pathname | ||
50 : | | cmpath of S.pathname | ||
51 : | | nativepath of S.pathname | ||
52 : | | sym of S.cm_symbol | ||
53 : | blume | 275 | | word of S.cm_symbol |
54 : | blume | 262 | |
55 : | %pos int | ||
56 : | %verbose | ||
57 : | blume | 297 | %arg (grouppath, context, error, recParse, doMember, gp) : |
58 : | blume | 283 | S.pathname * |
59 : | blume | 270 | S.context * |
60 : | (pos * pos -> string -> unit) * | ||
61 : | blume | 273 | (pos * pos -> S.pathname -> S.group) * |
62 : | blume | 297 | (S.pathname * pos * pos * S.cm_symbol option -> S.members) * |
63 : | blume | 299 | GeneralParams.info |
64 : | blume | 262 | %start description |
65 : | %eop EOF | ||
66 : | %noshift EOF | ||
67 : | |||
68 : | %name CM | ||
69 : | |||
70 : | blume | 274 | %keyword ALIAS GROUP LIBRARY IS IF ELIF ELSE ENDIF DEFINED |
71 : | blume | 262 | STRUCTURE SIGNATURE FUNCTOR FUNSIG |
72 : | |||
73 : | blume | 265 | %prefer LPAREN |
74 : | blume | 262 | |
75 : | %left ORELSE | ||
76 : | %left ANDALSO | ||
77 : | %nonassoc LT LE GT GE | ||
78 : | %nonassoc EQ NE | ||
79 : | %left PLUS MINUS | ||
80 : | %left TIMES DIV MOD | ||
81 : | blume | 265 | %left NOT TILDE |
82 : | blume | 262 | |
83 : | %% | ||
84 : | |||
85 : | description : alias (alias) | ||
86 : | | group (group) | ||
87 : | |||
88 : | blume | 273 | alias : ALIAS pathname (recParse |
89 : | (pathnameleft, pathnameright) | ||
90 : | pathname) | ||
91 : | blume | 262 | |
92 : | blume | 348 | group : gprivspec opt_exports IS members (S.group |
93 : | blume | 283 | (grouppath, |
94 : | blume | 348 | gprivspec, opt_exports, |
95 : | blume | 283 | members, |
96 : | error (opt_exportsleft, | ||
97 : | blume | 297 | opt_exportsright), |
98 : | gp)) | ||
99 : | blume | 348 | | lprivspec exports IS members (S.library |
100 : | blume | 283 | (grouppath, |
101 : | blume | 348 | lprivspec, exports, members, |
102 : | blume | 283 | error (exportsleft, |
103 : | blume | 297 | exportsright), |
104 : | gp)) | ||
105 : | blume | 262 | |
106 : | blume | 348 | wrapspec : (* empty *) (fn p => p) |
107 : | | wrapspec word (fn p => | ||
108 : | S.wrap (wrapspec p, word, | ||
109 : | blume | 318 | error (wordleft, |
110 : | wordright))) | ||
111 : | |||
112 : | blume | 348 | gprivspec : GROUP (S.initialPrivilegeSpec) |
113 : | | word gprivspec (S.require (gprivspec, word, | ||
114 : | blume | 275 | error (wordleft, |
115 : | wordright))) | ||
116 : | blume | 262 | |
117 : | blume | 348 | lprivspec : LIBRARY (S.initialPrivilegeSpec) |
118 : | | word lprivspec (S.require (lprivspec, word, | ||
119 : | error (wordleft, | ||
120 : | wordright))) | ||
121 : | | LPAREN wrapspec RPAREN lprivspec (wrapspec lprivspec) | ||
122 : | |||
123 : | blume | 282 | exports : export (export) |
124 : | blume | 265 | | export exports (S.exports (export, exports)) |
125 : | blume | 262 | |
126 : | blume | 282 | opt_exports : (* empty *) (NONE) |
127 : | | exports (SOME exports) | ||
128 : | |||
129 : | blume | 356 | export : ml_symbol (S.export |
130 : | (ml_symbol, | ||
131 : | error (ml_symbolleft, | ||
132 : | ml_symbolright))) | ||
133 : | blume | 265 | | IF exp guarded_exports (S.guarded_exports |
134 : | blume | 275 | (exp, guarded_exports, |
135 : | error (expleft, expright))) | ||
136 : | | ERROR (S.error_export | ||
137 : | (fn () => | ||
138 : | blume | 277 | error (ERRORleft, ERRORright) |
139 : | ERROR)) | ||
140 : | blume | 265 | |
141 : | blume | 274 | guarded_exports : exports else_exports ((exports, else_exports)) |
142 : | blume | 262 | |
143 : | blume | 265 | else_exports : ENDIF (S.emptyExports) |
144 : | blume | 262 | | ELSE exports ENDIF (exports) |
145 : | blume | 265 | | ELIF exp guarded_exports (S.guarded_exports |
146 : | blume | 275 | (exp, guarded_exports, |
147 : | error (expleft, expright))) | ||
148 : | blume | 262 | |
149 : | blume | 265 | members : (* empty *) (S.emptyMembers) |
150 : | | member members (S.members (member, members)) | ||
151 : | blume | 262 | |
152 : | blume | 273 | member : pathname (doMember (pathname, |
153 : | pathnameleft, | ||
154 : | pathnameright, | ||
155 : | blume | 297 | NONE)) |
156 : | blume | 275 | | pathname COLON word (doMember (pathname, |
157 : | blume | 273 | pathnameleft, |
158 : | pathnameright, | ||
159 : | blume | 297 | SOME word)) |
160 : | blume | 265 | | IF exp guarded_members (S.guarded_members |
161 : | blume | 275 | (exp, guarded_members, |
162 : | error (expleft, expright))) | ||
163 : | | ERROR (S.error_member | ||
164 : | (fn () => | ||
165 : | blume | 277 | error (ERRORleft, ERRORright) |
166 : | ERROR)) | ||
167 : | blume | 262 | |
168 : | blume | 274 | guarded_members : members else_members ((members, else_members)) |
169 : | blume | 262 | |
170 : | blume | 265 | else_members : ENDIF (S.emptyMembers) |
171 : | blume | 262 | | ELSE members ENDIF (members) |
172 : | blume | 265 | | ELIF exp guarded_members (S.guarded_members |
173 : | blume | 275 | (exp, guarded_members, |
174 : | error (expleft, expright))) | ||
175 : | blume | 262 | |
176 : | blume | 275 | word : FILE_STANDARD (S.cm_symbol FILE_STANDARD) |
177 : | |||
178 : | blume | 265 | sym : CM_ID (S.cm_symbol CM_ID) |
179 : | |||
180 : | blume | 262 | exp : boolexp (boolexp) |
181 : | |||
182 : | blume | 265 | aexp : NUMBER (S.number NUMBER) |
183 : | blume | 336 | | sym (S.variable gp sym) |
184 : | blume | 265 | | LPAREN aexp RPAREN (aexp) |
185 : | | aexp PLUS aexp (S.plus (aexp1, aexp2)) | ||
186 : | | aexp MINUS aexp (S.minus (aexp1, aexp2)) | ||
187 : | | aexp TIMES aexp (S.times (aexp1, aexp2)) | ||
188 : | | aexp DIV aexp (S.divide (aexp1, aexp2)) | ||
189 : | | aexp MOD aexp (S.modulus (aexp1, aexp2)) | ||
190 : | | TILDE aexp (S.negate aexp) | ||
191 : | blume | 262 | |
192 : | blume | 265 | boolexp : DEFINED LPAREN ml_symbol RPAREN (S.ml_defined ml_symbol) |
193 : | blume | 336 | | DEFINED LPAREN sym RPAREN (S.cm_defined gp sym) |
194 : | blume | 262 | | LPAREN boolexp RPAREN (boolexp) |
195 : | blume | 265 | | boolexp ANDALSO boolexp (S.conj (boolexp1, boolexp2)) |
196 : | | boolexp ORELSE boolexp (S.disj (boolexp1, boolexp2)) | ||
197 : | | boolexp EQ boolexp (S.beq (boolexp1, boolexp2)) | ||
198 : | | boolexp NE boolexp (S.bne (boolexp1, boolexp2)) | ||
199 : | | NOT boolexp (S.not boolexp) | ||
200 : | | aexp LT aexp (S.lt (aexp1, aexp2)) | ||
201 : | | aexp LE aexp (S.le (aexp1, aexp2)) | ||
202 : | | aexp GT aexp (S.gt (aexp1, aexp2)) | ||
203 : | | aexp GE aexp (S.ge (aexp1, aexp2)) | ||
204 : | | aexp EQ aexp (S.eq (aexp1, aexp2)) | ||
205 : | | aexp NE aexp (S.ne (aexp1, aexp2)) | ||
206 : | blume | 262 | |
207 : | blume | 265 | ml_symbol : STRUCTURE ML_ID (S.ml_structure ML_ID) |
208 : | | SIGNATURE ML_ID (S.ml_signature ML_ID) | ||
209 : | | FUNCTOR ML_ID (S.ml_functor ML_ID) | ||
210 : | | FUNSIG ML_ID (S.ml_funsig ML_ID) | ||
211 : | blume | 262 | |
212 : | blume | 318 | pathname : FILE_STANDARD (S.file_standard gp |
213 : | blume | 270 | (FILE_STANDARD, context)) |
214 : | blume | 265 | | FILE_NATIVE (S.file_native |
215 : | blume | 270 | (FILE_NATIVE, context)) |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |