antlr3 - antlr 3 ambiguity -


I try to write some simple rules and I get this ambiguity

  rule : Field1 field2; // Opacity between nsf1 and nsf2, even if I use letterhead K = 4 field 1: nsf1 I whatever1 ...; Field 2: NSF 2 | Whatever2 ...; NSF1: 'N'S' F '' 1 '; // Earth: No such field 1 NSF 2: 'N' 'F' 2 '; // meaning: no such field 2  
  1. I understand the ambiguity, but I do not understand why the letterhead does not solve it.

  2. I have a simple solution but I do not like it:

    RULES: (NSF1 (NSF2 | J2)).

Do anyone have more elegant solutions?

Thank you very much, Chris

I do not reproduce your problem Could, but whatever I could, it was estimated that what was the 'Joe 1' and 'Joe 2' rules. Can you post a more complete grammar?

However, there is nothing in grammar that can not be completely done with leaser tokens instead of parser rules. Try changing names of all names to latitude and see if it helps.


Comments