From 79cbcdad2d5751e086990d8d98dfef4fcb4a8612 Mon Sep 17 00:00:00 2001 From: krasimir Date: Thu, 12 Jun 2008 13:11:38 +0000 Subject: add generation of erasing PMCFG grammars --- src-3.0/PGF.hs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src-3.0/PGF.hs') diff --git a/src-3.0/PGF.hs b/src-3.0/PGF.hs index f60ba852e..aa2fa2edf 100644 --- a/src-3.0/PGF.hs +++ b/src-3.0/PGF.hs @@ -172,11 +172,15 @@ readPGF f = do linearize pgf lang = PGF.Linearize.linearize pgf (mkCId lang) parse pgf lang cat s = - case lookParser pgf (mkCId lang) of - Nothing -> error ("Unknown language: " ++ lang) - Just pinfo -> case parseFCFG "bottomup" pinfo (mkCId cat) (words s) of - Ok x -> x - Bad s -> error s + case Map.lookup (mkCId lang) (concretes pgf) of + Just cnc -> case parser cnc of + Just pinfo -> if Map.lookup (mkCId "erasing") (cflags cnc) == Just "on" + then Incremental.parse pinfo (mkCId cat) (words s) + else case parseFCFG "bottomup" pinfo (mkCId cat) (words s) of + Ok x -> x + Bad s -> error s + Nothing -> error ("No parser built fo language: " ++ lang) + Nothing -> error ("Unknown language: " ++ lang) linearizeAll mgr = map snd . linearizeAllLang mgr linearizeAllLang mgr t = -- cgit v1.2.3