comparison src/urweb.grm @ 805:e2780d2f4afc

Mutual datatypes through Elaborate
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 May 2009 15:14:17 -0400
parents dc3fc3f3b834
children 395a5d450cc0
comparison
equal deleted inserted replaced
804:10fe57e4a8c2 805:e2780d2f4afc
224 | copt of con option 224 | copt of con option
225 225
226 | dargs of string list 226 | dargs of string list
227 | barOpt of unit 227 | barOpt of unit
228 | dcons of (string * con option) list 228 | dcons of (string * con option) list
229 | dtype of string * string list * (string * con option) list
230 | dtypes of (string * string list * (string * con option) list) list
229 | dcon of string * con option 231 | dcon of string * con option
230 232
231 | pkopt of exp 233 | pkopt of exp
232 | commaOpt of unit 234 | commaOpt of unit
233 235
392 in 394 in
393 [(DCon (SYMBOL, SOME k, c), loc)] 395 [(DCon (SYMBOL, SOME k, c), loc)]
394 end) 396 end)
395 | LTYPE SYMBOL EQ cexp ([(DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp), 397 | LTYPE SYMBOL EQ cexp ([(DCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
396 s (LTYPEleft, cexpright))]) 398 s (LTYPEleft, cexpright))])
397 | DATATYPE SYMBOL dargs EQ barOpt dcons([(DDatatype (SYMBOL, dargs, dcons), s (DATATYPEleft, dconsright))]) 399 | DATATYPE dtypes ([(DDatatype dtypes, s (DATATYPEleft, dtypesright))])
398 | DATATYPE SYMBOL dargs EQ DATATYPE CSYMBOL DOT path 400 | DATATYPE SYMBOL dargs EQ DATATYPE CSYMBOL DOT path
399 (case dargs of 401 (case dargs of
400 [] => [(DDatatypeImp (SYMBOL, CSYMBOL :: #1 path, #2 path), s (DATATYPEleft, pathright))] 402 [] => [(DDatatypeImp (SYMBOL, CSYMBOL :: #1 path, #2 path), s (DATATYPEleft, pathright))]
401 | _ => raise Fail "Arguments specified for imported datatype") 403 | _ => raise Fail "Arguments specified for imported datatype")
402 | VAL vali ([(DVal vali, s (VALleft, valiright))]) 404 | VAL vali ([(DVal vali, s (VALleft, valiright))])
461 in 463 in
462 [(DClass (SYMBOL1, kind, c), s (CLASSleft, cexpright))] 464 [(DClass (SYMBOL1, kind, c), s (CLASSleft, cexpright))]
463 end) 465 end)
464 | COOKIE SYMBOL COLON cexp ([(DCookie (SYMBOL, cexp), s (COOKIEleft, cexpright))]) 466 | COOKIE SYMBOL COLON cexp ([(DCookie (SYMBOL, cexp), s (COOKIEleft, cexpright))])
465 | STYLE SYMBOL ([(DStyle SYMBOL, s (STYLEleft, SYMBOLright))]) 467 | STYLE SYMBOL ([(DStyle SYMBOL, s (STYLEleft, SYMBOLright))])
468
469 dtype : SYMBOL dargs EQ barOpt dcons (SYMBOL, dargs, dcons)
470
471 dtypes : dtype ([dtype])
472 | dtype AND dtypes (dtype :: dtypes)
466 473
467 kopt : (NONE) 474 kopt : (NONE)
468 | DCOLON kind (SOME kind) 475 | DCOLON kind (SOME kind)
469 476
470 dargs : ([]) 477 dargs : ([])
650 s (LTYPEleft, SYMBOLright))) 657 s (LTYPEleft, SYMBOLright)))
651 | CON SYMBOL EQ cexp ((SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright))) 658 | CON SYMBOL EQ cexp ((SgiCon (SYMBOL, NONE, cexp), s (CONleft, cexpright)))
652 | CON SYMBOL DCOLON kind EQ cexp ((SgiCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright))) 659 | CON SYMBOL DCOLON kind EQ cexp ((SgiCon (SYMBOL, SOME kind, cexp), s (CONleft, cexpright)))
653 | LTYPE SYMBOL EQ cexp ((SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp), 660 | LTYPE SYMBOL EQ cexp ((SgiCon (SYMBOL, SOME (KType, s (LTYPEleft, cexpright)), cexp),
654 s (LTYPEleft, cexpright))) 661 s (LTYPEleft, cexpright)))
655 | DATATYPE SYMBOL dargs EQ barOpt dcons((SgiDatatype (SYMBOL, dargs, dcons), s (DATATYPEleft, dconsright))) 662 | DATATYPE dtypes ((SgiDatatype dtypes, s (DATATYPEleft, dtypesright)))
656 | DATATYPE SYMBOL dargs EQ DATATYPE CSYMBOL DOT path 663 | DATATYPE SYMBOL dargs EQ DATATYPE CSYMBOL DOT path
657 (case dargs of 664 (case dargs of
658 [] => (SgiDatatypeImp (SYMBOL, CSYMBOL :: #1 path, #2 path), s (DATATYPEleft, pathright)) 665 [] => (SgiDatatypeImp (SYMBOL, CSYMBOL :: #1 path, #2 path), s (DATATYPEleft, pathright))
659 | _ => raise Fail "Arguments specified for imported datatype") 666 | _ => raise Fail "Arguments specified for imported datatype")
660 | VAL SYMBOL COLON cexp ((SgiVal (SYMBOL, cexp), s (VALleft, cexpright))) 667 | VAL SYMBOL COLON cexp ((SgiVal (SYMBOL, cexp), s (VALleft, cexpright)))