🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.c
Article #9689

Null source transformer for C

#9689
From: James R. Van Zandt
Date: Fri, 31 Oct 1986 17:16
26 lines
1604 bytes
Several times I've wanted to make a change to some C source code that
would be minor, but requires parsing it.  Some examples are:

       Remove all the comments.

       Add a diagnostic printout at the beginning of each function.

       Compile a list of variables and the functions they're defined in.

       For all variables declared to be a particular type (say, COMPLEX), 
       replace the operators + - * / with equivalent function calls.

Any of these would leave most of the source code unchanged.  It seems
to me that the easiest way to implement one would be to start with LEX
and YACC code for a source to source transformer that would make no
changes.  That is, action routines that would only build a parse tree,
then tree walking routines that would (approximately) reproduce the
original source code.  Does anyone know a public domain source for

     (1) LEX/YACC code for such a null transformer,
     (2) any LEX/YACC code for parsing C, or
     (3) LEX code for C?

Please mail directly to me, as I don't subscribe to all of these groups.

                    - Jim Van Zandt
Technical Details
Message-ID: <5058@brl-smoke.ARPA>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!rutgers!brl-adm!brl-smoke!smoke!jrv@MITRE-BEDFORD.ARPA

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!think!rutgers!brl-adm!brl-smoke!smoke!jrv@MITRE-BEDFORD.ARPA
From: jrv@MITRE-BEDFORD.ARPA (James R. Van Zandt)
Newsgroups: net.lang.c
Subject: Null source transformer for C
Message-ID: <5058@brl-smoke.ARPA>
Date: Fri, 31-Oct-86 12:16:34 EST
Article-I.D.: brl-smok.5058
Posted: Fri Oct 31 12:16:34 1986
Date-Received: Sun, 2-Nov-86 23:55:59 EST
Sender: news@brl-smoke.ARPA
Lines: 26