rere-0.1: Regular-expressions extended with fixpoints for context-free powers

Safe HaskellTrustworthy
LanguageHaskell2010

RERE.Examples.JSON

Description

JSON grammar example.

Synopsis

Documentation

type Size = Mult2 (Plus Nat5 Nat6) Source #

Size of JSON grammar, 22.

jsonRE' :: RE Void Source #

JSON recursive regular expression constructor from jsonCFG.

jsonRE' = compact (cfgToRE jsonNames jsonCFG)

The conversion doesn't optimize the resulting regular expression, but is relatively fast.

>>> size (cfgToRE jsonNames jsonCFG)
232

jsonRE is pre-calculated variant.

>>> size jsonRE
205

jsonNames :: Vec Size Name Source #

Names of jsonCFG productions.

jsonCFG :: forall a. Ord a => CFG Size a Source #

JSON grammar

jsonRE :: RE Void Source #

Pre-calculated JSON grammar as regular expression.

>>> size jsonRE
205

See jsonRE' for one constructed from jsonCFG.