From 426bc49a52b4efa0ef0129d713842d8c9abdf0ff Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Fri, 27 Sep 2013 15:09:48 +0000 Subject: a major refactoring in the C and the Haskell runtimes. Note incompatible change in the PGF format!!! The following are the outcomes: - Predef.nonExist is fully supported by both the Haskell and the C runtimes - Predef.BIND is now an internal compiler defined token. For now it behaves just as usual for the Haskell runtime, i.e. it generates &+. However, the special treatment will let us to handle it properly in the C runtime. - This required a major change in the PGF format since both nonExist and BIND may appear inside 'pre' and this was not supported before. --- src/compiler/GF/Compile/PGFtoJS.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/compiler/GF/Compile/PGFtoJS.hs') diff --git a/src/compiler/GF/Compile/PGFtoJS.hs b/src/compiler/GF/Compile/PGFtoJS.hs index b7b3d5545..5cb01fac4 100644 --- a/src/compiler/GF/Compile/PGFtoJS.hs +++ b/src/compiler/GF/Compile/PGFtoJS.hs @@ -85,10 +85,12 @@ sym2js :: Symbol -> JS.Expr sym2js (SymCat n l) = new "SymCat" [JS.EInt n, JS.EInt l] sym2js (SymLit n l) = new "SymLit" [JS.EInt n, JS.EInt l] sym2js (SymVar n l) = new "SymVar" [JS.EInt n, JS.EInt l] -sym2js (SymKS ts) = new "SymKS" (map JS.EStr ts) -sym2js (SymKP ts alts) = new "SymKP" [JS.EArray (map JS.EStr ts), JS.EArray (map alt2js alts)] +sym2js (SymKS t) = new "SymKS" [JS.EStr t] +sym2js (SymKP ts alts) = new "SymKP" [JS.EArray (map sym2js ts), JS.EArray (map alt2js alts)] +sym2js SymNE = new "SymNE" [] +sym2js SymBIND = new "SymKS" [JS.EStr "&+"] -alt2js (Alt ps ts) = new "Alt" [JS.EArray (map JS.EStr ps), JS.EArray (map JS.EStr ts)] +alt2js (ps,ts) = new "Alt" [JS.EArray (map sym2js ps), JS.EArray (map JS.EStr ts)] new :: String -> [JS.Expr] -> JS.Expr new f xs = JS.ENew (JS.Ident f) xs -- cgit v1.2.3