From 584d589041f63fdd3ea777019679275657902c2d Mon Sep 17 00:00:00 2001 From: "kr.angelov" Date: Mon, 11 Aug 2014 10:59:10 +0000 Subject: a partial support for def rules in the C runtime The def rules are now compiled to byte code by the compiler and then to native code by the JIT compiler in the runtime. Not all constructions are implemented yet. The partial implementation is now in the repository but it is not activated by default since this requires changes in the PGF format. I will enable it only after it is complete. --- src/compiler/GF/Compile/CFGtoPGF.hs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/compiler/GF/Compile/CFGtoPGF.hs') diff --git a/src/compiler/GF/Compile/CFGtoPGF.hs b/src/compiler/GF/Compile/CFGtoPGF.hs index 96fc13554..aebf918bb 100644 --- a/src/compiler/GF/Compile/CFGtoPGF.hs +++ b/src/compiler/GF/Compile/CFGtoPGF.hs @@ -9,7 +9,6 @@ import PGF.Internal import qualified Data.Set as Set import qualified Data.Map as Map import qualified Data.IntMap as IntMap -import qualified Data.ByteString as BS import Data.Array.IArray import Data.List @@ -27,13 +26,13 @@ cf2pgf fpath cf = cname = mkCId name cf2abstr :: CFG -> Abstr -cf2abstr cfg = Abstr aflags afuns acats BS.empty +cf2abstr cfg = Abstr aflags afuns acats where aflags = Map.singleton (mkCId "startcat") (LStr (cfgStartCat cfg)) acats = Map.fromList [(mkCId cat, ([], [(0,mkRuleName rule) - | rule <- Set.toList rules], 0, 0)) + | rule <- Set.toList rules], 0)) | (cat,rules) <- Map.toList (cfgRules cfg)] - afuns = Map.fromList [(mkRuleName rule, (cftype [mkCId c | NonTerminal c <- ruleRhs rule] (mkCId cat), 0, Nothing, 0, 0)) + afuns = Map.fromList [(mkRuleName rule, (cftype [mkCId c | NonTerminal c <- ruleRhs rule] (mkCId cat), 0, Nothing, 0)) | (cat,rules) <- Map.toList (cfgRules cfg) , rule <- Set.toList rules] -- cgit v1.2.3