This is the mail archive of the
archer@sourceware.org
mailing list for the Archer project.
Re: Parser rewritting
- From: Tom Tromey <tromey at redhat dot com>
- To: Chris Moller <cmoller at redhat dot com>
- Cc: Sergio Durigan Junior <sergiodj at redhat dot com>, Project Archer <archer at sourceware dot org>
- Date: Tue, 30 Mar 2010 15:12:26 -0600
- Subject: Re: Parser rewritting
- References: <201003301546.34866.sergiodj@redhat.com><4BB24B69.3000300@redhat.com>
- Reply-to: Tom Tromey <tromey at redhat dot com>
>>>>> "Chris" == Chris Moller <cmoller@redhat.com> writes:
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.
Chris> And I'm just about certain it would be easier to use them than to
Chris> write a whole new parser--antlr is a lot less weird than bison.
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.
Using a parser generator may be ok, but I think there are benefits to
following an existing parser. Also, parsers like the one in g++ are
simpler to debug. (Of course, maybe that is a problem we should solve
as well :-)
Tom