[antlr-interest] 2 C-target questions

Gavin Lambert antlr at mirality.co.nz
Thu Oct 4 01:07:50 PDT 2007


At 10:21 4/10/2007, Corno Schraverus wrote:
 >I played a bit with @decl and I found out that it only works at 
the
 >root level of a rule. Is there a way to declare variables at a
 >deeper level?

I don't think so, but if you need to do that sort of thing you can 
usually just factor it out into a subrule.  (If you can't factor 
it out into a subrule, then your variable may not be as local as 
you thought, and you might as well just declare it at the 
top.  This is C, after all -- while it permits declarations at the 
start of any block it's most common to only declare variables at 
the function entrypoint.



More information about the antlr-interest mailing list