1
0
forked from GitHub/gf-core

started a graphviz visualization for the LR(0) automaton

This commit is contained in:
Krasimir Angelov
2023-09-19 21:19:54 +02:00
parent 2582719fab
commit dccb9681a2
6 changed files with 47 additions and 3 deletions

View File

@@ -48,6 +48,7 @@ exportPGF opts fmt pgf =
FmtSLF -> single "slf" slfPrinter
FmtRegExp -> single "rexp" regexpPrinter
FmtFA -> single "dot" slfGraphvizPrinter
FmtLR -> single "dot" (\_ -> graphvizLRAutomaton)
where
name = fromMaybe (abstractName pgf) (flag optName opts)
@@ -58,4 +59,3 @@ exportPGF opts fmt pgf =
single :: String -> (PGF -> Concr -> String) -> [(FilePath,String)]
single ext pr = [(concreteName cnc <.> ext, pr pgf cnc) | cnc <- Map.elems (languages pgf)]

View File

@@ -106,6 +106,7 @@ data OutputFormat = FmtPGFPretty
| FmtSLF
| FmtRegExp
| FmtFA
| FmtLR
deriving (Eq,Ord)
data SISRFormat =
@@ -490,7 +491,8 @@ outputFormatsExpl =
(("vxml", FmtVoiceXML),"Voice XML based on abstract syntax"),
(("slf", FmtSLF),"SLF speech recognition format"),
(("regexp", FmtRegExp),"regular expression"),
(("fa", FmtFA),"finite automaton in graphviz format")
(("fa", FmtFA),"finite automaton in graphviz format"),
(("lr", FmtLR),"LR(0) automaton for PMCFG in graphviz format")
]
instance Show OutputFormat where