This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Hand-written rec-descent parser of GCC-4.1 is WRONG!!!
- From: Joe Buck <Joe dot Buck at synopsys dot COM>
- To: jc-nospam at jr-pizarro dot jazztel dot es
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 15 Mar 2005 19:15:47 -0800
- Subject: Re: Hand-written rec-descent parser of GCC-4.1 is WRONG!!!
- References: <1110939746.423798624e1e5@webmail.jazznet.es>
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.