Mercurial > urweb
comparison src/lacweb.grm @ 242:cc193f680193
Shorthand for multi-binding exp declaration
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 28 Aug 2008 14:05:47 -0400 |
parents | 052126db06e7 |
children | 2b9dfaffb008 |
comparison
equal
deleted
inserted
replaced
241:052126db06e7 | 242:cc193f680193 |
---|---|
149 | STRING of string | INT of Int64.int | FLOAT of Real64.real | 149 | STRING of string | INT of Int64.int | FLOAT of Real64.real |
150 | SYMBOL of string | CSYMBOL of string | 150 | SYMBOL of string | CSYMBOL of string |
151 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE | 151 | LPAREN | RPAREN | LBRACK | RBRACK | LBRACE | RBRACE |
152 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR | 152 | EQ | COMMA | COLON | DCOLON | TCOLON | DOT | HASH | UNDER | UNDERUNDER | BAR |
153 | DIVIDE | DOTDOTDOT | 153 | DIVIDE | DOTDOTDOT |
154 | CON | LTYPE | VAL | REC | AND | FOLD | UNIT | KUNIT | CLASS | 154 | CON | LTYPE | VAL | REC | AND | FUN | FOLD | UNIT | KUNIT | CLASS |
155 | DATATYPE | OF | 155 | DATATYPE | OF |
156 | TYPE | NAME | 156 | TYPE | NAME |
157 | ARROW | LARROW | DARROW | STAR | 157 | ARROW | LARROW | DARROW | STAR |
158 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE | 158 | FN | PLUSPLUS | MINUSMINUS | DOLLAR | TWIDDLE |
159 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN | 159 | STRUCTURE | SIGNATURE | STRUCT | SIG | END | FUNCTOR | WHERE | EXTERN |
175 file of decl list | 175 file of decl list |
176 | decls of decl list | 176 | decls of decl list |
177 | decl of decl | 177 | decl of decl |
178 | vali of string * con option * exp | 178 | vali of string * con option * exp |
179 | valis of (string * con option * exp) list | 179 | valis of (string * con option * exp) list |
180 | copt of con option | |
180 | 181 |
181 | dargs of string list | 182 | dargs of string list |
182 | barOpt of unit | 183 | barOpt of unit |
183 | dcons of (string * con option) list | 184 | dcons of (string * con option) list |
184 | dcon of string * con option | 185 | dcon of string * con option |
228 | 229 |
229 | earg of exp * con -> exp * con | 230 | earg of exp * con -> exp * con |
230 | eargp of exp * con -> exp * con | 231 | eargp of exp * con -> exp * con |
231 | eargs of exp * con -> exp * con | 232 | eargs of exp * con -> exp * con |
232 | eargl of exp * con -> exp * con | 233 | eargl of exp * con -> exp * con |
234 | eargl2 of exp * con -> exp * con | |
233 | 235 |
234 | branch of pat * exp | 236 | branch of pat * exp |
235 | branchs of (pat * exp) list | 237 | branchs of (pat * exp) list |
236 | pat of pat | 238 | pat of pat |
237 | pterm of pat | 239 | pterm of pat |
317 (case dargs of | 319 (case dargs of |
318 [] => (DDatatypeImp (SYMBOL, CSYMBOL :: #1 path, #2 path), s (DATATYPEleft, pathright)) | 320 [] => (DDatatypeImp (SYMBOL, CSYMBOL :: #1 path, #2 path), s (DATATYPEleft, pathright)) |
319 | _ => raise Fail "Arguments specified for imported datatype") | 321 | _ => raise Fail "Arguments specified for imported datatype") |
320 | VAL vali (DVal vali, s (VALleft, valiright)) | 322 | VAL vali (DVal vali, s (VALleft, valiright)) |
321 | VAL REC valis (DValRec valis, s (VALleft, valisright)) | 323 | VAL REC valis (DValRec valis, s (VALleft, valisright)) |
324 | FUN valis (DValRec valis, s (FUNleft, valisright)) | |
322 | 325 |
323 | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright)) | 326 | SIGNATURE CSYMBOL EQ sgn (DSgn (CSYMBOL, sgn), s (SIGNATUREleft, sgnright)) |
324 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright)) | 327 | STRUCTURE CSYMBOL EQ str (DStr (CSYMBOL, NONE, str), s (STRUCTUREleft, strright)) |
325 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright)) | 328 | STRUCTURE CSYMBOL COLON sgn EQ str (DStr (CSYMBOL, SOME sgn, str), s (STRUCTUREleft, strright)) |
326 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN EQ str | 329 | FUNCTOR CSYMBOL LPAREN CSYMBOL COLON sgn RPAREN EQ str |
363 | dcon BAR dcons (dcon :: dcons) | 366 | dcon BAR dcons (dcon :: dcons) |
364 | 367 |
365 dcon : CSYMBOL (CSYMBOL, NONE) | 368 dcon : CSYMBOL (CSYMBOL, NONE) |
366 | CSYMBOL OF cexp (CSYMBOL, SOME cexp) | 369 | CSYMBOL OF cexp (CSYMBOL, SOME cexp) |
367 | 370 |
368 vali : SYMBOL EQ eexp (SYMBOL, NONE, eexp) | 371 vali : SYMBOL eargl2 copt EQ eexp (let |
369 | SYMBOL COLON cexp EQ eexp (SYMBOL, SOME cexp, eexp) | 372 val loc = s (SYMBOLleft, eexpright) |
373 val t = Option.getOpt (copt, (CWild (KType, loc), loc)) | |
374 | |
375 val (e, t) = eargl2 (eexp, t) | |
376 in | |
377 (SYMBOL, SOME t, e) | |
378 end) | |
379 | |
380 copt : (NONE) | |
381 | COLON cexp (SOME cexp) | |
370 | 382 |
371 valis : vali ([vali]) | 383 valis : vali ([vali]) |
372 | vali AND valis (vali :: valis) | 384 | vali AND valis (vali :: valis) |
373 | 385 |
374 sgn : sgntm (sgntm) | 386 sgn : sgntm (sgntm) |
578 eargs : earg (earg) | 590 eargs : earg (earg) |
579 | eargl (eargl) | 591 | eargl (eargl) |
580 | 592 |
581 eargl : eargp eargp (eargp1 o eargp2) | 593 eargl : eargp eargp (eargp1 o eargp2) |
582 | eargp eargl (eargp o eargl) | 594 | eargp eargl (eargp o eargl) |
595 | |
596 eargl2 : (fn x => x) | |
597 | eargp eargl2 (eargp o eargl2) | |
583 | 598 |
584 earg : SYMBOL kcolon kind (fn (e, t) => | 599 earg : SYMBOL kcolon kind (fn (e, t) => |
585 let | 600 let |
586 val loc = s (SYMBOLleft, kindright) | 601 val loc = s (SYMBOLleft, kindright) |
587 in | 602 in |