[antlr-interest] Re: doubt in java grammar,
micheal_jor <open.zone at virgin.net>
open.zone at virgin.net
Fri Feb 7 13:23:19 PST 2003
--- In antlr-interest at yahoogroups.com, "cintyram <cintyram at y...>"
<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? ;-)
Micheal
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list