[antlr-interest] Re: C++ grammar

David Wigg wiggjd at sbu.ac.uk
Fri Jun 14 05:39:45 PDT 2002

Hello Ter,

You ask for information from people working on a C++ front end
for ANTLR.

We used your C++ grammar version 1.2, "Restructured for public
consumption by Terence Parr February 1995", with PCCTS to produce
data files for input to a software metric program called REST
(Ripple Effect and Stability Tool) produced here.

The grammar was modified in a few places to accept C programs
(including some redundant K & R code) as well.

We have just spent the last year converting this .g file to use
with ANTLR but producing C++ code (so as to be able to continue
using our embedded C code).

The individual problems encountered in conversion are too
numerous to list here but the worst was probably the lack of
hoisting in ANTLR which we had to find and insert by hand.

I would like to take this opportunity to mention other facilities
we would like to see in ANTLR, namely,

1. A standard way of being able to pass Comments and Compiler
Directives etc. through ANTLR (without having to find a way of
fudging it yourself)

2. A standard way of passing column number with text and/or token

3. A standard feature for storing type names for C++ and Java so
as to be able to identify for example the method
variable.getText() easily (ditto)

4. Comprehensive usable reference documentation (with search

With all respect, I would rather you used your expertise and
knowledge on the above than go back to a C++ grammar file.

Anyway, you can have a look at our C/C++ grammar file if you give
us a month to tidy it up.


David Wigg
Centre for Systems and Software Engineering
South Bank University
London, UK


Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 

More information about the antlr-interest mailing list