Chiyuan Zhang wrote:
> I'm wondering if Treetop can provide (or is it already have?) a
> mechanize like this:
> 
> module MyModule
>   Treetop.load("my")
> end
> so that I'll get a MyModule::MyParser instead of a top-level MyParser.

The Treetop meta-grammar allows you to define your grammar inside a
module, even more than one level. The parser will be emitted inside
a module of the same name.

module MyModule
  grammar MyLang
    rule top
      ...
    end
  end
end

Clifford Heath