language independent C++ grammar [was Re: [antlr-interest] Updated C++ parser version 3.1 published November 2005]

Luis Sergio Oliveira euluis at zmail.pt
Tue Nov 22 17:42:44 PST 2005


Hello David and ANTLR fellows,

first of all thanks for your grammar, it provides a fundamental basis 
for my work in the
ArgoUML C++ module.

I was waiting for your update to propose a joint effort to further 
develop the grammar.
Currently I'm using a version of your grammar which was ported to Java 
by Yolanda Jargudo
and enriched by callbacks as needed by ArgoUML reverse engineering of 
C++ code.

Now, the callbacks are poluting the grammar code and I will work in 
replacing them by
AST statements that besides being more according to ANTLR spirit, are 
also language
independent and therefore provide better reuse opportunities. I'll also 
diff the your updated
grammar against 3.0 to get the improvements and corrections into the 
ported version.

But, all this would be much more desirable if we could have the whole 
grammar base defined
in a language independent way. So, is this feasible - to have a grammar 
which is usable
by C++, Java, Python and other languages without having to hand port it 
from the C++ version
every time David provides a new update?

I notice that the examples with ANTLR are made available in several 
languages. Is there some
particular magic that enables this automatically or is it out of manual 
porting efforts?

-- 
Luis Sergio Oliveira


David Wigg wrote:

> Hello C++ parsers,
>
> I have uploaded our updated C++ parser, CPP_parser.g Version 3.1
> November 2005, to the list of grammars on the antlr website at
> http://www.antlr.org/grammar/list to replace Version 3.0 July 2004.
>
> It still uses ANTLR 2.7.3 but it should work with all later
> versions of ANTLR 2.7.? . I may be able to produce a version
> which uses ANTLR 3.?  next year.
>
> Please note that this latest version still assumes input of
> preprocessed C/C++ programs and produces lexers and parsers
> written in C++.
>
> This version has been improved by the cooperation of users who
> have submitted problem code which the previous version, V.3.0
> July 2004, could not parse.
>
> I realise that introducing an updated version of a parser
> entails extra work but I hope that by using my method of
> subclassing your application code that this work will be reduced
> to a minimum. See MyReadMe3.1.txt for further information.
>
> This version includes additional features to assist debugging as
> follows,
>
> *   Statement trace feature which as supplied is ON for
> demonstration purposes. It can be turned ON/OFF in CPP_parser.g or 
> CPPParser.cpp.
>
> *   ANTLR trace feature which requires replacing LLkParser.cpp
> and LLkParser.hpp with slightly modified version supplied. It can be 
> turned ON/OFF in CPP_parser.g or CPPParser.cpp.
>
> *   A slightly modified version of Parser.cpp which produces
> error messages to cout as well as cerr.
>
> Please see MyReadMe3.1.txt for further information.
>
> You can use the preprocessed program Quadratic.i in
> ...\CPP_parserV3.1\TestIfiles to verify correct installation.
>
> I welcome queries and questions from users.
>
> David Wigg
> Research Fellow
> Centre for Systems and Software Engineering
> London South Bank University
> London, UK
> wiggjd at bcs.org.uk
> blackse at lsbu.ac.uk
>
>



More information about the antlr-interest mailing list