Carl --
> I am trying to write a the grammar on Treetop, but I am getting error:
> TypeError: wrong argument type Class (expected Module).
Unfortunately I'm not somewhere that I can try out your grammar to test
this theory, but I believe the issue is with that rules that only have
one component do not generate a new syntax node (which would be done
with a class) but instead just extend it (with a module). You can work
around this by adding a dummy component (say, an empty string, '') to
the rule in question.
I think, though, that the deeper issue may be the way in which you are
using classes to "tag" nodes in the syntax tree, rather than having them
be actual full-fledged classes that know how to compute what you want,
rather than trying to walk the tree yourself.
See the last section of:
http://treetop.rubyforge.org/using_in_ruby.html
("Using Parse Results") for the reasoning and look through
http://treetop.rubyforge.org/semantic_interpretation.html for details.
In Arron's example he switches to doing things the right way at the end,
and the clean tree bit is really only there to let him produce a less
cluttered output. Unfortunately, it's frequently confusing to people
just starting out with Treetop (see this earlier thread on the list:
https://groups.google.com/forum/?fromgroups=#!
topic/treetop-dev/8tzdfWxGY0k where we walked someone through this very
same problem).
-- MarkusQ