"Jamie Andrews" <an*****@csd.uwo.ca> wrote in message
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.
(Since this is cross-posted, for those on comp.lang.c: yes, I've
posted most of these links previously...)
I don't know which if any of these may fulfill your needs, but they may be
worth a look. I also noticed some of the links are bad as I posted, but
they may still help you to track them down.
CIL - C Intermediate Language - C to C transformation
http://manju.cs.berkeley.edu/cil/
WCC - A C Subset Compiler (DECUS ftp links now appear to be dead...sorry)
http://www.decus.org/libcatalog/desc...ml/v00281.html ftp://ftp.encompassus.org/lib/
npath - C Source Complexity Measures
http://www.geonius.com/software/tools/npath.html
Check: A unit test framework for C
http://check.sourceforge.net/
CTool Library (call-graph generator, source transformations)
http://ctool.sourceforge.net/
Cproto automatically generates C function prototypes
http://cproto.sourceforge.net/
JSCPP - a C preprocessor + parser with special modes
http://www.die-schoens.de/prg/
CXREF C language cross referencing program
in volume1 of comp.sources.unix:
http://ftp.sunet.se/pub/usenet/ftp.u....sources.unix/
CSur Le projet Csur (in French)
An analyzer of code C to detect common program execution errors
http://www.lsv.ens-cachan.fr/~goubault/Csur/csur.html
Chico State Mini-C Compiler (CSMCC) is a student training load-and-go
compiler (incomplete, teaching tool)
http://www.ecst.csuchico.edu/~sameerg/compproj.html http://www.ecst.csuchico.edu/~hilzer/csci250/proj/
Edward Willink's C++ grammars:
http://www.computing.surrey.ac.uk/research/dsrg/fog/
(some of the links have an extra text '/v' in them, just delete)
ISO C/C++ grammars version 1.2 (c-c++-grammars-1.2.tar.gz)
http://www.sigala.it/sandro/download.php
A C99 Parser, a recursive decent parser
http://www.mazumdar.demon.co.uk/c_parser.html
Ctags generates an index (or tag) file of language objects
http://ctags.sourceforge.net/
Cdecl English<->C translator for C declarations
cdecl in volume6 of comp.sources.unix:
cdecl2 in volume14 of comp.sources.unix:
http://ftp.sunet.se/pub/usenet/ftp.u....sources.unix/
Rod Pemberton