bug fixed (?) in compilation

This commit is contained in:
aarne
2006-02-26 11:16:53 +00:00
parent c68e81406a
commit f1ffa2f17d
4 changed files with 13 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
incomplete concrete NounScand of Noun =
CatScand ** open CommonScand, ResScand, Prelude in {
flags optimize=none_subs ; ---- all_subs
flags optimize=all_subs ;
-- The rule defines $Det Quant Num Ord CN$ where $Det$ is empty if
-- it is the definite article ($DefSg$ or $DefPl$) and both $Num$ and

View File

@@ -36,6 +36,10 @@ lin n8 =
lin n9 =
{inh = conj ; s = table {{p1 = unit ; p2 = mod} => "nueve" ; {p1 = unit ; p2 = unmod} => "nueve" ; {p1 = unit ; p2 = conj} => "y" ++ "nueve" ; {p1 = teen ; p2 = mod} => "diecinueve" ; {p1 = teen ; p2 = unmod} => "diecinueve" ; {p1 = teen ; p2 = conj} => "diecinueve" ; {p1 = ten ; p2 = mod} => "noventa" ; {p1 = ten ; p2 = unmod} => "noventa" ; {p1 = ten ; p2 = conj} => "noventa" ; {p1 = hundred ; p2 = mod} => "novecientos" ; {p1 = hundred ; p2 = unmod} => "novecientos" ; {p1 = hundred ; p2 = conj} => "novecientos"}} ;
lin pot01 =
let
uno : Gender => Str = table {Masc => "uno" ; Fem => "una"} ;
yuno : Gender => Str = \\g => "y" ++ uno ! g ;
in
{s = table {{p1 = unit ; p2 = mod} => uno ; {p1 = unit ; p2 = unmod}
=> uno ; {p1 = unit ; p2 = conj} => yuno ; {p1 = teen ; p2 = mod} =>
uno ; {p1 = teen ; p2 = unmod} => uno ; {p1 = teen ; p2 = conj} =>
@@ -74,7 +78,5 @@ param Modif = mod | unmod | conj ;
oper spl : Str -> {s : Gender => Str ; n : Number} = \s -> {s = \\_ =>
s ; n = Pl} ;
uno : Gender => Str = table {Masc => "uno" ; Fem => "una"} ;
yuno : Gender => Str = \\g => "y" ++ uno ! g ;
}

View File

@@ -39,6 +39,7 @@ import GF.Compile.Optimize
import GF.Compile.GrammarToCanon
import GF.Canon.Share
import GF.Canon.Subexpressions (elimSubtermsMod,unSubelimModule)
import GF.UseGrammar.Linear (unoptimizeCanonMod) ----
import qualified GF.Canon.CanonToGrammar as CG
@@ -165,7 +166,7 @@ extendCompileEnvCanon ((k,s,c),fts) cgr ft =
type TimedCompileEnv = (CompileEnv,[(FilePath,ModTime)])
compileOne :: Options -> TimedCompileEnv -> FullPath -> IOE TimedCompileEnv
compileOne opts env@((_,srcgr,_),_) file = do
compileOne opts env@((_,srcgr,cancgr0),_) file = do
let putp = putPointE opts
let putpp = putPointEsil opts
@@ -189,7 +190,8 @@ compileOne opts env@((_,srcgr,_),_) file = do
-- for canonical gf, read the file and update environment, also source env
"gfc" -> do
cm <- putp ("+ reading" +++ file) $ getCanonModule file
sm <- ioeErr $ CG.canon2sourceModule $ unSubelimModule cm
let cancgr = updateMGrammar (MGrammar [cm]) cancgr0
sm <- ioeErr $ CG.canon2sourceModule $ unoptimizeCanonMod cancgr $ unSubelimModule cm
ft <- getReadTimes file
extendCompileEnv env (sm, cm) ft

View File

@@ -121,7 +121,10 @@ expandLinTables gr t = case t of
-- Do this for an entire grammar:
unoptimizeCanon :: CanonGrammar -> CanonGrammar
unoptimizeCanon g@(M.MGrammar ms) = M.MGrammar $ map convMod ms where
unoptimizeCanon g@(M.MGrammar ms) = M.MGrammar $ map (unoptimizeCanonMod g) ms
unoptimizeCanonMod :: CanonGrammar -> CanonModule -> CanonModule
unoptimizeCanonMod g = convMod where
convMod (m, M.ModMod (M.Module (M.MTConcrete a) x flags me os defs)) =
(m, M.ModMod (M.Module (M.MTConcrete a) x flags me os (mapTree convDef defs)))
convMod mm = mm