SCM Repository
Annotation of /sml/trunk/src/cm/parse/cm.grm
Parent Directory
|
Revision Log
Revision 273 - (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 | 262 | | IF | THEN | 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 | 266 | | opt_perms of S.perms |
34 : | | perms of S.perms | ||
35 : | blume | 265 | | lib_exports of S.exports |
36 : | | 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 | 262 | |
53 : | %pos int | ||
54 : | %verbose | ||
55 : | blume | 270 | %arg (context, error, recParse, doMember) : |
56 : | S.context * | ||
57 : | (pos * pos -> string -> unit) * | ||
58 : | blume | 273 | (pos * pos -> S.pathname -> S.group) * |
59 : | (S.pathname * pos * pos * S.cm_symbol option -> S.members) | ||
60 : | blume | 262 | %start description |
61 : | %eop EOF | ||
62 : | %noshift EOF | ||
63 : | |||
64 : | %name CM | ||
65 : | |||
66 : | %keyword ALIAS GROUP LIBRARY IS IF THEN ELIF ELSE ENDIF DEFINED | ||
67 : | STRUCTURE SIGNATURE FUNCTOR FUNSIG | ||
68 : | |||
69 : | blume | 265 | %prefer LPAREN |
70 : | blume | 262 | |
71 : | %left ORELSE | ||
72 : | %left ANDALSO | ||
73 : | %nonassoc LT LE GT GE | ||
74 : | %nonassoc EQ NE | ||
75 : | %left PLUS MINUS | ||
76 : | %left TIMES DIV MOD | ||
77 : | blume | 265 | %left NOT TILDE |
78 : | blume | 262 | |
79 : | %% | ||
80 : | |||
81 : | description : alias (alias) | ||
82 : | | group (group) | ||
83 : | |||
84 : | blume | 273 | alias : ALIAS pathname (recParse |
85 : | (pathnameleft, pathnameright) | ||
86 : | pathname) | ||
87 : | blume | 262 | |
88 : | blume | 265 | group : GROUP |
89 : | opt_perms exports IS members (S.group | ||
90 : | (opt_perms, exports, members)) | ||
91 : | | LIBRARY | ||
92 : | opt_perms lib_exports IS members (S.library | ||
93 : | (opt_perms, lib_exports, | ||
94 : | members)) | ||
95 : | blume | 262 | |
96 : | blume | 266 | opt_perms : (* empty *) (S.initialPerms) |
97 : | blume | 265 | | LPAREN perms RPAREN (perms) |
98 : | blume | 262 | |
99 : | blume | 266 | perms : (* empty *) (S.initialPerms) |
100 : | | perms sym (S.require (perms, sym, | ||
101 : | error (symleft, | ||
102 : | symright))) | ||
103 : | | perms COLON sym (S.grant (perms, sym, | ||
104 : | error (symleft, | ||
105 : | symright))) | ||
106 : | blume | 262 | |
107 : | blume | 265 | lib_exports : export exports (S.exports (export, exports)) |
108 : | blume | 262 | |
109 : | blume | 265 | exports : (* empty *) (S.emptyExports) |
110 : | | export exports (S.exports (export, exports)) | ||
111 : | blume | 262 | |
112 : | blume | 265 | export : ml_symbol (S.export ml_symbol) |
113 : | | IF exp guarded_exports (S.guarded_exports | ||
114 : | (exp, guarded_exports)) | ||
115 : | blume | 266 | | ERROR (S.error_export ERROR) |
116 : | blume | 265 | |
117 : | blume | 262 | guarded_exports : THEN exports else_exports ((exports, else_exports)) |
118 : | |||
119 : | blume | 265 | else_exports : ENDIF (S.emptyExports) |
120 : | blume | 262 | | ELSE exports ENDIF (exports) |
121 : | blume | 265 | | ELIF exp guarded_exports (S.guarded_exports |
122 : | (exp, guarded_exports)) | ||
123 : | blume | 262 | |
124 : | blume | 265 | members : (* empty *) (S.emptyMembers) |
125 : | | member members (S.members (member, members)) | ||
126 : | blume | 262 | |
127 : | blume | 273 | member : pathname (doMember (pathname, |
128 : | pathnameleft, | ||
129 : | pathnameright, | ||
130 : | NONE)) | ||
131 : | | pathname COLON sym (doMember (pathname, | ||
132 : | pathnameleft, | ||
133 : | pathnameright, | ||
134 : | SOME sym)) | ||
135 : | blume | 265 | | IF exp guarded_members (S.guarded_members |
136 : | (exp, guarded_members)) | ||
137 : | blume | 266 | | ERROR (S.error_member ERROR) |
138 : | blume | 262 | |
139 : | guarded_members : THEN members else_members ((members, else_members)) | ||
140 : | |||
141 : | blume | 265 | else_members : ENDIF (S.emptyMembers) |
142 : | blume | 262 | | ELSE members ENDIF (members) |
143 : | blume | 265 | | ELIF exp guarded_members (S.guarded_members |
144 : | (exp, guarded_members)) | ||
145 : | blume | 262 | |
146 : | blume | 265 | sym : CM_ID (S.cm_symbol CM_ID) |
147 : | |||
148 : | blume | 262 | exp : boolexp (boolexp) |
149 : | |||
150 : | blume | 265 | aexp : NUMBER (S.number NUMBER) |
151 : | | sym (S.variable sym) | ||
152 : | | LPAREN aexp RPAREN (aexp) | ||
153 : | | aexp PLUS aexp (S.plus (aexp1, aexp2)) | ||
154 : | | aexp MINUS aexp (S.minus (aexp1, aexp2)) | ||
155 : | | aexp TIMES aexp (S.times (aexp1, aexp2)) | ||
156 : | | aexp DIV aexp (S.divide (aexp1, aexp2)) | ||
157 : | | aexp MOD aexp (S.modulus (aexp1, aexp2)) | ||
158 : | | TILDE aexp (S.negate aexp) | ||
159 : | blume | 262 | |
160 : | blume | 265 | boolexp : DEFINED LPAREN ml_symbol RPAREN (S.ml_defined ml_symbol) |
161 : | | DEFINED LPAREN sym RPAREN (S.cm_defined sym) | ||
162 : | blume | 262 | | LPAREN boolexp RPAREN (boolexp) |
163 : | blume | 265 | | boolexp ANDALSO boolexp (S.conj (boolexp1, boolexp2)) |
164 : | | boolexp ORELSE boolexp (S.disj (boolexp1, boolexp2)) | ||
165 : | | boolexp EQ boolexp (S.beq (boolexp1, boolexp2)) | ||
166 : | | boolexp NE boolexp (S.bne (boolexp1, boolexp2)) | ||
167 : | | NOT boolexp (S.not boolexp) | ||
168 : | | aexp LT aexp (S.lt (aexp1, aexp2)) | ||
169 : | | aexp LE aexp (S.le (aexp1, aexp2)) | ||
170 : | | aexp GT aexp (S.gt (aexp1, aexp2)) | ||
171 : | | aexp GE aexp (S.ge (aexp1, aexp2)) | ||
172 : | | aexp EQ aexp (S.eq (aexp1, aexp2)) | ||
173 : | | aexp NE aexp (S.ne (aexp1, aexp2)) | ||
174 : | blume | 262 | |
175 : | blume | 265 | ml_symbol : STRUCTURE ML_ID (S.ml_structure ML_ID) |
176 : | | SIGNATURE ML_ID (S.ml_signature ML_ID) | ||
177 : | | FUNCTOR ML_ID (S.ml_functor ML_ID) | ||
178 : | | FUNSIG ML_ID (S.ml_funsig ML_ID) | ||
179 : | blume | 262 | |
180 : | blume | 265 | pathname : FILE_STANDARD (S.file_standard |
181 : | blume | 270 | (FILE_STANDARD, context)) |
182 : | blume | 265 | | FILE_NATIVE (S.file_native |
183 : | blume | 270 | (FILE_NATIVE, context)) |
root@smlnj-gforge.cs.uchicago.edu | ViewVC Help |
Powered by ViewVC 1.0.0 |