[antlr-interest] Re: LR problem with SQL92 parsing?
Lubos Vnuk
lubos.vnuk at rts.at
Tue Jun 17 10:44:14 PDT 2003
Hi Enrique,
thanks a lot for your insight and help!
The syntactic predicate you proposed
> id
> : ("_")=> "_" char_set_name REGULAR_ID
> | REGULAR_ID
> ;
won't help as predicating a single token is superfluous since it can
be recognised automatically by ANTLR.
Your second suggestion:
> char_set_name
> : id
> | id "." id
> | id "." id "." id
> ;
with k=4 can even be reduced to:
char_set_name :
id ( "." id "." id
| "." id
|
)
;
with k=3 but that does not solve the problem either.
The problem is the recursion within the <id> rule.
Your third suggestion with the counter solves the problem but it is a
bit painful and it is positively ruining the grammar comprehension
Also, it is not a general solution for the case where these 3 <id>s
could be different, e.g.
id1 : id | "1";
id2 : id | "2";
id3 : id | "3";
Any other hints?
Cheers,
Lubos.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list