Search Results

Search found 1 results on 1 pages for 'tcris'.

Page 1/1 | 1 

  • antlr 3 ambiguity

    - by tcris
    Hello, I try to write some simple rules and I get this ambiguity rule: field1 field2; //ambiguity between nsf1 and nsf2 even if I use lookahead k=4 field1: nsf1 | whatever1...; field2: nsf2 | whatever2...; nsf1: 'N' 'S' 'F' '1'; //meaning: no such field 1 nsf2: 'N' 'S' 'F' '2'; //meaning: no such field 2 I understand the ambiguity, but I don't understand why lookahead doesn't solve this. I have a simple solution but I don't like it: rule: (nsf1 (nsf2 | whatever2)) | (whatever1 (nsf2 | whatever2)); Does anybody have a more elegant solution? Thanks a lot, Chris

    Read the article

1