Hand-written rec-descent parser of GCC-4.1 is WRONG!!!
Joe Buck
Joe.Buck@synopsys.COM
Wed Mar 16 04:44:00 GMT 2005
On Wed, Mar 16, 2005 at 03:22:26AM +0100, jc-nospam@jr-pizarro.jazztel.es wrote:
> Do you demonstrate that "C++ is not LALR(1)"?
I'll leave that to you as a homework assignment. Actually, C++ is not
LALR(N) for any N. Get out the C++ grammar and figure it out, it's an
easy proof. Come back when you have proved it to your own satisfaction,
and please refrain from giving advice in the meantime.
> | Bison remains a good solution in many cases, especially for languages
> | specifically designed to be easy to parse with an LALR parser (that is,
> | languages that don't look like C).
>
> Why don't we develop a "LR(k) / k small" functions-written parser for this
> complex grammar?
Because C++ is not LR(k) for any k. It really does require unbounded
lookahead.
More information about the Gcc
mailing list