Safe Haskell | None |
---|---|
Language | Haskell2010 |
Creating Earley parsers.
- ruleToParser :: Lift t => String -> Rule t -> [(Name, ExpQ)]
- localRuleName :: String -> Name
- helperName :: String -> Name
- branchToParser :: Lift t => String -> Branch t -> ExpQ
- earleyGrammarFromRule :: Lift t => Qualifier -> Rule t -> Q Exp
- allRulesRecord :: Qualifier -> Seq (Rule t) -> DecsQ
- earleyProduct :: Lift t => Qualifier -> Qualifier -> Seq (Rule t) -> ExpQ
Documentation
Creates a list of pairs. Each list represents a statement in
do
notation. The first element of the pair is the name of the
variable to which to bind the result of the expression, which is
the second element of the pair.
localRuleName :: String -> Name Source
helperName :: String -> Name Source
:: Lift t | |
=> Qualifier | Module prefix holding the data types created with
|
-> Rule t | Create a grammar for this |
-> Q Exp |
Creates an expression that has type
Grammar
r (Prod r String (c, a) (p c a))
where r
is left universally quantified; c
is the terminal
type (often Char
), a
is arbitrary metadata about each token
(often Loc
) and p
is the data type corresponding to
the given Rule
.
Example: addressGrammar
.
:: Qualifier | Qualifier for data types corresponding to those created from
the |
-> Seq (Rule t) | A record is created that holds a value for each |
-> DecsQ | When spliced, this will create a single declaration that is a
record with the name a'NAME where |
Creates a record data type that holds a value of type
Prod
rString
(t, a) (p t a)
where
r
is left universally quantifiedt
is the token type (oftenChar
)a
is any additional information about each token (oftenLoc
)p
is the type of the particular production
This always creates a single product type whose name is
Productions
; currently the name cannot be configured.
Example: Pinchot.Examples.SyntaxTrees.
:: Lift t | |
=> Qualifier | Qualifier for data types corresponding to those created from
the |
-> Qualifier | Qualifier for the type created with |
-> Seq (Rule t) | Creates an Earley grammar that contains a |
-> ExpQ | When spliced, |
Creates a Grammar
that contains a
Prod
for every given Rule
and its ancestors.
Example: addressAllProductions
.