| • A is a nonterminal | production's left-hand side (lhs) |
| • r is a sequence of terminals and/or nonterminals | production's right-hand side (rhs) |
| • e is a Haskell expression | production's semantic rule |
• Output: a recursive descent monadic parser, that parses strings and returns the value specified by the (semantic rule of the) first production. Each production specifies a (sub)string to be parsed and the value obtained after a successful parsing.
• Mímico parses alternatives in their textual order — the Pastor rule (parse as specified by the textual order).
The generated parser tries to parse a subsequent alternative only if the previous ones have failed to produce a successful parse of the input.
In other words, grammar productions form a list, not a set: ambiguities never occur.
• Behaviour: For a list of
productions of the form:
• Semantic rules may also be monadic, in which case productions have the form:
Monadic semantic rules are typically used to control parsing. They
may specify parsing failure or success according to "semantic"
conditions. For example, in: