[comp.sys.mac.programmer] byacc problems under MPW

gb2a+@andrew.cmu.edu (George J. Baxter) (08/04/90)

We recently pulled a lex/yacc package off of wuarchive.wugate.edu.  The
yacc part was byacc (Berkeley yacc).  Included was a MakeFile for MPW C.
Unfortunately, the MakeFile was for an old version of MPW (2.0.2), so
the commands that it produces don't quite work under our system (3.0). 
But
after much tweaking and editing, we finally got everything to compile
and mostly link.  The problem now is that the Code Segment produced
is too big (33286, where the limit is 32760).  Does anyone know how
to get around this? (We generally use Think-C, and our MPW expert
is on vacation.)

Alternatively, does anyone know of any other good PD lex/yacc packages for
the Mac?

Any information will be appreciated.

Thanks,
Chris
(no, I'm not George but any replies to George will get to me ok)

earleh@microsoft.UUCP (Earle HORTON) (08/06/90)

In article <kaiQsf600UhBA1k0YJ@andrew.cmu.edu> gb2a+@andrew.cmu.edu
	(George J. Baxter) writes:

>after much tweaking and editing, we finally got everything to compile
>and mostly link.  The problem now is that the Code Segment produced
>is too big (33286, where the limit is 32760).  Does anyone know how
>to get around this? (We generally use Think-C, and our MPW expert
>is on vacation.)

     You want to split the program up into a number of different segments.
The quickest way to do this is by using the "-s" option of the MPW C
compiler.  Put something like this in your MPW Makefile default rules
section:

.c.o	<option-F>	.c
	c {default}.c -o {default}.c.o -s {default}

     This will cause the C compiler to put directives in each ".c.o" file
telling the linker to place generated code in a segment named after the
file.  Code produced from "foo.c" will then wind up in segment "foo."  If
you already have make rules for individual source files, then add a "-s"
option to the compiler line for each.

     This method will most probably not produce the optimum segmentation
for your program.  It is the quickest way to segment a large C program that
you are porting from another environment, however.  It also doesn't require
you to change the C source code.

These opinions are not necessarily shared by my employer.
Earle Horton
 

gtall@iuvax.cs.indiana.edu (Gerard Allwein) (08/13/90)

Ah, that accursed byacc ought to be dragged around the universe by
alien Mr. Potatoe Heads. The yacc you want is on apple.apple.com
in the /pub/dts/mac/hacks directory. Look for something with Bison
in the name. This is Gnu's version of yacc. Flex is binhexed with
it and is Gnu's version of lex. These are both MPW tools. You must
remake the tool so it will get your directory structure straight.
You must also drop their simple and hairy parser templates into
your CLibraries folder. Put an alias for the command bison in 
your startup just like you would for byacc (sic). The command
line to invoke it will look like

bison -o <output file> -y <input file>

For some odd reason, I found I need to put the output file spec
before the input file. And wherever you got that sickly excuse for
yacc called byacc, tell them to kill it and replace it with this
wonderous version.

Gerry