From: cspt@giraffe.ru.ac.za (Prof. P. Terry)
Subject: Re: Compiler Tools
Organization: Rhodes University, Grahamstown, South Africa
Date: Tue, 5 Jan 1993 10:47:04 GMT

In article <1993Jan4.180947.27027@gallant.apple.com> cheryl@gallant.apple.com (Cheryl Lins) writes:

>In article <725269241snx@black.demon.co.uk> tchannon@black.demon.co.uk writes:
>>All was gloom here until I tried the much improved version of Coco/R by Pat
>>Terry. 
>
>Maybe you're talking about something different, but the Coco/R i have was written
>by Hanspeter Moessenboeck at ETH (one of the original authors of Coco). There
>is even an ETH technical report describing Coco/R.

Quite correct - Hanspeter did the original.  What Tim has got hold of is the
revised and slightly extended version for MS-DOS compilers which I have been
maintaining and distributing to folk who qualify.  The internal machine is
Hanspeter's, just a bit of sugar and a few bug fixes from me, as well as some
rearrangement and tweaks to make it easier to port.

There has been quite a bit of interest in this recently.  It may be of 
interest to post the README file from the distribution kit

Compiler-Generator Coco/R
=========================

               (Pat Terry,  updated Mon  15 June 1992)

Coco/R generates recursive descent parsers and their associated scanners from
attributed grammars.  This disk contains source files for the compiler
generator Coco/R (Moessenboeck, 1990), as well as the executables, frame
files, and some sample applications.

Distribution is free to academic sites.  Commercial users should contact
Professor Moessenboeck at the address below to make licensing arrangements.

Coco/R was originally written in Oberon, and has now been ported into Modula-2
and implemented under MS-DOS so that it may be used with any of the TopSpeed
Modula-2 compilers, as well as with the FST 2 or 3, StonyBrook QuickMod 2.2 
and Logitech 3.03 compilers.  The MS-DOS implementation is essentially 
portable across these systems, save for the I/O module used by Coco/R and 
its generated parsers; code for the various implementations is, naturally, 
supplied.

Coco/R can bootstrap itself to generate its own driver, parser, scanner, and
semantic evaluator from the attributed grammar CR.ATG.  This grammar thus
serves as an an example of how to write compiler descriptions for Coco.  There
are also other simpler examples showing its use.

FileList
========

The following files are provided in the distribution kit:

READ.ME                  This file
COCOR.EXE                Compiler-compiler executable
SCANNER.FRM              Frame from which the scanner is generated
PARSER.FRM               Frame from which the parser is generated
COMPILER.FRM             Frame from which a driver compiler may be generated
HISTORY                  Summary of bug fixes and modifications

Subdirectory "Docs"      Documentation

  COCO.USE               Notes on the use of Coco
  COCOL                  The compiler description language
  CHANGES                Differences between Oberon and Modula-2 versions

Subdirectory "Sources":  Sources for Coco/R

  CR.MOD                 Main program
  CR.ATG                 Fully attributed grammar of Coco/R
  CR0.ATG                Simplifed grammar of Coco/R (no attributes)
  CRE.TXT                Error numbers and corresponding error message texts
  CRS.DEF + MOD          Scanner (generated by Coco/R from CR.ATG)
  CRP.DEF + MOD          Parser (generated by Coco/R from CR.ATG)
                         (The JPI specific version is in the \JPI directory)
  CRT.DEF + MOD          Symbol table, top-down graph, grammar tests.
  CRA.DEF + MOD          Generation of the scanner.
  CRX.DEF + MOD          Generation of the parser.
  CRC.DEF + MOD          Generation of the compiler driver.
  CRG.DEF + MOD          Module giving symbolic names for scanner/parser
                         to use (Generated with $N pragma)
  FileIO.DEF + MOD       General input output library
                         Source for FileIO.MOD appears in a compiler specific
                         subdirectory - \JPI \FST \STO or \LOG
  Sets.DEF + MOD         Various set operations
  Strings.DEF + MOD      Various string operations for JPI
                         Strings.DEF and MOD appear in \JPI directory
  COMPILER.FRM           Frame from which CR.MOD may be regenerated ($C pragma)

Subdirectory "Taste":  A tiny compiler and utilities as examples of Coco/R
(The appropriate .FRM file must be renamed to COMPILER.FRM before use)

  Taste.ATG              Compiler description
  Taste.FRM              Frame from which TASTE.MOD may be generated ($C pragma)
  TC.DEF + MOD           Code generator/interpreter
  TL.DEF + MOD           Symbol table handler

  Pretty.ATG             Pretty printer description
  Pretty.FRM             Frame from which PRETTY.MOD may be generated ($C pragma)
  PrettyPr.DEF and MOD   Auxiliary pretty printing routines

  XRef.ATG               Cross referencer description
  Xref.FRM               Frame from which XREF.MOD may be generated ($C pragma)  TL.DEF + MOD           Table handler
  CrossRef.DEF + MOD     Auxiliary table handlers

  *.TAS                  Example input files

Subdirectory "SAMPLE":   Further sample grammars for Coco/R

  ADACS.ATG              Subset Ada grammar based on Fischer and LeBlanc
  CALC.ATG               Simple calculator grammar based on Dobler
  CLANG1.ATG             Clang level 1 grammar based on Terry
  CLANG2.ATG             Clang prettyprinter based on Terry
  EXPR.ATG               Simple expression grammar
  MICROADA.ATG           Subset Ada grammar based on Dobler
  MOD2.ATG               Modula-2 grammar based on Dobler's
  PIMMOD2.ATG            Modula-2 grammar based on PIM

Credits
=======

Coco/R was originally developed by

      Prof. Hanspeter Mssenbck
      ETH Zrich, Institut fr Computersysteme
      ETH-Zentrum, CH-8092 Zrich, Switzerland
      Tel.: +41-1-254 7342
      e-mail: moessenboeck@inf.ethz.ch

The first Modula-2 port was done by Hanspeter Mssenbck for the Apple
MacMeth system.  A port was done to JPI TopSpeed Modula-2 at ETH by Marc
Brandis and Christof Brass, and this was made available to Pat Terry, who has
corrected several errors, enhanced the portability, and provided the versions
which you find on this disk.  Responsibility for remaining bugs in the MS-DOS
version thus rests largely with

      Pat Terry
      Computer Science Department, Rhodes University
      GRAHAMSTOWN 6140,  South Africa
      Tel: +27-461-22023 ext 291
      e-mail: pdterry@m2xenix.psg.com or cspt@alpha.ru.ac.za

For further information on the use and implementation of Coco refer to

  Mssenbck, H. : A Generator for Fast Compiler Front-Ends.
  Report 127, Dept. Informatik, ETH Zurich (1990)

  Mssenbck, H. : A generator for production quality compilers.
  Proc 3rd Int'l Workshop on Compiler-Compilers, Schwerin FRG, 1990

Related insight may be gained from

  Rechenberg, P and Mssenbck, H. : A compiler generator for
  microcomputers (Prentice-Hall, 1989)

whichs describes Alex and Coco, predecessors of Coco/R, and from

  Dobler, H. and Pirklbauer, P.  : Coco-2, a new Compiler Compiler
  (ACM SIGPLAN Notices, 25(5), 82-90, May 1990

  Dobler, H. : Top-down Parsing in Coco-2
  (ACM SIGPLAN Notices, 26(3), 79-87, March 1991.

which describe Coco-2, another derivative of the original Coco.

=END=