Added --output-format=regular.

This commit is contained in:
bjorn
2008-09-25 11:49:00 +00:00
parent 4d96eb7e9a
commit 8001ea8ea0
3 changed files with 7 additions and 1 deletions

View File

@@ -37,6 +37,7 @@ exportPGF opts fmt pgf =
FmtProlog -> multi "pl" grammar2prolog
FmtProlog_Abs -> multi "pl" grammar2prolog_abs
FmtBNF -> single "bnf" bnfPrinter
FmtRegular -> single "bnf" regularPrinter
FmtFCFG -> single "fcfg" fcfgPrinter
FmtSRGS_XML -> single "grxml" (srgsXmlPrinter sisr)
FmtSRGS_XML_NonRec -> single "grxml" srgsXmlNonRecursivePrinter

View File

@@ -87,6 +87,7 @@ data OutputFormat = FmtPGF
| FmtProlog
| FmtProlog_Abs
| FmtBNF
| FmtRegular
| FmtFCFG
| FmtSRGS_XML
| FmtSRGS_XML_NonRec
@@ -456,6 +457,7 @@ outputFormats =
("prolog", FmtProlog),
("prolog_abs", FmtProlog_Abs),
("bnf", FmtBNF),
("regular", FmtRegular),
("fcfg", FmtFCFG),
("srgs_xml", FmtSRGS_XML),
("srgs_xml_nonrec", FmtSRGS_XML_NonRec),

View File

@@ -4,7 +4,7 @@
--
-- Approximates PGF grammars with context-free grammars.
----------------------------------------------------------------------
module GF.Speech.PGFToCFG (bnfPrinter, fcfgPrinter, pgfToCFG) where
module GF.Speech.PGFToCFG (bnfPrinter, regularPrinter, fcfgPrinter, pgfToCFG) where
import PGF.CId
import PGF.Data as PGF
@@ -23,6 +23,9 @@ import qualified Data.Set as Set
bnfPrinter :: PGF -> CId -> String
bnfPrinter pgf cnc = prCFG $ pgfToCFG pgf cnc
regularPrinter :: PGF -> CId -> String
regularPrinter pgf cnc = prCFG $ makeSimpleRegular $ pgfToCFG pgf cnc
-- FIXME: move this somewhere else
fcfgPrinter :: PGF -> CId -> String
fcfgPrinter pgf cnc = unlines (map showRule rules)