|Parsing C typedefs using yacc firstname.lastname@example.org (Andrew Dunbar) (1995-12-09)|
|Re: Parsing C typedefs using yacc email@example.com (1995-12-10)|
|Re: Parsing C typedefs using yacc firstname.lastname@example.org (1995-12-17)|
|Re: Parsing typedefs with C (2) email@example.com (1995-12-18)|
|From:||firstname.lastname@example.org (Paco Moreno Seco)|
|Date:||17 Dec 1995 00:25:11 -0500|
Andrew Dunbar <email@example.com> writes:
>I'm trying to parse C using yacc but I've hit a problem with
>typedefs. [Is there an approximate way to parse typedefs without
>expanding all the include files?]
>I'm only trying to make some tools to manipulate indenting, alter
>the names of global variables and such. It does not have to be
I'm afraid you'll have to process include files (I can't imagine
another solution). If you are interested on a C grammar for yacc and
lex, you can download it from my ftp-site:
In that directory you can find a C grammar for yacc and lex which
does not solve the "typedef problem" (I ftped it from
primost.cs.wisc.edu , file c-grammar.gz, and its author is Jeff Lee
jeff@gatech). The files are scan.l.bak and gram.y.bak .
I made some changes to these files to fix the "typedef problem"
(didn,t fix the "include problem", sorry) and I added some extra
actions to build a linked (linked) list of all tokens and lexemes of
the source program. These actions could be used to write something
like a pretty printer (or to build an indenting tool). There is no
documentation and no comments (except a few ones in spanish), but I
think you would have no problem understanding it (if so, please email
me and I will help you).
Hope this helps!
Paco Moreno Seco
Return to the
Search the comp.compilers archives again.