There’s a new tutorial on creating a small interpreter at
(note: this won’t make any sense if you don’t read the other, easier,
examples). This has now become part of the test suite. I hope it
some of the questions that people that have had. Although the
features its own exception mechanism (that has nothing to do with Ruby’s
exceptions), it still ‘leaks’ Ruby in several places. Plugging all these
leaks was not the goal. Remember, it’s just a sketch, to illustrate a
swathe of functionality. And you can already write some pretty bad
This release contains several small changes, some of which are
backwards-incompatible. Things just make more sense this way.
- Deprecated ParseSuccessResult#syntax_tree. Use
ParseSuccessResult#parse_tree from now on (it’s the proper name for it).
- Tokenizer#accumulator eliminated.
- Added a Tokenizer#create_token factory method. Use this to create
from now on.
- Tokenizer#tokenize now returns either a TokenizerSuccessResult or
TokenizerErrorResult, does not throw an exception on encountering
characters. (‘unexpected’ characters are actually quite expected.)
- Token now contains an attribute input_position, the index of the
input that it was created from.
- ParseErrorResult now contains the unexpected_token itself, not the
- Tokenizer returns the end symbol token for empty input.
Pretty much all of these were justified by the need for more meta-data
allow for proper error reporting. This functionality has been greatly
I’ve tried to incorporate Gregory B.'s suggestions into the newest
by including some sample usages for the most important classes.
Ok, I’m going to stop making backwards-incompatible changes now.