[antlr-interest] tree construction question

Joe Fouad fawzyj at yahoo.com
Fri Mar 3 22:15:53 PST 2006

hi all
this is the first time to send to this listas i am relatively a new anltr user
ok to the question
i wanna be able to parse something like 
int i,j,k;
String  a,b,c;
and produce a tree representation as a result
i am using antlr2.7.5
so i wrote the following grammer(i call variables attributes)
attributes !:
 ( t:(! type { #t = #([TYPE, "type"] , type);} ) n:IDENT   { #([ATTR,"attribute"] ,t ,n) ;} (COMMA! m:IDENT  { 
  #([ATTR,"attribute"] ,t, m) ;} )* SEMI! )*
 { #attributes = #([ATTRS,"attributes"],#attributes) ;}
actually antlr does its job nicely and translated without error but the javac compiler complain 
i thought that my rules is not good enough so i refactored it  to 2 rules
 (t:(! type) var_list[#t] SEMI!)*
var_list![AST type_node]:
 (name:IDENT {#([ATTR,"attribute"],type_node,name,n);})+
it produces the same error which is
[antlr] ANTLR Parser Generator   Version 2.7.5   1989-2005 jGuru.com
    [javac] Compiling 26 source files to D:\Documents and Settings\Administrator\IdeaProjects\EAG\lang\classes
    [javac] D:\Documents and 
  Settings\Administrator\IdeaProjects\EAG\lang\src\com\corp\lang\recogniser\LangParser.java:814: not a statement
    [javac]      (AST)astFactory.make( (new 
    [javac]                                         ^
    [javac] D:\Documents and 
  Settings\Administrator\IdeaProjects\EAG\lang\src\com\corp\lang\recogniser\LangTreeWalker.java:36: ')' expected
    [javac]      definition(_t,LanguageLinker linker);
    [javac]                                                                      ^
    [javac] 2 errors
the compiler error is very generic and i cannot distinguish what's wrong
so please someone tell me what is wrong, actually i am following the manual and the examples
thanx in advance
by the way i read that version 2.7.6 fixed a bug related to tree construction ,is there any relation?
and if that version fix it,please send me the jar as the build instructions state that i have to have cygwin(or unix like) env
thanx to all of u

 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20060303/44a814f5/attachment.html

More information about the antlr-interest mailing list