/ Instalation of software - Compilers, Compiler generators and C++

Compilers and Compiler Generators - An Introduction With C++

P.D. Terry ( p.terry@ru.ac.za )

Published by International Thomson Computer Press © 1997

Installation of the software for this book

WARNING - the software provided here was developed in the 1990s using compilers for C++, Modula-2 and Pascal that were designed for machines and operating systems available at that time. This was the era of "16 bit systems". Some of the software may not run directly, or at all, on modern "32 bit systems" or "64 bit systems" without some prior modification, or the use of virtual machines or machine emulators.

The descriptions below reflect the development of the systems using command line compilers and utilities. Note the frequent use of the word "directory" where modern users tend to use "folder"!

The software that accompanies this distribution was originally developed in Modula-2. It was subsequently converted to Turbo Pascal, and to C++. Although C++ code is used for most of the illustrations in the text, highly self-consistent source code in all three languages is to be found in the distribution as well.

The C++ source code was mainly developed under MS-DOS using Borland C++ 3.1. It has also been successfully compiled under Linux, using G++, the GNU C compiler. Although many of the case studies have also been tested with Turbo C++ 3.1, there appears to be a bug in that compiler that prevents the template set class from compiling correctly. With suitable modifications to the "make" scripts the code should be acceptable to Borland C++ 5 and to other 32 or 64 bit compilers.

The Turbo Pascal source code was developed to run on any version of Turbo Pascal from 5.5 onwards (although Delphi users should read the notes on Delphi below). However, it makes little use of OOP extensions.

The Modula-2 source code should be immediately usable on MS-DOS based systems using the shareware compiler marketed by Fitted Software Tools (FST), the Stony Brook Modula-2 compiler marketed by Gogesch Micro Systems, Inc., or the TopSpeed Modula-2 compilers developed by Jensen and Partners International (JPI) and now marketed by Clarion Software. It will also compile unchanged under Gardens Point Modula-2 on a wide range of systems.

Unpacking the software

The essential software on the diskette is supplied in the form of eight compressed (zipped) files and a version of UNZIP.EXE.

      CSOURCES.ZIP - sources written in C++
      PSOURCES.ZIP - sources written in Turbo Pascal
      MSOURCES.ZIP - sources written in Modula-2
      COMMON.ZIP   - language independent files
      FILEIO.ZIP   - support library for Modula-2 sources
      COCORC.ZIP   - Coco/R for C/C++
      COCORP.ZIP   - Coco/R for Turbo Pascal
      COCORM.ZIP   - Coco/R for Modula-2
      UNZIP.EXE    - Program to decompress ZIP files

Download these files and store them in a convenient directory (folder), say F:\DOWNLOADS.

To unpack the software, simply follow the steps below. Example MS-DOS commands are shown (these may need alteration, depending on the configuration of your computer). Windows users may follow an equivalent sequence of operations from within the File Manager.

Proceed to unpack (a) the language specific case studies (b) the language independent files (c) the language specific compiler generator and, if you are a Modula-2 user, (d) the FileIO library.

Unpacking the case study software

Unpacking the executable version of the compiler generator Coco/R

Setting up the software for a particular case study

Installation of many (but not all) of the case studies requires you simply to

The FileIO library (Modula-2 users only)

Scanners, parsers, and compilers created by the Modula-2 version of Coco/R assume that you will use an I/O module FileIO. You will need to install and compile the version of FileIO that matches your compiler.

In the distribution you will find a self-extracting file FILEIO.ZIP that contains the sources of FileIO for a variety of MS-DOS compilers.

The sources supplied will act as models of implementations for compilers not mentioned above. In case of difficulty, please contact the author.

Delphi users

The Turbo Pascal case studies, and the output from Coco/R for Pascal will not compile directly under Delphi. They require WinCrt to be added to the list of units "used" (edit the compiler frame files for Coco/R). Furthermore those systems (like the assemblers and compilers) that provide for interactive input/output in their interpreters require use of WinCrt.AssignCrt instead of the current calls to Assign with an empty filename (for example in STKMC.PAS and MC.PAS).

Disclaimer

While every attempt has been made to ensure that the software in this distribution performs properly, the author can accept no liability for any damage or loss, including special, incidental, or consequential, caused by the use of the software, directly or indirectly. However, please bring any problems that you may experience to the attention of the author.

Pat Terry
Computer Science Department
Rhodes University
MAKHANDA / GRAHAMSTOWN 6140
South Africa

e-mail: p.terry@ru.ac.za