[comp.unix.questions] Porting output of Yacc and Lax to the IBbuM

rob@aoa.UUCP (Rob Everton) (10/07/87)

Seeking comments on the process of developing a small language
compiler system for the ibm pc family using Yacc and Lax
from a different machine, probably 3b1 unix pc's or something.

Has anyone tried this? 

Does anyone have any comments for or against the two utilities
or the possibility of problems porting to a pc format processor?

Thanks in advance.

.



-- 

	Rob Everton
	...!{harvard,ima}!bbn!aoa!rob
	...!{wjh12,mit-vax}!biomed!aoa!rob

windley@iris.ucdavis.edu (Phil Windley) (10/08/87)

In article <468@aoa.UUCP> rob@aoa.UUCP (Rob Everton) writes:
>Seeking comments on the process of developing a small language
>compiler system for the ibm pc family using Yacc and Lax
>from a different machine, probably 3b1 unix pc's or something.
>
>Has anyone tried this? 
>
I recently *tried* (the operative word) to port an object-oriented
language developed here at UCD to an IBM.  I didn't have problems with
YACC and LEX, just things like memory models, etc.  Here's what I
learned about YACC and LEX from it:

   a) If you have access to another machine you can run your .y and .l
   filesd trough YACC and LEX respectively, giving you .c programs.
   Those will compile using Microsoft C 4.0 just fine (I used ULTRIX
   2.0 YACC and LEX, but I think that YACC and LEX are pretty
   standard, I could be wrong.)

   b) the parser will run fine.  The lexer will need to be linked with
   the lex library.  The lex library has four or five quite short
   routines like yyless().  I will leave it up to you to decide how
   you get the source and make a simlar library for your PC.

   c) Given the above two things, you don't need YACC and LEX for the
   PC if you have them available elsewhere.  The parser we wrote (which
   is not as large as an ADA parser, but still not insignificant,
   works great.  Since we were not careful with pointers/integers (and
   on a 32 bit machine, you don't really have to be) the rest runs
   fine on 68000's, VAX's, etc and crashes a 16 bit machine like the
   80286.  


Phil Windley
Robotics Research Lab
University of California, Davis
Phil Windley
Robotics Research Lab
University of California, Davis

dws@cseg.UUCP (David W. Summers) (10/08/87)

In article <468@aoa.UUCP>, rob@aoa.UUCP (Rob Everton) writes:
> Seeking comments on the process of developing a small language
> compiler system for the ibm pc family using Yacc and Lax
> from a different machine, probably 3b1 unix pc's or something.
> Has anyone tried this? 
> Does anyone have any comments for or against the two utilities
> or the possibility of problems porting to a pc format processor?
> 	Rob Everton
> 	...!{harvard,ima}!bbn!aoa!rob
> 	...!{wjh12,mit-vax}!biomed!aoa!rob

I've written assemblers with Xenix Yacc and Lex and then compiled them with
MicroSoft C.  Works Great!  Is this what you were asking about?  The only
trouble I've had is when I try to port GREAT BIG Lex or Yacc specifications.
Then the C compiler runs out of table space/data space sometimes.  Other than
that I've had no problem porting stuff from these machines to the IBM PC:
   1) IBM MainFrame (Amdahl/UTS Sys V)
   2) AT&T 3B2/400 (Unix Sys V/2.0.4(?))
   3) Tandy 3000 HD (Xenix Sys V/286)

   Hope this helps!
                         - David Summers
                           ..!rutgers!pbox!romed!actsn!david
                           ..!rutgers!pbox!romed!actsn!cseg!dws

farren@gethen.UUCP (Michael J. Farren) (10/09/87)

In article <340@ucdavis.ucdavis.edu> windley@iris.ucdavis.edu (Phil Windley) writes:
>   Since we were not careful with pointers/integers (and
>   on a 32 bit machine, you don't really have to be) the rest runs
>   fine on 68000's, VAX's, etc and crashes a 16 bit machine like the
>   80286.  

Which just illustrates a point:  you DO have to be careful with pointers
and integers, dammit!  You may not KNOW that your code will only ever run
on 32-bit machines.  Give everybody a break, especially those who will
come after you and try and maintain and port your code, and DON'T TREAT
POINTERS AND INTEGERS AS EQUIVALENT! (Emphatic enough?)

As far as the original statement goes, I've had much success creating
parsers with lex and moving the generated lex.yy.c code over to the
PC, and recompiling with MSC.  The functions of the lex library routines
are described pretty adequately in the man page for lex, and aren't
particularly hard to implement independently.


-- 
----------------
Michael J. Farren      "... if the church put in half the time on covetousness
unisoft!gethen!farren   that it does on lust, this would be a better world ..."
gethen!farren@lll-winken.arpa             Garrison Keillor, "Lake Wobegon Days"

dave@westmark.UUCP (Dave Levenson) (10/12/87)

In article <468@aoa.UUCP>, rob@aoa.UUCP (Rob Everton) writes:
> Seeking comments on the process of developing a small language
> compiler system for the ibm pc family using Yacc and Lax
> from a different machine, probably 3b1 unix pc's or something.
> 
> Has anyone tried this? 

Yes, I have ported the cdecl utility (it translates between c
declaration syntax and English) to MS-DOS from UNIX by doing exactly
what you are asking about!  I ran the lex and yacc portions of the
make procedure under UNIX, and then compiled the resulting C code,
along with the rest of cdecl, using the Microsoft C (rel 4.0) under
MS-DOS 3.2.  The result is that the utility runs under MS-DOS as it
does under UNIX.  I'm now hacking up the lex and yacc sources to
understand the far and near extensions, so that it will be more
useful to MS-C developers.

The development system here is ideal for the task: an AT&T
PC6300PLUS running Simul-Task.  It allows me to run MS-DOS
applications from within UNIX programs.  What I use to make
cdecl.exe is a single UNIX Makefile that runs lex and yacc as usual,
and then runs cl as a dos command!  The same makefile can be used to
make cdecl (the unix executable) and cdecl.exe.  It invokes cc to
make the unix flavor, and cl to make the dos flavor.

-- 
Dave Levenson
Westmark, Inc.		A node for news.
Warren, NJ USA
{rutgers | clyde | mtune | ihnp4}!westmark!dave