🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.sources.d
Article #1739

Re: [unix-wizards] Re: Linking two yacc (y.tab.o) files

#1739
From: Robert Steven Glickstein
Date: Sat, 10 Mar 1990 16:25
43 lines
2107 bytes
Excerpts from netnews.alt.sources: 9-Mar-90 [unix-wizards] Re: Linking
.. Gregory N. Bond@bby.oz.a (2435)

> Here is a script I use for making yacc output files static, so you can
> link n of them in one binary.  I use it on the output of getdate.y to
> make a general gate-parsing library.  Tried only on SunOs 3.5 and 4.0.3.
> (It assumes the .y file contains a global routine that calls the
> yyparse routine).

> Usage: sed -f yaccstaticize.sed < y.tab.c > file.c

> [...]

> echo shar: Extracting \"'yaccstaticize.sed'\" \(93 characters\)
> sed "s/^X//" >'yaccstaticize.sed' <<'END_OF_FILE'
> Xs/^short yy/static &/
> Xs/^int[ 	]*yy/static &/
> Xs/^YY[LS]TYPE/static &/
> Xs/^yyparse()/static &/

Unfortunately, this is a highly non-portable approach whose success
depends on zillions of factors, such as whether your C compiler allows
static objects not to be forward-declared, and what the exact form of
your /usr/lib/yaccpar is.  I discovered the inadequacy of this approach
when I needed a tool to do the very same thing.

I have written a considerably more robust version of this, called
"yyhide".  Yyhide will not only make everything static, but it will
topographically sort the definitions of functions and variables within
the yacc output.

Yyhide is part of the Andrew distribution, which in turn is available in
the X11r4 distribution (under contrib/toolkits/andrew [yyhide itself
lives in contrib/toolkits/andrew/overhead/parsec]).

Please contact me if you have any questions.

______________
Bob Glickstein                | Internet: bobg@andrew.cmu.edu
Information Technology Center | Bitnet:   bobg%andrew@cmuccvma.bitnet
Carnegie Mellon University    | UUCP:     ...!harvard!andrew.cmu.edu!bobg
Pittsburgh, PA  15213-3890    |
(412) 268-6743                | Sinners can repent, but stupid is forever
Technical Details
Message-ID: <cZyGeGm00Vsn0_xlly@andrew.cmu.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
From: bobg+@andrew.cmu.edu (Robert Steven Glickstein)
Newsgroups: alt.sources.d,alt.sources
Subject: Re: [unix-wizards] Re: Linking two yacc (y.tab.o) files
Message-ID: <cZyGeGm00Vsn0_xlly@andrew.cmu.edu>
Date: 10 Mar 90 16:25:54 GMT