[comp.lang.forth] Ertl's "Gray" parser generator for Forth, version 2...

dwp@willett.pgh.pa.us (Doug Philips) (02/21/91)

Martin Ertl has emailed me a copy of version 2 of Gray.  Gray is a
parser generator writting in Forth that generates Forth code.  

Included below are the following files from his release:
	CHANGES
	README
	The License part of Gray.Doc

Gray comes as a 67K SHAR archive file.  If, after having read this post,
you decide you want me to email you a copy of this file, send mail to
dwp@willett.pgh.pa.us.  In the BODY of your message include:
	send gray20.4th
	path your-email-path-relative-to-Internet-or-Well_known_Usenet_site

For those on GEnie, I'll be uploading this file sometime this weekend.

-Doug

CHANGES:

Differences between Release 1 and Release 2

Gray now runs on computers with memory alignment restrictions, too.
Tile Release 2 is now supported, it needs porting to run on Tile
Release 1.
Changed "(compile)" into "compile," (ANSI).
No bugs were reported. Therefore they are still there.

README:

$Id: README,v 1.2 90/04/19 17:48:14 ertl Exp Locker: anton $

This is Realease 2 of Gray, a parser generator written in Forth. It
takes grammars in an extended BNF syntax and generates recursive
descent parsers as executable Forth code. It has no special support
for error recovery.



FILES

README		You are reading it
CHANGES		describes differences to earlier releases
gray.f83	parser generator source file
gray.doc	parser generator manual
else.f83	a very tiny example grammar
oberon.f83	a medium-sized example grammar
calc.f83	an example interpreter
mini.f83	an example compiler
test.mini	a program for mini (computes the square)
graylist.f83	example extension for gray
test.f83	runs the examples
test.out	output of test.f83 on TILE


PORTING

The current version runs on TILE Release 2, a Forth 83 written in C by
Mikael Patel (mip@ida.liu.se) and posted on alt.sources in July 1990.
It should be easy to port to other Forths:

Remove the "#include" lines in the beginning.
Change the definition of ":," to suit your forth.
Change "bits/cell" and the subsequent cell words.
Adjust "alignment" (not strictly necessary).
If your Forth is not direct or indirect threaded, change "compile,".

Now you should be able to run test programs, but to make Gray usable
for development you need to add code for displaying the error location
in the places indicated by "!!!" (There is no way to get the error
location on TILE).

If you want more speed, you can change a lot of multiply, divide and
remainder operations into shifts and ands.

I made no effort to make the test programs portable, but I only expect
problems with mini and perhaps with calc.


DEPENDENCIES

Apart from the problems mentioned in the section on porting there are
a few other noteworthy things:

Your Forth should support long names
Gray needs a big return stack (e.g. ~360 cells for oberon). Adjust your
Forth-System (On TILE change RETURNSIZE in forth.c and recompile).


COPYRIGHT

Copyright 1990, 1991 Martin Anton Ertl
This program is distributed WITHOUT ANY WARRANTY.
See gray.doc or gray.f83 for the license.

From the beginning of GRAY.DOC:

$Id: gray.doc,v 1.1 90/04/18 14:28:06 ertl Exp Locker: anton $

Copyright 1990 Martin Anton Ertl

TERMS AND CONDITIONS FOR USE, COPYING, MODIFICATION AND DISTRIBUTION

1. You may use this product provided that
   a) you DO NOT USE IT FOR MILITARY PURPOSES; and
   b) cause the terms of parapraph 1 to apply to any products
   developed using this product and make these terms known to all
   users of such product;
By using this product, you indicate the acceptance of the terms of
this paragraph.

2. Except for the restrictions mentioned in paragraph 1, you may use
the Program.

3. You may distribute verbatim or modified copies of this program,
provided that
   a) you keep intact all copyright notices, this license, and the notices
   referring to this license and to the absence of warranty; and
   b) you cause any work that you distribute or publish that contains the
   Program or part of it to be licensed to all third parties under the
   terms of this license. You may not impose any further restriction
   on the recipients exercise of the rights granted herein. Mere
   aggregation of another independent work with the Program or its
   derivative on a volume of storage or distribution medium does not
   bring the other work under the scope of these terms; and
   c) you cause the derivative to carry prominent notices saying that
   you changed the Program.

4. You may distribute the Program or its derivative in intermediate,
object or executable code, if you accompany it with the complete
machine-readable source code.

5. By using, modifying, copying or distributing the Program you
indicate your acceptance of this license and all its terms and
conditions.

6. This Program is provided WITHOUT WARRANTY of any kind, either
express or implied, including, but not limited to, the implied
warranties of merchantability and fitness for a particular purpose. In
no event, unless required by applicable law or agreed to in writing,
will any copyright holder, or any other party who may modify and or
redistribute the Program, be liable to you for any damages, even if
such holder or other party has been advised of the possibility of such
damages.

END OF TERMS AND CONDITIONS
---
Preferred:  dwp@willett.pgh.pa.us	Ok:  {pitt,sei,uunet}!willett!dwp