Related articles |
---|
C parser sid@claudius.ics.uci.edu (Siddharth Choudhuri) (2004-07-28) |
Re: C parser rajaram@acmet.com (Rajaram) (2004-08-04) |
Re: C parser jacob@jacob.remcomp.fr (jacob navia) (2004-08-04) |
Re: C parser danwang74@gmail.com (Daniel C. Wang) (2004-08-04) |
Re: C parser tmk@netvision.net.il (2004-08-05) |
C parser skyanhf@yahoo.com.cn (=?gb2312?q?sky=20yan?=) (2004-08-05) |
Re: C parser codeworker@free.fr (2004-08-10) |
Re: C parser sid@igor.ics.uci.edu (Siddharth Choudhuri) (2004-08-11) |
C parser temple@deakin.edu.au (DAVID) (1997-07-16) |
Re: C parser drh@microsoft.com (Dave Hanson) (1997-07-18) |
Re: C parser cort@shay.ecn.purdue.edu (1997-07-22) |
From: | tmk@netvision.net.il (Michael Tiomkin) |
Newsgroups: | comp.compilers |
Date: | 5 Aug 2004 14:12:12 -0400 |
Organization: | http://groups.google.com |
References: | 04-07-079 |
Keywords: | parse, C |
Posted-Date: | 05 Aug 2004 14:12:12 EDT |
Siddharth Choudhuri <sid@claudius.ics.uci.edu> wrote in message news:04-07-079...
> I am looking for a C parser that can generate a list of all variable
> names, their type (int, char...) and scope (auto, static, ...) by reading
> a C source file.
You'd like to run this parser with the same -D definitions as your
original compiler. I would prefer to use the same compiler with the
same options because some of these options can introduce additional
#define's and change your source.
Instead of reading the source file you can read the object file (.o
or .obj) after compilation. For example, 'nm file.o' will give you
some info about external variables, but not about the automatic vars.
For better info you'd like to compile your source with symbol table
and/or debug info, and read this info from the object file. Notice
that some of the variables would have a complex type, e.g. structures,
unions and functions. You would have to find a way to deal with
definitions of these complex types together with definitions of the
variables.
Return to the
comp.compilers page.
Search the
comp.compilers archives again.