comparison src/explify.sml @ 203:dd82457fda82

Parsing and elaborating 'table'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 14 Aug 2008 13:20:29 -0400
parents aa54250f58ac
children 63a2f2322c1f
comparison
equal deleted inserted replaced
202:af5bd54cbbd7 203:dd82457fda82
121 (x, n, Option.map explifyCon co)) xncs), loc) 121 (x, n, Option.map explifyCon co)) xncs), loc)
122 | L.SgiVal (x, n, c) => SOME (L'.SgiVal (x, n, explifyCon c), loc) 122 | L.SgiVal (x, n, c) => SOME (L'.SgiVal (x, n, explifyCon c), loc)
123 | L.SgiStr (x, n, sgn) => SOME (L'.SgiStr (x, n, explifySgn sgn), loc) 123 | L.SgiStr (x, n, sgn) => SOME (L'.SgiStr (x, n, explifySgn sgn), loc)
124 | L.SgiSgn (x, n, sgn) => SOME (L'.SgiSgn (x, n, explifySgn sgn), loc) 124 | L.SgiSgn (x, n, sgn) => SOME (L'.SgiSgn (x, n, explifySgn sgn), loc)
125 | L.SgiConstraint _ => NONE 125 | L.SgiConstraint _ => NONE
126 | L.SgiTable _ => raise Fail "Explify SgiTable"
126 127
127 and explifySgn (sgn, loc) = 128 and explifySgn (sgn, loc) =
128 case sgn of 129 case sgn of
129 L.SgnConst sgis => (L'.SgnConst (List.mapPartial explifySgi sgis), loc) 130 L.SgnConst sgis => (L'.SgnConst (List.mapPartial explifySgi sgis), loc)
130 | L.SgnVar n => (L'.SgnVar n, loc) 131 | L.SgnVar n => (L'.SgnVar n, loc)
149 | L.DSgn (x, n, sgn) => SOME (L'.DSgn (x, n, explifySgn sgn), loc) 150 | L.DSgn (x, n, sgn) => SOME (L'.DSgn (x, n, explifySgn sgn), loc)
150 | L.DStr (x, n, sgn, str) => SOME (L'.DStr (x, n, explifySgn sgn, explifyStr str), loc) 151 | L.DStr (x, n, sgn, str) => SOME (L'.DStr (x, n, explifySgn sgn, explifyStr str), loc)
151 | L.DFfiStr (x, n, sgn) => SOME (L'.DFfiStr (x, n, explifySgn sgn), loc) 152 | L.DFfiStr (x, n, sgn) => SOME (L'.DFfiStr (x, n, explifySgn sgn), loc)
152 | L.DConstraint (c1, c2) => NONE 153 | L.DConstraint (c1, c2) => NONE
153 | L.DExport (en, sgn, str) => SOME (L'.DExport (en, explifySgn sgn, explifyStr str), loc) 154 | L.DExport (en, sgn, str) => SOME (L'.DExport (en, explifySgn sgn, explifyStr str), loc)
155 | L.DTable _ => raise Fail "Explify DTable"
154 156
155 and explifyStr (str, loc) = 157 and explifyStr (str, loc) =
156 case str of 158 case str of
157 L.StrConst ds => (L'.StrConst (List.mapPartial explifyDecl ds), loc) 159 L.StrConst ds => (L'.StrConst (List.mapPartial explifyDecl ds), loc)
158 | L.StrVar n => (L'.StrVar n, loc) 160 | L.StrVar n => (L'.StrVar n, loc)