[antlr-interest] How does the two rules differ in a tree parser ?
Terence Parr
parrt at cs.usfca.edu
Sun Jul 10 12:27:40 PDT 2005
On Jul 9, 2005, at 11:47 PM, Subhobroto Sinha wrote:
>
> In a treeparser, what does this mean (in english, verbosely if
> possible):
>
> declarator : #(varName : ID {std::cout<<"\n variable name : " <<
> varName->getText();} (fixedArraySize)*) ;
It means match a tree with ID at the root and zero or more children
whose structure is specified by fixedArraySize.
> and why does it behave differently from :
>
> declarator : varName : ID {std::cout<<"\n variable name : " <<
> varName->getText();} (fixedArraySize)* ;
Because the first one is a 2D structure with ID at the root.
Ter
--
CS Professor & Grad Director, University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
More information about the antlr-interest
mailing list