summaryrefslogtreecommitdiff
path: root/src/compiler/GFC.hs
diff options
context:
space:
mode:
authorkr.angelov <kr.angelov@gmail.com>2014-08-11 10:59:10 +0000
committerkr.angelov <kr.angelov@gmail.com>2014-08-11 10:59:10 +0000
commit584d589041f63fdd3ea777019679275657902c2d (patch)
tree6150ef1da26bc76e0c3e14954e080f9a801b45f4 /src/compiler/GFC.hs
parent02dda1e66f80047f0a8718557a8bf7cc84c16625 (diff)
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.
Diffstat (limited to 'src/compiler/GFC.hs')
-rw-r--r--src/compiler/GFC.hs22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/compiler/GFC.hs b/src/compiler/GFC.hs
index 137a68895..4bd6ce25c 100644
--- a/src/compiler/GFC.hs
+++ b/src/compiler/GFC.hs
@@ -2,8 +2,8 @@ module GFC (mainGFC, writePGF) where
-- module Main where
import PGF
-import PGF.Internal(PGF,abstract,concretes,code,funs,cats,optimizePGF,unionPGF)
-import PGF.Internal(putSplitAbs)
+import PGF.Internal(PGF,concretes,optimizePGF,unionPGF)
+import PGF.Internal(putSplitAbs,encodeFile,runPut)
import GF.Compile
import GF.Compile.Export
import GF.Compile.CFGtoPGF
@@ -17,13 +17,10 @@ import GF.Data.ErrM
import GF.System.Directory
import Data.Maybe
-import PGF.Internal(encode,encodeFile,runPut)
import qualified Data.Map as Map
import qualified Data.Set as Set
-import qualified Data.ByteString as BSS
import qualified Data.ByteString.Lazy as BSL
import System.FilePath
-import System.IO
import Control.Monad(unless,forM_)
mainGFC :: Options -> [FilePath] -> IO ()
@@ -55,7 +52,6 @@ compileSourceFiles opts fs =
then putIfVerb opts $ pgfFile ++ " is up-to-date."
else do pgf <- link opts cnc_gr
writePGF opts pgf
- writeByteCode opts pgf
writeOutputs opts pgf
compileCFFiles :: Options -> [FilePath] -> IOE ()
@@ -105,20 +101,6 @@ writeOutputs opts pgf = do
| fmt <- outputFormats opts,
(name,str) <- exportPGF opts fmt pgf]
-writeByteCode :: Options -> PGF -> IOE ()
-writeByteCode opts pgf
- | elem FmtByteCode (flag optOutputFormats opts) =
- let path = outputPath opts (grammarName opts pgf <.> "bc")
- in writing opts path $
- withBinaryFile path WriteMode
- (\h -> do BSL.hPut h (encode addrs)
- BSS.hPut h (code (abstract pgf)))
- | otherwise = return ()
- where
- addrs =
- [(id,addr) | (id,(_,_,_,_,addr)) <- Map.toList (funs (abstract pgf))] ++
- [(id,addr) | (id,(_,_,_,addr)) <- Map.toList (cats (abstract pgf))]
-
writePGF :: Options -> PGF -> IOE ()
writePGF opts pgf =
if flag optSplitPGF opts then writeSplitPGF else writeNormalPGF