Modulerere-0.2.0.2Haskell2010
RERE.CFG
Context free grammars, where each production is a regular-expression.
- 2 types
- 1 value
- Packagerere-0.2.0.2
- Exports3
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceCFG.hs
Context-free grammars
2 declarationsSingle equation in context-free-grammar equation.
Conversion to recursive regular expressions
1 declarationConvert CFG (with names for productions) into RE. Note: the start symbol have to be last equation.
let a = Eps \/ ch_ 'a' <> Var (Left FZ)let b = Eps \/ ch_ 'b' <> Var (Left (FS FZ))let cfg = b ::: a ::: VNil
[ begin{aligned} {mathit{b}} &= {varepsilon}cupmathtt{b}{mathit{a}} -- {mathit{a}} &= {varepsilon}cupmathtt{a}{mathit{b}} -- end{aligned}