[antlr-interest] Re: doubt in java grammar,

cintyram <cintyram at yahoo.com> cintyram at yahoo.com
Mon Feb 10 06:55:48 PST 2003


> <cintyram at y...> wrote:
> > hi,
> >  in the java grammar i found this rule ..
> > 
> > // conditional test (level 12)
> > conditionalExpression
> > 	:	logicalOrExpression
> > 		( QUESTION^ assignmentExpression COLON! 
> conditionalExpression )?
> > 	;
> > 
> > is it not true that (expr)? { s1;} : {s2} ;
> > is same as if(expr)
> >              {s1;}
> >             else
> >              {s2;}
> > 
> > in which case both of them should be statement|blockstatement
> > 
> > ; also could some one explain why the existing choice was made?
> 
> for ( <init> ; <cond> ; <iter> )
> {
>   // body
> }
> 
> is also equivalent to:
> 
> <init>
> while ( <cond> )
> {
>   // body
>   <iter>
> }
> 
> Do you have any doubt about the FOR or WHILE rules either?  ;-)
> 

im sorry you missed the point; it is not abt the equivalence of the
two constructs that i was asking, but it was abt using
assignmentExpression and conditionalExpression , where i thought
statement could have been used ;
cheers
ram

> Micheal


 

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



More information about the antlr-interest mailing list