Gabriel Petrovay wrote:

Why don't you run the grammar check in ANTLRWorks, which then points out 
the ambiguity pretty instantly. Also, if posting a grammar, make sure it 
is one that can be pasted into ANTLRWorks and just used - yours is a 
parser grammar without the lexer tokens, which means it will give errors.
>>
>> PARSER GRAMMAR:
>> --------------------------------------------------
>> parser grammar exit_test;
>>
>> options {
>> tokenVocab=XQueryLexer;
>> }
>>
>>
>> pm_Expr
>>                : p_ExprSingle EOF
>>                ;
>>
>> p_ExprSingle
>>                : p_IfExpr
>>                | {flag}?=> p_ExitExpr
>>                | {flag}?=> p_WhileExpr
>>     
Are sure that you want this? what about {flag}?=> (p_ExitExpr | p_WhileExpr)
>>                | p_StepExpr
>>                ;
>>
>> p_IfExpr
>>                : IF
This is the first place that IF can be matched in pExprSingle
>> p_NCName
>>                : L_NCName | IF | EXIT
>>                ;
>>     
And this is the second (as pStepExpr can be p_NCName, which can be IF. 
IF can only be a token for your IF statement or a p_NCName, not both at 
once.

Jim

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to il-antlr-interest@googlegroups.com
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to