[antlr-interest] Re: C++ parser usage ideas

Jim Crafton jim.crafton at gmail.com
Wed Oct 19 06:24:40 PDT 2005


David,


> Thanks for your kind words about the C++ parser. I would very
> much like to see the amendments you have found necessary.
>


The simplest case is this:

#define FOO_API __declspec( __dllimport)

class FOO_API Foo {

};

This will cause the compiler to bail, as it doesn't know how to handle
the "FOO_API" identifier/symbol.

If the "FOO_API" is resolved to __declspec( __dllimport), it also
chokes. I have added support in the grammar to handle either
__declspec( __dllimport), or __declspec( __dllexport).


> Unfortunately there is no ultimate set of test data for a C++
> parser (and may not be for any parser!) and I have just had to
> do my best from the language syntax specification shown in my
> documentation and Bjarne Stroustrup's book (third edition).

You know, prior to starting something like this, I never truly
understood why so many people railed about C++ syntax. I do understand
now. C++ has got to be the worst for this kind of thing.

> FYI I now have an updated version of the parser which I hope
> will be clearer and more correct which I am hoping to publish in
> November.

Oooh! Sounds great, I'll be looking forward to that.

Cheers,

Jim


More information about the antlr-interest mailing list