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