| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.Cfg.Bnf
Description
A simple, concrete instance of Cfg that can be parsed from source.
The grammar of Bnf source is:
grammar ::= (production)+.
production ::= LOWER_CASE_STRING "::=" right_hand_sides ".".
right_hand_sides ::= right_hand_side ("|" right_hand_side)*.
right_hand_side ::= term*.
term ::= UPPER_CASE_STRING | LOWER_CASE_STRING.
where * means zero or more repetitions and + means one or more repetitions. Terminals are indicated by strings of upper-case characters and underscores; nonterminals by strings of lower-case characters and underscores. Quoted strings are literal tokens.
- newtype Grammar t nt = Grammar {
- grammarProductions :: [Production t nt]
- bnf :: QuasiQuoter
- parse :: String -> Grammar String String
Documentation
A simple, concrete instance of Cfg. The terminal and
nonterminal symbols of a Grammar are defined to be exactly those
appearing the productions. The start symbol is defined to be the
head of the first of the productions.
Constructors
| Grammar | |
Fields
| |
bnf :: QuasiQuoter Source
QuasiQuoter for BNF source. Generates a value of type
Grammar. Not usable in pattern, type or declaration positions.