[antlr-interest] [C target] Duplicating tree error

Юрушкин Михаил yurushkin at rambler.ru
Thu Jan 21 03:21:43 PST 2010


Good day,

I have the following rewrite rule:

type_declaration_stmt
   : label? declaration_type_spec ( (T_COMMA  attr_spec )* T_COLON_COLON )?
     entity_decl (T_COMMA entity_decl)* end_of_stmt    	
     -> ^(T_TYPE_DECLARATION_STMT declaration_type_spec attr_spec*  
entity_decl)+
   ;

and this is a piece of tree parser grammar:

type_declaration_stmt
   :  ^(T_TYPE_DECLARATION_STMT declaration_type_spec attr_spec*  
entity_decl)
   ;


When I give "integer a, b, c" on the input, 3 sequential  
T_TYPE_DECLARATION-trees are
generated. It's right.
BUT declaration_type_spec subtree isn't dublicated (only the root of  
subtree).

Where is mistake?
thanks


-- 
Best regards,
Michael


More information about the antlr-interest mailing list