Parser rewritting

Dodji Seketeli dodji@redhat.com
Sun Apr 4 08:50:00 GMT 2010


On Tue, Mar 30, 2010 at 03:12:26PM -0600, Tom Tromey wrote:

[...]

> Chris> There are a couple of antlr C++ parsers available:
> Chris> http://hg.netbeans.org/main/file/tip/cnd.modelimpl/src/org/netbeans/modules/cnd/modelimpl/parser/cppparser.g
> 
> We can't generally reuse code like this due to copyright assignment
> requirements.

Would the copyright assignment requirements prevent us from trying to 
reuse, say, Clang? Maybe one could think about providing a C api on top 
of Clang and consider Clang as an external dependency? If not, then my 
point was to explicitely mention it and make sure we did consider the 
option and ruled it out based on sound reasons.

[...]

> My preferred route is to hand-write a recursive descent parser, 
> mimicing
> the structure of the existing code in g++.
> 
> I think directly sharing code is impractical due to impedance mismatch
> between gdb and g++ internals.  Also our goals are slightly different,
> in that in gdb we only need to parse expressions, we want a single
> parser for C and C++, and finally gdb must implement certain language
> extensions.

I understand that this minimal parser is meant to stay simple, e.g. no
preprocessing support, very minimal error reporting if any at all, no 
semantic analysis etc, but still, if we can't re-use Clang, then would 
it be possible to devise this new "minimal parser" as an independant,
reusable library with its own dejagnu-free testsuite?
Maybe other projects might be interested in using (and extending) 
something like that.

        Dodji



More information about the Archer mailing list