comparison src/elaborate.sml @ 40:e3d3c2791105

Functor parsing
author Adam Chlipala <adamc@hcoop.net>
date Thu, 19 Jun 2008 15:15:00 -0400
parents 1dfbd9e3e790
children 1405d8c26790
comparison
equal deleted inserted replaced
39:02f42e9a1825 40:e3d3c2791105
1095 (case E.lookupSgn env x of 1095 (case E.lookupSgn env x of
1096 NONE => 1096 NONE =>
1097 (sgnError env (UnboundSgn (loc, x)); 1097 (sgnError env (UnboundSgn (loc, x));
1098 (L'.SgnError, loc)) 1098 (L'.SgnError, loc))
1099 | SOME (n, sgis) => (L'.SgnVar n, loc)) 1099 | SOME (n, sgis) => (L'.SgnVar n, loc))
1100 | L.SgnFun _ => raise Fail "Elaborate functor sig"
1100 1101
1101 fun sgiOfDecl (d, loc) = 1102 fun sgiOfDecl (d, loc) =
1102 case d of 1103 case d of
1103 L'.DCon (x, n, k, c) => SOME (L'.SgiCon (x, n, k, c), loc) 1104 L'.DCon (x, n, k, c) => SOME (L'.SgiCon (x, n, k, c), loc)
1104 | L'.DVal (x, n, t, _) => SOME (L'.SgiVal (x, n, t), loc) 1105 | L'.DVal (x, n, t, _) => SOME (L'.SgiVal (x, n, t), loc)
1341 case E.projectStr env {str = str', sgn = sgn, field = x} of 1342 case E.projectStr env {str = str', sgn = sgn, field = x} of
1342 NONE => (strError env (UnboundStr (loc, x)); 1343 NONE => (strError env (UnboundStr (loc, x));
1343 (strerror, sgnerror)) 1344 (strerror, sgnerror))
1344 | SOME sgn => ((L'.StrProj (str', x), loc), sgn) 1345 | SOME sgn => ((L'.StrProj (str', x), loc), sgn)
1345 end 1346 end
1347 | L.StrFun _ => raise Fail "Elaborate functor"
1346 1348
1347 val elabFile = ListUtil.foldlMap elabDecl 1349 val elabFile = ListUtil.foldlMap elabDecl
1348 1350
1349 end 1351 end