Matching
start: die /^\Z/
die: 'd' number
| number 'd' number
number: /\d+/
- A rule matches if one of its productions matches; the parser will
try alternative productions in order.
- A production matches if each of its items matches in the order
given.
- Items match:
- Subrule: if the rule matches.
- Token: literal or regex match.
- Action: if the code returns a defined value.
- Directive: we'll come back to that.
- Comment: always a match; no text is consumed.
- Tokens match a prefix of the to be parsed strings. The part that is
matched will be consumed; this is similar to matching with
regular expressions.
[Prev]
[Next]
[Index]