Formalization which allows to describe a derivation process via DSL with type checking.
Assume, you a grammar
In module Grammar.Declarations:
- define
data N- a set of nonterminal symbols (e.g.data N = S | W | F)- Add
Econstructor - it represents any unknown symbol
- Add
- define
data T- a set of terminal symbols (e.g.data T = A | B)
In module Grammar.Extra:
- define
fromCharHelperwhich allows later to use DSL - define
data P- a set of the grammar's productions
- You can define any word from
$(\Sigma \sqcup N)^\ast$ with a string literal:"aFb" - You can define a production via
==>operator:S ==> "aSbS" - You can define an Earley item via
~>&*operators:(S ~> "a" * "SbS", 1, 1)
Descibe the derivation process in the Derive module. You may study the provided example there for further research.