Not an expert here but I'll hazard a guess. It seems to me that a statement like: COMPUTE a EQUAL b can be either an imperative_compute_statement or a conditional compute statement.
What if you take the ? off the conditional's ON clause? Is it really a conditional if that's not there? Joe Thomas Woelfle wrote: > Hi, > > I have a problem with following grammar: > > imperative_statement > : imperative_compute_statement > ; > > imperative_statement_list > : imperative_statement+ > ; > > imperative_compute_statement > : COMPUTE^ Identifier+ EQUAL Identifier END_COMPUTE? > ; > > conditional_compute_statement > : COMPUTE^ Identifier+ EQUAL Identifier > (ON? SIZE ERROR imperative_statement_list)? > END_COMPUTE? > ; > > COMPUTE: 'COMPUTE'; > NOT : 'NOT'; > ON : 'ON'; > SIZE : 'SIZE'; > EQUAL : 'EQUAL'; > ERROR : 'ERROR'; > END_COMPUTE : 'END-COMPUTE'; > > Identifier : > Letter (Letter | Digit)*; > > fragment > Letter : > 'a'..'z' | > 'A'..'Z'; > > fragment > Digit : > '0'..'9'; > > ANTLR tells me that the rule 'imperative_compute_statement' has more > than one alternative to match the optional 'END_COMPUTE'. Can anybody > give me a hint on how to rewrite this grammar so that the warning no > longer appears? > > Any help appreciated. > > Regards, > Thomas > > 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 [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
