From 992a7ffb381190ffa67f59f33d0dfadf41f84e78 Mon Sep 17 00:00:00 2001 From: krasimir Date: Fri, 18 Jun 2010 12:55:58 +0000 Subject: Yay!! Direct generation of PMCFG from GF grammar --- src/compiler/GF/Compile/Concrete/AppPredefined.hs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/compiler/GF/Compile/Concrete/AppPredefined.hs') diff --git a/src/compiler/GF/Compile/Concrete/AppPredefined.hs b/src/compiler/GF/Compile/Concrete/AppPredefined.hs index 73355381e..30f555b60 100644 --- a/src/compiler/GF/Compile/Concrete/AppPredefined.hs +++ b/src/compiler/GF/Compile/Concrete/AppPredefined.hs @@ -73,17 +73,17 @@ appPredefined t = case t of -- one-place functions Q (mod,f) | mod == cPredef -> case x of - (K s) | f == cLength -> retb $ EInt $ toInteger $ length s + (K s) | f == cLength -> retb $ EInt $ length s _ -> retb t -- two-place functions App (Q (mod,f)) z0 | mod == cPredef -> do (z,_) <- appPredefined z0 case (norm z, norm x) of - (EInt i, K s) | f == cDrop -> retb $ K (drop (fi i) s) - (EInt i, K s) | f == cTake -> retb $ K (take (fi i) s) - (EInt i, K s) | f == cTk -> retb $ K (take (max 0 (length s - fi i)) s) - (EInt i, K s) | f == cDp -> retb $ K (drop (max 0 (length s - fi i)) s) + (EInt i, K s) | f == cDrop -> retb $ K (drop i s) + (EInt i, K s) | f == cTake -> retb $ K (take i s) + (EInt i, K s) | f == cTk -> retb $ K (take (max 0 (length s - i)) s) + (EInt i, K s) | f == cDp -> retb $ K (drop (max 0 (length s - i)) s) (K s, K t) | f == cEqStr -> retb $ if s == t then predefTrue else predefFalse (K s, K t) | f == cOccur -> retb $ if substring s t then predefTrue else predefFalse (K s, K t) | f == cOccurs -> retb $ if any (flip elem t) s then predefTrue else predefFalse @@ -119,7 +119,6 @@ appPredefined t = case t of (K x,K y) -> K (x +++ y) _ -> t _ -> t - fi = fromInteger -- read makes variables into constants -- cgit v1.2.3