1
0
forked from GitHub/gf-core

JavaScript generation: compile all concrete syntaxes, not just the first.

This commit is contained in:
bringert
2006-12-08 19:53:06 +00:00
parent 640998d273
commit a9892f0d62

View File

@@ -11,12 +11,12 @@ prCanon2js :: CanonGrammar -> String
prCanon2js gr = gfcc2js $ mkCanon2gfcc gr
gfcc2js :: C.Grammar -> String
gfcc2js (C.Grm _ _ cs) = JS.printTree (concrete2js (head cs)) -- FIXME
gfcc2js (C.Grm _ _ cs) = JS.printTree $ JS.Program $ concatMap concrete2js cs
concrete2js :: C.Concrete -> JS.Program
concrete2js :: C.Concrete -> [JS.Element]
concrete2js (C.Cnc (C.CId c) ds) =
JS.Program ([JS.ElStmt $ JS.SDeclOrExpr $ JS.Decl [JS.DInit l (new "Linearizer" [])]]
++ concatMap (cncdef2js l) ds)
[JS.ElStmt $ JS.SDeclOrExpr $ JS.Decl [JS.DInit l (new "Linearizer" [])]]
++ concatMap (cncdef2js l) ds
where l = JS.Ident c
cncdef2js :: JS.Ident -> C.CncDef -> [JS.Element]