C parser

=?gb2312?q?sky=20yan?= <skyanhf@yahoo.com.cn>
5 Aug 2004 14:19:03 -0400

          From comp.compilers

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)
| List of all articles for this month |
From: =?gb2312?q?sky=20yan?= <skyanhf@yahoo.com.cn>
Newsgroups: comp.compilers
Date: 5 Aug 2004 14:19:03 -0400
Organization: Compilers Central
References: 04-07-079
Keywords: C, tools
Posted-Date: 05 Aug 2004 14:19:03 EDT

>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....


I had the same question a mouth ago. I also tried to find a option of


gcc which can generate these informantion. however, I'm failed.


Now I choose lex/yacc to generate a c parser, and in the .l and .y files,


I add some action after matching the syntax, the parser can print a list


of all variable names, their type (int, char...) and scope, you can read


<<lex&yacc>>(2rd edition,O'REILLY) to learn more of lex/yacc.


ANSI C yacc grammar, lex specification can be found in the internet. These


are useful to you.


If you have a better method, please tell me ,thank you!


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.