From b114cfda7736394a5a38f2c1bf731f08f1501eca Mon Sep 17 00:00:00 2001 From: bjorn Date: Thu, 25 Sep 2008 13:41:07 +0000 Subject: Added --output-format=nolr. Minor makeRegular refactoring. --- src/GF/Speech/PGFToCFG.hs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/GF/Speech/PGFToCFG.hs') diff --git a/src/GF/Speech/PGFToCFG.hs b/src/GF/Speech/PGFToCFG.hs index d52c8807c..6b834d1a4 100644 --- a/src/GF/Speech/PGFToCFG.hs +++ b/src/GF/Speech/PGFToCFG.hs @@ -4,7 +4,8 @@ -- -- Approximates PGF grammars with context-free grammars. ---------------------------------------------------------------------- -module GF.Speech.PGFToCFG (bnfPrinter, regularPrinter, fcfgPrinter, pgfToCFG) where +module GF.Speech.PGFToCFG (bnfPrinter, nonLeftRecursivePrinter, regularPrinter, + fcfgPrinter, pgfToCFG) where import PGF.CId import PGF.Data as PGF @@ -21,10 +22,16 @@ import Data.Set (Set) import qualified Data.Set as Set bnfPrinter :: PGF -> CId -> String -bnfPrinter pgf cnc = prCFG $ pgfToCFG pgf cnc +bnfPrinter = toBNF id + +nonLeftRecursivePrinter :: PGF -> CId -> String +nonLeftRecursivePrinter = toBNF removeLeftRecursion regularPrinter :: PGF -> CId -> String -regularPrinter pgf cnc = prCFG $ makeSimpleRegular $ pgfToCFG pgf cnc +regularPrinter = toBNF makeRegular + +toBNF :: (CFG -> CFG) -> PGF -> CId -> String +toBNF f pgf cnc = prCFG $ f $ pgfToCFG pgf cnc -- FIXME: move this somewhere else fcfgPrinter :: PGF -> CId -> String -- cgit v1.2.3