comparison src/lacweb.grm @ 239:fc6f04889bf2

Shorthand for multi-binding con 'fn'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 28 Aug 2008 13:29:57 -0400
parents f5732dc1316c
children 7036d29574f2
comparison
equal deleted inserted replaced
238:44a1663ad893 239:fc6f04889bf2
207 | ident of con 207 | ident of con
208 | idents of con list 208 | idents of con list
209 | rcon of (con * con) list 209 | rcon of (con * con) list
210 | rconn of (con * con) list 210 | rconn of (con * con) list
211 | rcone of (con * con) list 211 | rcone of (con * con) list
212 | cargs of con * kind -> con * kind
213 | cargl of con * kind -> con * kind
214 | carg of con * kind -> con * kind
215 | cargp of con * kind -> con * kind
212 216
213 | eexp of exp 217 | eexp of exp
214 | eapps of exp 218 | eapps of exp
215 | eterm of exp 219 | eterm of exp
216 | etuple of exp list 220 | etuple of exp list
433 | cexp ARROW cexp (TFun (cexp1, cexp2), s (cexp1left, cexp2right)) 437 | cexp ARROW cexp (TFun (cexp1, cexp2), s (cexp1left, cexp2right))
434 | SYMBOL kcolon kind ARROW cexp (TCFun (kcolon, SYMBOL, kind, cexp), s (SYMBOLleft, cexpright)) 438 | SYMBOL kcolon kind ARROW cexp (TCFun (kcolon, SYMBOL, kind, cexp), s (SYMBOLleft, cexpright))
435 439
436 | cexp PLUSPLUS cexp (CConcat (cexp1, cexp2), s (cexp1left, cexp1right)) 440 | cexp PLUSPLUS cexp (CConcat (cexp1, cexp2), s (cexp1left, cexp1right))
437 441
438 | FN SYMBOL DARROW cexp (CAbs (SYMBOL, NONE, cexp), s (FNleft, cexpright)) 442 | FN cargs DARROW cexp (#1 (cargs (cexp, (KWild, s (FNleft, cexpright)))))
439 | FN SYMBOL DCOLON kind DARROW cexp (CAbs (SYMBOL, SOME kind, cexp), s (FNleft, cexpright))
440 | cterm TWIDDLE cterm DARROW cexp(CDisjoint (cterm1, cterm2, cexp), s (cterm1left, cexpright)) 443 | cterm TWIDDLE cterm DARROW cexp(CDisjoint (cterm1, cterm2, cexp), s (cterm1left, cexpright))
441 | cterm TWIDDLE cterm ARROW cexp (TDisjoint (cterm1, cterm2, cexp), s (cterm1left, cexpright)) 444 | cterm TWIDDLE cterm ARROW cexp (TDisjoint (cterm1, cterm2, cexp), s (cterm1left, cexpright))
442 445
443 | LPAREN cexp RPAREN DCOLON kind (CAnnot (cexp, kind), s (LPARENleft, kindright)) 446 | LPAREN cexp RPAREN DCOLON kind (CAnnot (cexp, kind), s (LPARENleft, kindright))
444 447
452 loc), loc) 455 loc), loc)
453 end) 456 end)
454 457
455 kcolon : DCOLON (Explicit) 458 kcolon : DCOLON (Explicit)
456 | TCOLON (Implicit) 459 | TCOLON (Implicit)
460
461 cargs : carg (carg)
462 | cargl (cargl)
463
464 cargl : cargp cargp (cargp1 o cargp2)
465 | cargp cargl (cargp o cargl)
466
467 carg : SYMBOL (fn (c, k) =>
468 let
469 val loc = s (SYMBOLleft, SYMBOLright)
470 in
471 ((CAbs (SYMBOL, NONE, c), loc),
472 (KArrow ((KWild, loc), k), loc))
473 end)
474 | SYMBOL DCOLON kind (fn (c, k) =>
475 let
476 val loc = s (SYMBOLleft, kindright)
477 in
478 ((CAbs (SYMBOL, SOME kind, c), loc),
479 (KArrow (kind, k), loc))
480 end)
481 | LPAREN SYMBOL DCOLON kind RPAREN (fn (c, k) =>
482 let
483 val loc = s (LPARENleft, RPARENright)
484 in
485 ((CAbs (SYMBOL, SOME kind, c), loc),
486 (KArrow (kind, k), loc))
487 end)
488
489 cargp : SYMBOL (fn (c, k) =>
490 let
491 val loc = s (SYMBOLleft, SYMBOLright)
492 in
493 ((CAbs (SYMBOL, NONE, c), loc),
494 (KArrow ((KWild, loc), k), loc))
495 end)
496 | LPAREN SYMBOL DCOLON kind RPAREN (fn (c, k) =>
497 let
498 val loc = s (LPARENleft, RPARENright)
499 in
500 ((CAbs (SYMBOL, SOME kind, c), loc),
501 (KArrow (kind, k), loc))
502 end)
457 503
458 path : SYMBOL ([], SYMBOL) 504 path : SYMBOL ([], SYMBOL)
459 | CSYMBOL DOT path (let val (ms, x) = path in (CSYMBOL :: ms, x) end) 505 | CSYMBOL DOT path (let val (ms, x) = path in (CSYMBOL :: ms, x) end)
460 506
461 cpath : CSYMBOL ([], CSYMBOL) 507 cpath : CSYMBOL ([], CSYMBOL)