diff --git a/src-3.0/GF/Compile/Export.hs b/src-3.0/GF/Compile/Export.hs index 81d9e3140..25f99ed55 100644 --- a/src-3.0/GF/Compile/Export.hs +++ b/src-3.0/GF/Compile/Export.hs @@ -7,6 +7,8 @@ import PGF.Raw.Convert (fromPGF) import GF.Compile.GFCCtoHaskell import GF.Compile.GFCCtoJS import GF.Infra.Option +import GF.Speech.CFG +import GF.Speech.PGFToCFG import GF.Speech.SRGS import GF.Text.UTF8 @@ -22,6 +24,7 @@ prPGF fmt gr name = case fmt of FmtJavaScript -> pgf2js gr FmtHaskell -> grammar2haskell gr name FmtHaskell_GADT -> grammar2haskellGADT gr name + FmtBNF -> prCFG $ pgfToCFG gr (outputConcr gr) FmtSRGS_XML -> srgsXmlPrinter Nothing gr (outputConcr gr) -- | Get the name of the concrete syntax to generate output from. diff --git a/src-3.0/GF/Infra/Option.hs b/src-3.0/GF/Infra/Option.hs index be3ddfadb..5be0d4f7c 100644 --- a/src-3.0/GF/Infra/Option.hs +++ b/src-3.0/GF/Infra/Option.hs @@ -82,6 +82,7 @@ data OutputFormat = FmtPGF | FmtJavaScript | FmtHaskell | FmtHaskell_GADT + | FmtBNF | FmtSRGS_XML | FmtSRGS_ABNF | FmtJSGF @@ -418,6 +419,7 @@ outputFormats = ("js", FmtJavaScript), ("haskell", FmtHaskell), ("haskell_gadt", FmtHaskell_GADT), + ("bnf", FmtBNF), ("srgs", FmtSRGS_XML), ("srgs_xml", FmtSRGS_XML), ("srgs_abnf", FmtSRGS_ABNF), diff --git a/src-3.0/GF/Speech/CFG.hs b/src-3.0/GF/Speech/CFG.hs index 68a34caec..98d31c9f6 100644 --- a/src-3.0/GF/Speech/CFG.hs +++ b/src-3.0/GF/Speech/CFG.hs @@ -270,7 +270,7 @@ countRules = length . allRules prCFG :: CFG -> String prCFG = unlines . map prRule . allRules where - prRule r = lhsCat r ++ " --> " ++ unwords (map prSym (ruleRhs r)) + prRule r = lhsCat r ++ " ::= " ++ unwords (map prSym (ruleRhs r)) prSym = symbol id (\t -> "\""++ t ++"\"") -- diff --git a/src-3.0/GFC.hs b/src-3.0/GFC.hs index 8967ca495..bf34fa979 100644 --- a/src-3.0/GFC.hs +++ b/src-3.0/GFC.hs @@ -45,6 +45,7 @@ fmtExtension FmtPGF = "pgf" fmtExtension FmtJavaScript = "js" fmtExtension FmtHaskell = "hs" fmtExtension FmtHaskell_GADT = "hs" +fmtExtension FmtBNF = "bnf" fmtExtension FmtSRGS_XML = "grxml" writeOutputFile :: FilePath -> String -> IOE ()