Re: C++ Grammar

iank@idiom.com (Ian L. Kaplan)
17 Aug 2001 00:08:17 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: C++ Grammar dosreis@cmla.ens-cachan.fr (Gabriel Dos Reis) (2001-08-08)
Re: C++ Grammar mike@dimmick.demon.co.uk (Mike Dimmick) (2001-08-08)
Re: C++ Grammar aarongray@beeb.net (Aaron Gray) (2001-08-15)
Re: C++ Grammar dosreis@cmla.ens-cachan.fr (Gabriel Dos Reis) (2001-08-15)
Re: C++ Grammar aarongray@beeb.net (Aaron Gray) (2001-08-15)
Re: C++ Grammar dosreis@cmla.ens-cachan.fr (Gabriel Dos Reis) (2001-08-16)
Re: C++ Grammar iank@idiom.com (2001-08-17)
Re: C++ Grammar jerry@swsl.co.uk (Jerry Evans) (2001-08-17)
Re: C++ Grammar cfc@world.std.com (Chris F Clark) (2001-08-17)
Re: C++ Grammar idbaxter@semdesigns.com (Ira D. Baxter) (2001-08-18)
Re: C++ Grammar clinton_olsen@yahoo.com (2001-08-18)
Re: C++ Grammar aarongray@beeb.net (Aaron Gray) (2001-08-20)
Re: ANTLR, was C++ Grammar mike@dimmick.demon.co.uk (Mike Dimmick) (2001-08-24)
[1 later articles]
| List of all articles for this month |
From: iank@idiom.com (Ian L. Kaplan)
Newsgroups: comp.compilers
Date: 17 Aug 2001 00:08:17 -0400
Organization: Unknown
References: 01-08-037 01-08-046 01-08-055 01-08-058
Keywords: C++, parse
Posted-Date: 17 Aug 2001 00:08:17 EDT

Aaron Gray <aarongray@beeb.net> wrote:
>Dear All,
> LR(2+) by the looks of it then.
> I have been looking at algorithms for generating an [LA]LR(k) parser
>generator, and think that I might be able to implement one soon, the area
>came into my head in a flash of realization, it is very simple, add an NFA
>at the front end of the PDA, so you have the ability to "delay" deteminacy
>until it is determinate, so to speak.


    A word (or two) of caution. "k" look ahead does not solve as many
    problems as one might thing.


    ANTLR is an LR(k) parser generator. You can select the "k". After
    having spent many years struggling with grammar development I at
    first thought "oh, this is great, it will be easier to develop
    grammars because I have more look ahead". But this turns out to be
    wrong. The more look ahead you have, the more potential for
    conflict there is. ANTLR turns on look ahead selectively. For
    example, in the famous dangling "else" case, it uses more look ahead
    in that case to resolve the syntax. Extended local look ahead can
    also be used to resolve various C++ horrors like the "<" (e.g., is
    it a less than or a template). But turning on "k" look ahead all
    the time is not very helpful.


    Ian Kaplan
    www.bearcave.com


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.