This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Hand-written rec-descent parser of GCC-4.1 is WRONG!!!


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]