mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 19:42:50 -06:00
Use ebnf format for "regular" output-format.
This commit is contained in:
@@ -14,7 +14,7 @@ import GF.Speech.SRGS_ABNF
|
|||||||
import GF.Speech.SRGS_XML
|
import GF.Speech.SRGS_XML
|
||||||
import GF.Speech.JSGF
|
import GF.Speech.JSGF
|
||||||
import GF.Speech.GSL
|
import GF.Speech.GSL
|
||||||
import GF.Speech.SRG (ebnfPrinter, nonLeftRecursivePrinter)
|
import GF.Speech.SRG
|
||||||
import GF.Speech.VoiceXML
|
import GF.Speech.VoiceXML
|
||||||
import GF.Speech.SLF
|
import GF.Speech.SLF
|
||||||
import GF.Speech.PrRegExp
|
import GF.Speech.PrRegExp
|
||||||
@@ -40,7 +40,7 @@ exportPGF opts fmt pgf =
|
|||||||
FmtBNF -> single "bnf" bnfPrinter
|
FmtBNF -> single "bnf" bnfPrinter
|
||||||
FmtEBNF -> single "ebnf" ebnfPrinter
|
FmtEBNF -> single "ebnf" ebnfPrinter
|
||||||
FmtNoLR -> single "ebnf" nonLeftRecursivePrinter
|
FmtNoLR -> single "ebnf" nonLeftRecursivePrinter
|
||||||
FmtRegular -> single "bnf" regularPrinter
|
FmtRegular -> single "ebnf" 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
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
--
|
--
|
||||||
-- Approximates PGF grammars with context-free grammars.
|
-- Approximates PGF grammars with context-free grammars.
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
module GF.Speech.PGFToCFG (bnfPrinter, regularPrinter,
|
module GF.Speech.PGFToCFG (bnfPrinter,
|
||||||
fcfgPrinter, pgfToCFG) where
|
fcfgPrinter, pgfToCFG) where
|
||||||
|
|
||||||
import PGF.CId
|
import PGF.CId
|
||||||
@@ -26,9 +26,6 @@ import qualified Data.Set as Set
|
|||||||
bnfPrinter :: PGF -> CId -> String
|
bnfPrinter :: PGF -> CId -> String
|
||||||
bnfPrinter = toBNF id
|
bnfPrinter = toBNF id
|
||||||
|
|
||||||
regularPrinter :: PGF -> CId -> String
|
|
||||||
regularPrinter = toBNF makeRegular
|
|
||||||
|
|
||||||
toBNF :: (CFG -> CFG) -> PGF -> CId -> String
|
toBNF :: (CFG -> CFG) -> PGF -> CId -> String
|
||||||
toBNF f pgf cnc = prCFG $ f $ pgfToCFG pgf cnc
|
toBNF f pgf cnc = prCFG $ f $ pgfToCFG pgf cnc
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ module GF.Speech.SRG (SRG(..), SRGRule(..), SRGAlt(..), SRGItem, SRGSymbol
|
|||||||
, SRGNT, CFTerm
|
, SRGNT, CFTerm
|
||||||
, ebnfPrinter
|
, ebnfPrinter
|
||||||
, nonLeftRecursivePrinter
|
, nonLeftRecursivePrinter
|
||||||
|
, regularPrinter
|
||||||
, makeSimpleSRG
|
, makeSimpleSRG
|
||||||
, makeNonRecursiveSRG
|
, makeNonRecursiveSRG
|
||||||
, getSpeechLanguage
|
, getSpeechLanguage
|
||||||
@@ -73,6 +74,9 @@ ebnfPrinter pgf cnc = prSRG $ makeSRG id pgf cnc
|
|||||||
nonLeftRecursivePrinter :: PGF -> CId -> String
|
nonLeftRecursivePrinter :: PGF -> CId -> String
|
||||||
nonLeftRecursivePrinter pgf cnc = prSRG $ makeSRG removeLeftRecursion pgf cnc
|
nonLeftRecursivePrinter pgf cnc = prSRG $ makeSRG removeLeftRecursion pgf cnc
|
||||||
|
|
||||||
|
regularPrinter :: PGF -> CId -> String
|
||||||
|
regularPrinter pgf cnc = prSRG $ makeSRG makeRegular pgf cnc
|
||||||
|
|
||||||
makeSRG :: (CFG -> CFG) -> PGF -> CId -> SRG
|
makeSRG :: (CFG -> CFG) -> PGF -> CId -> SRG
|
||||||
makeSRG = mkSRG cfgToSRG
|
makeSRG = mkSRG cfgToSRG
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user