[antlr-interest] Codegen confusion

Rick Mann rmann at latencyzero.com
Sun Jan 18 04:13:27 PST 2009


I'm having a hard time getting a handle on how all the various  
StringTemplates get instantiated and invoked. I thought I was getting  
the hang of it, then I expanded my grammar a bit beyond the super- 
simple one given in the codegen wiki page.

I added a parser rule to what was originally just a lexical rule, and  
when processing my test grammar, I suddenly got this complaint:

error(10):  internal error: T.g : java.util.NoSuchElementException: no  
such attribute: bitsets in template context [headerFile lexer]

The lexer() ST doesn't have a bitsets parameter, and neither do its  
counterparts in C.stg or Java.stg. Why does it suddenly want it in mine?

If I add a bitsets parameter, it seems to come out okay, but I'm  
reluctant to do that since no one else seemed to need it; I figure I'm  
doing something else wrong.

TIA,
-- 
Rick



More information about the antlr-interest mailing list