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/cm/parse/cm.grm
ViewVC logotype

Annotation of /sml/trunk/src/cm/parse/cm.grm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 262 - (view) (download)

1 : blume 262 (* -*- sml -*- *)
2 :    
3 :     structure A = CMAbsyn
4 :    
5 :     fun guard (test, (th, el)) =
6 :     A.GUARDIAN { test = test, then_part = th, else_part = el }
7 :    
8 :     fun arith (arith_op, left, right) =
9 :     A.ARITH { arith = arith_op, left = left, right = right }
10 :    
11 :     fun lconn (conn_op, left, right) =
12 :     A.LCONN { conn = conn_op, left = left, right = right }
13 :    
14 :     fun cmp (cmp_op, left, right) =
15 :     A.CMP { cmp = cmp_op, left = left, right = right }
16 :    
17 :     %%
18 :     %term EOF
19 :     | ID of string
20 :     | STRING of string
21 :     | NUMBER of int
22 :     | ALIAS | GROUP | LIBRARY | IS
23 :     | LPAREN | RPAREN | COMMA | COLON
24 :     | IF | THEN | ELIF | ELSE | ENDIF
25 :     | STRUCTURE | SIGNATURE | FUNCTOR | FUNSIG
26 :     | DEFINED
27 :     | PLUS | MINUS | TIMES | DIV | MOD | UMINUS
28 :     | ANDALSO | ORELSE | NOT
29 :     | LT | LE | GT | GE | EQ | NE
30 :    
31 :     %nonterm description of A.description
32 :     | alias of A.description
33 :     | group of A.description
34 :     | opt_perm of string list
35 :     | idlist of string list
36 :     | lib_exports of A.export list
37 :     | exports of A.export list
38 :     | export of A.export
39 :     | guarded_exports of A.export list * A.export list
40 :     | else_exports of A.export list
41 :     | members of A.member list
42 :     | member of A.member
43 :     | guarded_members of A.member list * A.member list
44 :     | else_members of A.member list
45 :     | arithexp of A.arithexp
46 :     | boolexp of A.boolexp
47 :     | exp of A.boolexp
48 :     | ml_symbol of A.ml_symbol
49 :     | filename of A.filename
50 :     | cmpath of A.filename
51 :     | nativepath of A.filename
52 :    
53 :     %pos int
54 :     %verbose
55 :     %start description
56 :     %eop EOF
57 :     %noshift EOF
58 :    
59 :     %name CM
60 :    
61 :     %keyword ALIAS GROUP LIBRARY IS IF THEN ELIF ELSE ENDIF DEFINED
62 :     STRUCTURE SIGNATURE FUNCTOR FUNSIG
63 :    
64 :     %prefer THEN ELSE LPAREN
65 :    
66 :     %left ORELSE
67 :     %left ANDALSO
68 :     %nonassoc LT LE GT GE
69 :     %nonassoc EQ NE
70 :     %left PLUS MINUS
71 :     %left TIMES DIV MOD
72 :     %left UMINUS NOT
73 :    
74 :     %%
75 :    
76 :     description : alias (alias)
77 :     | group (group)
78 :    
79 :     alias : ALIAS filename (A.ALIAS filename)
80 :    
81 :     group : GROUP opt_perm exports IS members (A.GROUP
82 :     { permissions = opt_perm,
83 :     exports = exports,
84 :     members = members })
85 :     | LIBRARY opt_perm lib_exports IS members (A.LIBRARY
86 :     { permissions = opt_perm,
87 :     exports = lib_exports,
88 :     members = members })
89 :    
90 :     opt_perm : (* empty *) ([])
91 :     | LPAREN idlist RPAREN (idlist)
92 :    
93 :     idlist : ID ([ID])
94 :     | ID COMMA idlist (ID :: idlist)
95 :    
96 :     lib_exports : export exports (export :: exports)
97 :    
98 :     exports : (* empty *) ([])
99 :     | export exports (export :: exports)
100 :    
101 :     export : ml_symbol (A.EXPORT ml_symbol)
102 :     | IF exp guarded_exports (A.GUARDED_EXPORT
103 :     (guard (exp,
104 :     guarded_exports)))
105 :    
106 :     guarded_exports : THEN exports else_exports ((exports, else_exports))
107 :    
108 :     else_exports : ENDIF ([])
109 :     | ELSE exports ENDIF (exports)
110 :     | ELIF exp guarded_exports ([A.GUARDED_EXPORT
111 :     (guard (exp,
112 :     guarded_exports))])
113 :    
114 :     members : (* empty *) ([])
115 :     | member members (member :: members)
116 :    
117 :     member : filename (A.MEMBER { name = filename,
118 :     class = NONE })
119 :     | filename COLON ID (A.MEMBER { name = filename,
120 :     class = SOME ID })
121 :     | IF exp guarded_members (A.GUARDED_MEMBER
122 :     (guard (exp,
123 :     guarded_members)))
124 :    
125 :     guarded_members : THEN members else_members ((members, else_members))
126 :    
127 :     else_members : ENDIF ([])
128 :     | ELSE members ENDIF (members)
129 :     | ELIF exp guarded_members ([A.GUARDED_MEMBER
130 :     (guard (exp,
131 :     guarded_members))])
132 :    
133 :     exp : boolexp (boolexp)
134 :    
135 :     arithexp : NUMBER (A.NUMBER NUMBER)
136 :     | ID (A.VARIABLE ID)
137 :     | LPAREN arithexp RPAREN (arithexp)
138 :     | arithexp PLUS arithexp (arith (A.PLUS,
139 :     arithexp1, arithexp2))
140 :     | arithexp MINUS arithexp (arith (A.MINUS,
141 :     arithexp1, arithexp2))
142 :     | arithexp TIMES arithexp (arith (A.TIMES,
143 :     arithexp1, arithexp2))
144 :     | arithexp DIV arithexp (arith (A.DIV,
145 :     arithexp1, arithexp2))
146 :     | arithexp MOD arithexp (arith (A.MOD,
147 :     arithexp1, arithexp2))
148 :     | MINUS arithexp %prec UMINUS (A.NEGATE arithexp)
149 :    
150 :     boolexp : DEFINED LPAREN ml_symbol RPAREN (A.ML_DEFINED ml_symbol)
151 :     | DEFINED LPAREN ID RPAREN (A.CM_DEFINED ID)
152 :     | LPAREN boolexp RPAREN (boolexp)
153 :     | boolexp ANDALSO boolexp (lconn (A.ANDALSO,
154 :     boolexp1, boolexp2))
155 :     | boolexp ORELSE boolexp (lconn (A.ORELSE,
156 :     boolexp1, boolexp2))
157 :     | boolexp EQ boolexp (lconn (A.BOOL_EQ,
158 :     boolexp1, boolexp2))
159 :     | boolexp NE boolexp (lconn (A.BOOL_NE,
160 :     boolexp1, boolexp2))
161 :     | NOT boolexp (A.NOT boolexp)
162 :     | arithexp LT arithexp (cmp (A.LT,
163 :     arithexp1, arithexp2))
164 :     | arithexp LE arithexp (cmp (A.LE,
165 :     arithexp1, arithexp2))
166 :     | arithexp GT arithexp (cmp (A.GT,
167 :     arithexp1, arithexp2))
168 :     | arithexp GE arithexp (cmp (A.GE,
169 :     arithexp1, arithexp2))
170 :     | arithexp EQ arithexp (cmp (A.EQ,
171 :     arithexp1, arithexp2))
172 :     | arithexp NE arithexp (cmp (A.NE,
173 :     arithexp1, arithexp2))
174 :    
175 :     ml_symbol : STRUCTURE ID (A.STRUCTURE ID)
176 :     | SIGNATURE ID (A.SIGNATURE ID)
177 :     | FUNCTOR ID (A.FUNCTOR ID)
178 :     | FUNSIG ID (A.FUNSIG ID)
179 :    
180 :     filename : cmpath (cmpath)
181 :     | nativepath (nativepath)
182 :    
183 :     cmpath : ID (ID)
184 :    
185 :     nativepath : STRING (STRING)

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