Safe Haskell | None |
---|---|
Language | Haskell2010 |
- type RuleName = String
- type BranchName = String
- data Rule t = Rule {}
- ruleName :: Lens' (Rule t) RuleName
- ruleDescription :: Lens' (Rule t) (Maybe String)
- ruleType :: Lens' (Rule t) (RuleType t)
- data Branch t = Branch {
- _branchName :: BranchName
- _branches :: [Rule t]
- branchName :: Lens' (Branch t) BranchName
- branches :: Lens' (Branch t) [Rule t]
- newtype Predicate a = Predicate {
- unPredicate :: Q (TExp (a -> Bool))
- data RuleType t
- _Terminal :: Prism' (RuleType t) (Q (TExp (t -> Bool)))
- _NonTerminal :: Prism' (RuleType t) (NonEmpty (Branch t))
- _Wrap :: Prism' (RuleType t) (Rule t)
- _Record :: Prism' (RuleType t) [Rule t]
- _Opt :: Prism' (RuleType t) (Rule t)
- _Star :: Prism' (RuleType t) (Rule t)
- _Plus :: Prism' (RuleType t) (Rule t)
- _Series :: Prism' (RuleType t) (NonEmpty t)
- recordFieldName :: Int -> String -> String -> String
- data Loc = Loc {}
- line :: Lens' Loc Int
- col :: Lens' Loc Int
- pos :: Lens' Loc Int
Documentation
type RuleName = String Source #
Type synonym for the name of a production rule. This will be the
name of the type constructor for the corresponding type that will
be created, so this must be a valid Haskell type constructor name.
Typically each context-free grammar that you write will have
several production rules; you will want to make sure that every
RuleName
that you create for a single context-free grammar is
unique. However, Pinchot currently does not check for
uniqueness. If you use names that are not unique, GHC will give
an error message when you try to splice the resulting code, as
the data types will not have unique names.
type BranchName = String Source #
Type synonym the the name of an alternative in a nonTerminal
.
This name must not conflict with any other data constructor in
your grammar.
A single production rule.
A branch in a sum rule. In Branch s ls
, s
is the name of the
data constructor, and ls
is the list of rules that this branch
produces.
Branch | |
|
branchName :: Lens' (Branch t) BranchName Source #
Predicate | |
|
The type of a particular rule.
The name of a field in a record, without the leading underscore.
A location.