Conversion to Ruby of the examples in the book Language Implementation Patterns by Terence Parr