|C parser yielding syntax tree data structure? firstname.lastname@example.org ((Jamie Andrews)) (2006-04-08)|
|Re: C parser yielding syntax tree data structure? email@example.com (Rod Pemberton) (2006-04-09)|
|Re: C parser yielding syntax tree data structure? firstname.lastname@example.org (tmp123) (2006-04-09)|
|Re: C parser yielding syntax tree data structure? email@example.com (Arndt Muehlenfeld) (2006-04-12)|
|Re: C parser yielding syntax tree data structure? firstname.lastname@example.org (Ira Baxter) (2006-04-12)|
|Re: C parser yielding syntax tree data structure? email@example.com (Paul E. Black) (2006-04-14)|
|Re: C parser yielding syntax tree data structure? firstname.lastname@example.org (Rod Pemberton) (2006-04-16)|
|Re: C parser yielding syntax tree data structure? email@example.com (2006-04-21)|
|Date:||21 Apr 2006 23:45:36 -0400|
|Posted-Date:||21 Apr 2006 23:45:36 EDT|
(Jamie Andrews) wrote:
> For a research project, we're looking for a reliable parser for C
> that will take an ANSI C program and yield a tree representation of
> the program (as a Java or C++ object). Of course a grammar e.g. in
> jflex/jbison that will yield the same thing is fine too. We have been
> able to find some grammars and parsers, of unknown reliability, that
> don't yield a syntax tree; we want to avoid starting with a flaky
> parser and/or adding the syntax tree code.
> Preferably the tokens in the tree will contain information
> on the line number and character number of the token, but if it
> is sufficiently easy to add that code, then we can do that too.
> Thanks for any info you can give.
Linus Torvalds of Linux fame once wrote one of these called "sparse".
I think the latest version is in
http://www.kernel.org/pub/scm/devel/sparse/ you need to use the "git"
version control system to download it unfortunately.
It doesn't give C++ or Java objects as an output. But, as you'll find
there is not much gained by treating a whole tree as an object, the
important thing is that it has a single root.
I have no idea how good this parser is, you'll have to find that out
for yourself. It's hard to tell how good any C parser is that doesn't
get heavy use, and hard enough to tell if a parser does get heavy use.
Return to the
Search the comp.compilers archives again.