SISR code now type annotates meta variables directly in grammar, to avoid a separate type annotation step.

This commit is contained in:
bringert
2007-01-05 17:34:44 +00:00
parent 36a1998ba3
commit efb806f226
3 changed files with 23 additions and 9 deletions

View File

@@ -68,7 +68,7 @@ profileFinalSISR term fmt = [JS.DExpr $ fmtOut fmt `ass` f term]
f (CFRes i) = JS.EIndex (JS.EVar children) (JS.EInt (fromIntegral i))
f (CFVar v) = JS.EVar (var v)
f (CFConst s) = JS.EStr s
f CFMeta = tree "?" []
f (CFMeta typ) = obj [("name",JS.EStr "?"), ("type",JS.EStr typ)]
fmtOut SISROld = JS.EVar (JS.Ident "$")
@@ -82,5 +82,7 @@ field x y = JS.EMember x (JS.Ident y)
ass = JS.EAssign
tree n xs = JS.EObj $ [JS.Prop (JS.Ident "name") (JS.EStr n)]
++ [JS.Prop (JS.Ident ("arg"++show i)) x | (i,x) <- zip [0..] xs]
tree n xs = obj $ [("name", JS.EStr n)] ++ [("arg"++show i, x) | (i,x) <- zip [0..] xs]
obj ps = JS.EObj [JS.Prop (JS.Ident x) y | (x,y) <- ps]