[antlr-interest] Clarification on grammar needed

rameshkum45 <ramesh.rangarajan at wipro.com> ramesh.rangarajan at wipro.com
Wed Feb 26 09:33:38 PST 2003


I am looking for some help on the ANTLR grammer

I have a piece of grammer, could you please tell me which ANTLR 
version it refers to, also could you please explain few things in 
this grammer which I could not understand here. Mainly I didn't 
understand the definition rule.... why there is an '!' mark at the 
end of the rule name... what does that # do in the beginning of some 
places... what does "c:comment" indicate

specification 

: (definition)+ EOF!

;

definition! 

{ String comment = null; 

boolean localGenSpecs = genSpecs; }

: (c:comment { comment = c_AST.getText(); } )?

( { if (localGenSpecs) 

nestingDepth++; 

}

n:name_scope!

{ #definition = #n;

if (localGenSpecs) 

nestingDepth--; 

if (comment != null) 

#n.setAttribute(Main.COMMENT,comment);

}

| d:const_dcl SEMI!

{ definition_AST = d_AST;

if (comment != null) 

#d.setAttribute(Main.COMMENT,comment); 

}

)

;



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list