[antlr-interest] ambiguity

Cristian Târşoagă cristian.tarsoaga at gmail.com
Sat Jan 28 10:56:11 PST 2012


Hi everybody,

I have a very simple grammar I cannot parse


elem_array: elem*;

elem: (SPACE LETTER_A LETTER_A)? (SPACE LETTER_B LETTER_B)? (SPACE LETTER_C
LETTER_C)? (SPACE LETTER_D LETTER_D)?;



Thing is, all 4 components of an element start with a space, all are
optional, and such elements can be repeated.

1. I tried to use a big lookahead, it does not solve my problem.
Can somebody explain why a k=100 does not solve it?

2. What is the solution to something like this? Predicates? How?


Thanks a lot
Chris


More information about the antlr-interest mailing list