summaryrefslogtreecommitdiff
path: root/src/GF/Grammar
diff options
context:
space:
mode:
authoraarne <unknown>2003-12-09 16:39:24 +0000
committeraarne <unknown>2003-12-09 16:39:24 +0000
commit08c9a2ab8cf7b77a5c0392f5f8e9643e39c89c5b (patch)
tree56add96ffe8436f3fe920deb4bc7da320bc19e5d /src/GF/Grammar
parent8e637feb793364134d469cb7d1e68605aab2c2ea (diff)
Introduced output of stripped format gfcm.
Diffstat (limited to 'src/GF/Grammar')
-rw-r--r--src/GF/Grammar/Compute.hs7
-rw-r--r--src/GF/Grammar/Macros.hs3
2 files changed, 8 insertions, 2 deletions
diff --git a/src/GF/Grammar/Compute.hs b/src/GF/Grammar/Compute.hs
index e400bce4e..6c557b479 100644
--- a/src/GF/Grammar/Compute.hs
+++ b/src/GF/Grammar/Compute.hs
@@ -25,7 +25,7 @@ computeConcrete g t = {- refreshTerm t >>= -} computeTerm g [] t
computeTerm :: SourceGrammar -> Substitution -> Term -> Err Term
computeTerm gr = comp where
- comp g t = --- errIn ("subterm" +++ prt t) $ --- for debugging
+ comp g t = ---- errIn ("subterm" +++ prt t) $ --- for debugging
case t of
Q (IC "Predef") _ -> return t
@@ -59,6 +59,7 @@ computeTerm gr = comp where
a' <- comp g a
case (f',a') of
(Abs x b,_) -> comp (ext x a' g) b
+ (QC _ _,_) -> returnC $ App f' a'
(FV fs, _) -> mapM (\c -> comp g (App c a')) fs >>= return . FV
(_, FV as) -> mapM (\c -> comp g (App f' c)) as >>= return . FV
@@ -172,8 +173,10 @@ computeTerm gr = comp where
_ -> return $ ExtR r' s'
-- case-expand tables
+ -- if already expanded, don't expand again
T i@(TComp _) cs -> do
- cs' <- mapPairsM (comp g) cs
+ -- if there are no variables, don't even go inside
+ cs' <- if (null g) then return cs else mapPairsM (comp g) cs
return $ T i cs'
T i cs -> do
diff --git a/src/GF/Grammar/Macros.hs b/src/GF/Grammar/Macros.hs
index 2edb183a1..291ea7521 100644
--- a/src/GF/Grammar/Macros.hs
+++ b/src/GF/Grammar/Macros.hs
@@ -175,6 +175,9 @@ appc = appCons . zIdent
mkLet :: [LocalDef] -> Term -> Term
mkLet defs t = foldr Let t defs
+mkLetUntyped :: Context -> Term -> Term
+mkLetUntyped defs = mkLet [(x,(Nothing,t)) | (x,t) <- defs]
+
isVariable (Vr _ ) = True
isVariable _ = False