[antlr-interest] ANTLR Questions

Johannes Luber JALuber at gmx.de
Wed Jan 21 06:04:57 PST 2009


> On Wed, Jan 21, 2009 at 11:55 PM, Bruno Marc-Aurele
> <bruno.marc-aurele at polymtl.ca> wrote:
> > Another question pops for me: can I define new attributes for a node in
> semantic
> > actions? For example, if I write the following rule:
> >
> > rule: ID subrule {$subrule.newAttribute = 1;} INT;
> >
> > ... will my node object have a "newAttribute" property (C# target) when
> > generated?
> ANTLR doesn't generate the custom AST types for you, you must manually
> create them.
> 
> Tom.

Isn't the option ASTLabelType used to switch to a different class? Or would one implement a new TreeNodeFactory (class name may be different)?

Johannes
-- 
NUR NOCH BIS 31.01.! GMX FreeDSL - Telefonanschluss + DSL 
für nur 16,37 EURO/mtl.!* http://dsl.gmx.de/?ac=OM.AD.PD003K11308T4569a


More information about the antlr-interest mailing list