1
0
forked from GitHub/gf-core

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 -> multi "pl" grammar2prolog
FmtProlog_Abs -> multi "pl" grammar2prolog_abs FmtProlog_Abs -> multi "pl" grammar2prolog_abs
FmtBNF -> single "bnf" bnfPrinter FmtBNF -> single "bnf" bnfPrinter
FmtRegular -> single "bnf" regularPrinter
FmtFCFG -> single "fcfg" fcfgPrinter FmtFCFG -> single "fcfg" fcfgPrinter
FmtSRGS_XML -> single "grxml" (srgsXmlPrinter sisr) FmtSRGS_XML -> single "grxml" (srgsXmlPrinter sisr)
FmtSRGS_XML_NonRec -> single "grxml" srgsXmlNonRecursivePrinter FmtSRGS_XML_NonRec -> single "grxml" srgsXmlNonRecursivePrinter

View File

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

View File

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