mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-20 08:32:50 -06:00
gfc --make now works
This commit is contained in:
@@ -9,8 +9,6 @@ import GF.Compile.Update
|
|||||||
import GF.Grammar.Lookup
|
import GF.Grammar.Lookup
|
||||||
import GF.Infra.Modules
|
import GF.Infra.Modules
|
||||||
import GF.Devel.ReadFiles
|
import GF.Devel.ReadFiles
|
||||||
--import GF.Compile.ShellState
|
|
||||||
--import GF.Compile.MkResource
|
|
||||||
|
|
||||||
-- the main compiler passes
|
-- the main compiler passes
|
||||||
import GF.Devel.GetGrammar
|
import GF.Devel.GetGrammar
|
||||||
@@ -21,17 +19,8 @@ import GF.Grammar.Refresh
|
|||||||
import GF.Compile.CheckGrammar
|
import GF.Compile.CheckGrammar
|
||||||
import GF.Compile.Optimize
|
import GF.Compile.Optimize
|
||||||
import GF.Compile.Evaluate ----
|
import GF.Compile.Evaluate ----
|
||||||
--import GF.Compile.GrammarToCanon
|
|
||||||
--import GF.Compile.GrammarToGFCC -----
|
|
||||||
--import GF.Canon.Share
|
--import GF.Canon.Share
|
||||||
--import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule)
|
--import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule)
|
||||||
--import GF.UseGrammar.Linear (unoptimizeCanonMod) ----
|
|
||||||
|
|
||||||
--import qualified GF.Canon.CanonToGrammar as CG
|
|
||||||
|
|
||||||
--import qualified GF.Canon.GFC as GFC
|
|
||||||
--import qualified GF.Canon.MkGFC as MkGFC
|
|
||||||
--import GF.Canon.GetGFC
|
|
||||||
|
|
||||||
import GF.Data.Operations
|
import GF.Data.Operations
|
||||||
import GF.Devel.UseIO
|
import GF.Devel.UseIO
|
||||||
@@ -84,8 +73,8 @@ compileModule opts1 env file = do
|
|||||||
return e
|
return e
|
||||||
|
|
||||||
compileEnvShSt :: CompileEnv -> [ModName] -> CompileEnv
|
compileEnvShSt :: CompileEnv -> [ModName] -> CompileEnv
|
||||||
compileEnvShSt env@(_,sgr) fs = (0,sgr) where
|
compileEnvShSt env@(_,sgr) fs = (0,sgr2) where
|
||||||
sgr = MGrammar [m | m@(i,_) <- modules sgr, notElem (prt i) $ map fileBody fs]
|
sgr2 = MGrammar [m | m@(i,_) <- modules sgr, notElem (prt i) $ map fileBody fs]
|
||||||
|
|
||||||
compileOne :: Options -> CompileEnv -> FullPath -> IOE CompileEnv
|
compileOne :: Options -> CompileEnv -> FullPath -> IOE CompileEnv
|
||||||
compileOne opts env@(_,srcgr) file = do
|
compileOne opts env@(_,srcgr) file = do
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ module Main where
|
|||||||
|
|
||||||
import GF.Devel.Compile
|
import GF.Devel.Compile
|
||||||
import GF.Devel.GrammarToGFCC
|
import GF.Devel.GrammarToGFCC
|
||||||
|
---import GF.Devel.PrGrammar ---
|
||||||
|
|
||||||
import System
|
import System
|
||||||
|
|
||||||
@@ -12,9 +13,9 @@ main = do
|
|||||||
"-help":[] -> putStrLn "usage: gfc (--make) FILES"
|
"-help":[] -> putStrLn "usage: gfc (--make) FILES"
|
||||||
"--make":fs -> do
|
"--make":fs -> do
|
||||||
gr <- batchCompile fs
|
gr <- batchCompile fs
|
||||||
putStrLn $ prGrammar2gfcc gr ---
|
--- putStrLn $ prGrammar gr
|
||||||
--- writeFile "a.gfcc" $ prGrammar2gfcc gr
|
writeFile "a.gfcc" $ prGrammar2gfcc gr
|
||||||
--- putStrLn "wrote file a.gfcc"
|
putStrLn "Wrote file a.gfcc."
|
||||||
_ -> do
|
_ -> do
|
||||||
mapM_ batchCompile (map return xx)
|
mapM_ batchCompile (map return xx)
|
||||||
putStrLn "Done."
|
putStrLn "Done."
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ canon2gfcc cgr@(M.MGrammar ((a,M.ModMod abm):cms)) =
|
|||||||
cs = map (i2i . fst) cms
|
cs = map (i2i . fst) cms
|
||||||
adefs = [C.Fun f' (mkType ty) (C.Tr (C.AC f') []) |
|
adefs = [C.Fun f' (mkType ty) (C.Tr (C.AC f') []) |
|
||||||
(f,AbsFun (Yes ty) _) <- tree2list (M.jments abm), let f' = i2i f]
|
(f,AbsFun (Yes ty) _) <- tree2list (M.jments abm), let f' = i2i f]
|
||||||
cncs = [C.Cnc (i2i a) (concr abm)]
|
cncs = [C.Cnc (i2i lang) (concr m) | (lang,M.ModMod m) <- cms]
|
||||||
concr mo = cats mo ++ lindefs mo ++
|
concr mo = cats mo ++ lindefs mo ++
|
||||||
optConcrete
|
optConcrete
|
||||||
[C.Lin (i2i f) (mkTerm tr) |
|
[C.Lin (i2i f) (mkTerm tr) |
|
||||||
|
|||||||
Reference in New Issue
Block a user