From: Clifford Heath Date: 2008-02-07T11:04:57+09:00 Subject: Re: TreeTop: dealing with Grammars in multiple files? Phil Tomson wrote: > I know that you can include one grammar into another like so: > > grammar foo > include Bar_grammar > end > > But what if Bar_grammar is defined in a different file? I tried: > > load_grammar "Bar_grammar" > grammar Foo > include Bar_grammar > end > > but that doesnt' work. I haven't done this, but I think I might have said this was the way to compose grammars. I suspect I was wrong, and that what you need to do is to require both grammars, then re-open one of the generated parser classes (which includes the module for that grammar), and simply include the other grammar. BTW, load_grammar is deprecated - in fact I thought it had been removed. Are you using an old gem? The current incantation is to call Treetop.load, or just to simply require the .treetop file (which gets Polyglot to load it for you). The file to be required may be called with either a .tt or .treetop extension. Clifford Heath.