Copyright | Chua Hou 2021 |
---|---|
License | MIT |
Maintainer | Chua Hou <human+github@chuahou.dev> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The DSL used to describe CFGs.
Documentation
CFG v t
is the type of context-free grammars with variables of type v
and terminals of type t
. Each such grammar contains the set of Rule
s
and the start symbol. The list of terminals and non-terminals does not need
to be explicitly stated for our purposes.
Rule v t
is a CFG rule with variables of type v
and terminals of type
t
. Variables with more than one rule should have multiple Rule
s, for
example, \(S \to AB \mid \epsilon\) should have rules [S :-> [Left A, Left
B], S :-> []]
.
v :-> (Production v t) |
|
Instances
(Eq v, Eq t) => Eq (Rule v t) Source # | |
(Ord v, Ord t) => Ord (Rule v t) Source # | |
(Show v, Show t) => Show (Rule v t) Source # | |