Related articles |
---|
ANNOUNCE: CCR - C Cross-Reference generator dimka@tochna.technion.ac.il (Dimitry Kloper) (1997-08-30) |
From: | Dimitry Kloper <dimka@tochna.technion.ac.il> |
Newsgroups: | comp.compilers |
Date: | 30 Aug 1997 00:48:14 -0400 |
Organization: | Compilers Central |
Keywords: | tools, available |
This is very early version. I started CCR as a good compiler design exercise,
so code is not in very good shape at this moment.
I am announcing this release in comp.compilers only, hoping to receive
comments from experienced compiler designers.
CCR - A C Cross-Reference generator
----------------------------------------------------------------------------
Copyrights
Distributed under GNU Public License . See file COPYING for more info.
* Copyright (C) 1997. Dimitry B. Kloper < dimka@tochna.technion.ac.il >.
* For file cgrammar.y
Portions Copyright (c) 1989, 1990. James A. Roskind.
* For file clexer.l
Portions Copyright (c) 1994, 1995, 1996. Shaun Flisakowski.
Availability
The latest version of this document can be found in
http://tochna.technion.ac.il/~dimka/ccr.html.
The latest version of CCR can be found in
http://tochna.technion.ac.il/~dimka/ccr.
This is first public release, please fill free to contact me if you have bug
reports, questions, comments or suggestions.
NOTE: I am forced to remove this site soon. I would appreciate if
somebody give me space for building CCR web page.
Description
CCR pretends to be a "complete" cross-reference generator for C. Unlike of
other similar tools (see *Related Stuff* section), it manages eventually
every identifier in C code which is not an reserved word or macro name.
CCR can accept any ANSI C program as an input. It does not manage "#include"
statements of the preprocessor (I am planing to merge CCR with GNU cpp, but
not in this release), so usually CCR will receive output of cpp as an input.
Currently, output of CCR produces human-readable output. Each identifier in
the source program, which is not an reserved word or macro name explained in
following format:
<file>:<line>:<column>: identifier <id>
<identifier description> <identifier scope>
[reference to definition in form <file>:<line>:<column>]
<identifiers type>
For example for program:
int main() {
int i;
i = 3;
}
the following output will be produced:
_stdin_:1:8: identifier `main'
function definition on global scope
type: `int ()'
_stdin_:2:5: identifier `i'
variable definition in function `main'
type: `int'
_stdin_:3:1: identifier `i'
variable used in function `main'
defined at _stdin_:2:5
type: `int'
CCR will manage both local and global variables, carefully recognizing their
scope and producing an appropriate cross-references. It will recognize type
definitions, function prototypes and definitions, structure/union/enum
definition. In most cases it will recognize and produce references for
structure/union fields used in expressions.
Error recovery
I should note that CCR is not a complete C compiler. It intended to be
something invoked on a C program which successfully passed a compilation
stage. CCR has a very primitive and incomplete syntax and type checking,
producing warning messages when possible. CCR exits with error message on
first parse error encountered. On incorrect input CCR will produce incorrect
and/or incomplete output.
Basic components
CCR has been built on yaccable C grammar published in 1990 by Jim Roskind
(see *Related Stuff* section for more info).
The lexer for the grammar was taken from ctree package by Shaun Flisakowski
(see *Related Stuff* section for more info).
Requirements
CCR requires GNU Bison 1.25 or later, GNU Flex 2.5.4 or later. It was only
tested on Linux 1.2.13 with gcc 2.7.2, libc 5.2.18.
Known Bugs
See file ToDo for list of known bugs.
Future work
I am thinking about the following features to be included in the near
future:
* merge CCR with GNU cpp. This will give possibility to manage all
preprocessor directives and produce cross-reference information for
macros.
* output in a human-readable form and as a database.
Related stuff
Look at FAQ from comp.lang.c for references to various C grammars.
http://www.gedanken.demon.co.uk/cxref/index.html
The cxref home page. It is similar to CCR, but as far as I understand
handles global definitions only.
http://www.cs.wisc.edu/~flisakow/
Here you can find a pointer to the latest ctree version by Shaun
Flisakowski. Ctree creates a full parse tree for any ANSI C program.
http://www.empathy.com/pccts/roskind.html
This is one from a huge number of references to Roskind's grammar.
cppp
OO C++ parser designed in Brown University by Tony Davis. It is called
cppp and reference to it can be found via
http://www.idiom.com/free-compilers/LANG/C++-1.html It builds a full
parse tree for C++ program using object oriented techniques.
http://www.cygnus.com/s-n_ad.html
Cygnus' Source-Navigator home page. The best thing for project studying
I ever seen. It comes without source, and I far as I am understanding,
it does not manages local variable/parameter declarations. Structure of
project database is not exposed.
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.