diff options
| author | krasimir <krasimir@chalmers.se> | 2010-05-26 09:37:32 +0000 |
|---|---|---|
| committer | krasimir <krasimir@chalmers.se> | 2010-05-26 09:37:32 +0000 |
| commit | 6eda1118fcc497fda0939f02502569caf8625c7c (patch) | |
| tree | d5c208f79e701e48aa85a2bf08d995f7b28e9619 /src/compiler/GF/Compile/PGFtoJS.hs | |
| parent | b1441f2807a44c63a50382db93f49601550a95a8 (diff) | |
since now we don't do common subexpression elimination for PGF we could simplify the PMCFG generation
Diffstat (limited to 'src/compiler/GF/Compile/PGFtoJS.hs')
| -rw-r--r-- | src/compiler/GF/Compile/PGFtoJS.hs | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/src/compiler/GF/Compile/PGFtoJS.hs b/src/compiler/GF/Compile/PGFtoJS.hs index f6725bf4f..d756af5cd 100644 --- a/src/compiler/GF/Compile/PGFtoJS.hs +++ b/src/compiler/GF/Compile/PGFtoJS.hs @@ -57,30 +57,6 @@ concrete2js (c,cnc) = JS.Prop (JS.StringPropName "String") (JS.EFun [children] [JS.SReturn $ new "Arr" [JS.EIndex (JS.EVar children) (JS.EInt 0)]])] cats (c,CncCat start end _) = JS.Prop (JS.IdentPropName (JS.Ident (showCId c))) (JS.EObj [JS.Prop (JS.IdentPropName (JS.Ident "s")) (JS.EInt start) ,JS.Prop (JS.IdentPropName (JS.Ident "e")) (JS.EInt end)]) - -cncdef2js :: String -> String -> (CId,Term) -> JS.Property -cncdef2js n l (f, t) = JS.Prop (JS.IdentPropName (JS.Ident (showCId f))) (JS.EFun [children] [JS.SReturn (term2js n l t)]) - -term2js :: String -> String -> Term -> JS.Expr -term2js n l t = f t - where - f t = - case t of - R xs -> new "Arr" (map f xs) - P x y -> JS.ECall (JS.EMember (f x) (JS.Ident "sel")) [f y] - S xs -> mkSeq (map f xs) - K t -> tokn2js t - V i -> JS.EIndex (JS.EVar children) (JS.EInt i) - C i -> new "Int" [JS.EInt i] - F f -> JS.ECall (JS.EMember (JS.EIndex (JS.EMember (JS.EVar $ JS.Ident n) (JS.Ident "concretes")) (JS.EStr l)) (JS.Ident "rule")) [JS.EStr (showCId f), JS.EVar children] - FV xs -> new "Variants" (map f xs) - W str x -> new "Suffix" [JS.EStr str, f x] - TM _ -> new "Meta" [] - -tokn2js :: Tokn -> JS.Expr -tokn2js (KS s) = mkStr s -tokn2js (KP ss vs) = mkSeq (map mkStr ss) -- FIXME - mkStr :: String -> JS.Expr mkStr s = new "Str" [JS.EStr s] |
