Next | Higher-Order Parsing | 41 |
Idea: each grammar rule becomes a function
A parser function gets the current token list as an argument
It can examine the tokens at the head of the list
It can pass all or part of the list to another parser
If it likes what it sees, it returns a success value
In this case, it informs its caller of how many tokens it consumed from the input
Probably by returning a suitable suffix of the original list
Next | Copyright © 2007 M. J. Dominus |