mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-22 03:09:33 -06:00
-val optimization
This commit is contained in:
@@ -252,9 +252,12 @@ generateModuleCode :: Options -> InitPath -> SourceModule -> IOE GFC.CanonModule
|
||||
generateModuleCode opts path minfo@(name,info) = do
|
||||
let pname = prefixPathName path (prt name)
|
||||
minfo0 <- ioeErr $ redModInfo minfo
|
||||
minfo' <- return $ if optim
|
||||
then shareModule fullOpt minfo0 -- parametrization and sharing
|
||||
else shareModule basicOpt minfo0 -- sharing only
|
||||
minfo' <- return $
|
||||
if optim
|
||||
then shareModule fullOpt minfo0 -- parametrization and sharing
|
||||
else if values
|
||||
then shareModule valOpt minfo0 -- tables as courses-of-values
|
||||
else shareModule basicOpt minfo0 -- sharing only
|
||||
|
||||
-- for resource, also emit gfr
|
||||
case info of
|
||||
@@ -279,6 +282,7 @@ generateModuleCode opts path minfo@(name,info) = do
|
||||
nomulti = not $ oElem makeMulti opts
|
||||
emit = oElem emitCode opts && not (oElem notEmitCode opts)
|
||||
optim = oElem optimizeCanon opts
|
||||
values = oElem optimizeValues opts
|
||||
|
||||
-- for old GF: sort into modules, write files, compile as usual
|
||||
|
||||
|
||||
@@ -198,6 +198,10 @@ redCTerm t = case t of
|
||||
ps' <- mapM redPatt ps
|
||||
ts' <- mapM redCTerm ts
|
||||
return $ G.T ty' $ map (uncurry G.Cas) $ zip (map singleton ps') ts'
|
||||
V ty ts -> do
|
||||
ty' <- redCType ty
|
||||
ts' <- mapM redCTerm ts
|
||||
return $ G.V ty' ts'
|
||||
S u v -> liftM2 G.S (redCTerm u) (redCTerm v)
|
||||
K s -> return $ G.K (G.KS s)
|
||||
EInt i -> return $ G.EInt $ toInteger i
|
||||
|
||||
@@ -188,6 +188,7 @@ evalPrintname gr c ppr lin =
|
||||
Abs _ b -> oneBranch b
|
||||
R (r:_) -> oneBranch $ snd $ snd r
|
||||
T _ (c:_) -> oneBranch $ snd c
|
||||
V _ (c:_) -> oneBranch c
|
||||
FV (t:_) -> oneBranch t
|
||||
C x y -> C (oneBranch x) (oneBranch y)
|
||||
S x _ -> oneBranch x
|
||||
|
||||
Reference in New Issue
Block a user