Special Symbols | Contents | Diagrams | Symbol Font Edition | GIF Font edition | Downloadable files | Source Code | Courseware | Change List

Compilers and Compiler Generators

an introduction with C++

© P.D. Terry, Rhodes University, 1996

NEW (1 February 2005)

The complete text of the book has been distilled into one PDF file (1MB) pdfvers.pdf, courtesy of Irwin Oppenheim of the Netherlands.

NEW (23 November 2004)

A complete revision of this book, using C# and Java and the versions of Coco/R for those languages, was published by Pearson Education (Addison Wesley) on 5th November 2004 under the title "Compiling with C# and Java" (ISBN 032126360X).

A feature of this book is that it demonstrates the use of Coco/R to implement compilers for the JVM and CLR platforms.

You can view the contents of the freely available "Resource Kit". This contains the preface and table of contents, additional material that does not appear in the published book, the source code for all the case studies, and distributions of Coco/R for C# and Java.

You might also like to view the Pearson Education catalogue entry for this book.

Order it from www.amazon.co.uk

(February 2003) Local site reorganization:

A previous ftp server has been decommissioned.

Source files for the software in the book are now available from this site.

Pat Terry's home page is now at http://www.scifac.ru.ac.za/cspt/

Pat Terry's Coco/R home page is now at http://www.scifac.ru.ac.za/coco/


This site provides an on-line edition of the text and other material from my book "Compilers and Compiler Generators - an introduction with C++", published in 1997 by International Thomson Computer Press. The original edition is now out of print, and the copyright has reverted to me.

The home page for this site, with details of how to download up-to-date compressed versions of the text and its supporting software and courseware can be found at http://www.scifac.ru.ac.za/compilers/.

The text of the book is Copyright © PD Terry. Although you are free to make use of the material for study and academic purposes, please do not redistribute it without my knowledge or permission.

Comments, suggestions and questions to Pat Terry.

Special symbols in this text

There are two editions of the text, as it makes use of mathematical symbols and Greek letters that are not part of the standard ASCII character sets. If your browser can support it, use the symbol font edition. Your browser will already be set up to support the symbol font if the next line displays the Greek alphabet:


My system, when running Win95, supports this font this with Internet Explorer® and with Netscape Navigator®. When running Linux, my system supported the font with Netscape after I added the line

    Netscape*documentFonts.charset*adobe-fontspecific:      iso-8859-1

to the .Xdefaults file.

If you cannot get your browser to render this font, you should use the GIF Font edition of the text. Check on the possibilities by following the links below.
symbols.htmSymbols font for special characters
symgifs.htmGIF images for special characters

Contents pages

There are two editions of the text. Follow the appropriate link below to reach the contents pages for the edition that suits you:
conts.htmSymbol Font Edition
contg.htmGIF Font Edition


The HTML editions of the text have the diagrams composed from ASCII text only. This allows the text to be read easily on many browsers, including Lynx. However, these diagrams are a little crude; the Postscript and PDF versions have them rather more elegantly. If there is sufficient demand I can produce HTML versions with diagrams rendered from suitable image files.

Downloadable files

Compressed HTML files

The HTML and GIF files comprising this site are available for download as sets of compressed files by following the links given below.

The Wintel versions of these files have been compressed with the 32-bit version of Info-ZIP's compression utility. Info-ZIP's software (Zip, UnZip and related utilities) is free and can be obtained as source code or executables from various anonymous-ftp sites, including ftp://ftp.uu.net/pub/archiving/zip/.
sversion.zipSymbol Font edition (only)
gversion.zipGIF Font edition (only)
combined.zipBoth editions

Versions compressed with tar and gzip suitable for directly installing on Unix© servers can be found in the files
sversion.tgzSymbol Font edition (only)
gversion.tgzGIF Font edition (only)
combined.tgzBoth editions

After downloading the appropriate file, unpack it to a suitable directory and point your browser at the index.html or index.htm file in the usual way. The files are held in a flat structure; some of the files in the restricted editions are common to both editions. All files are named so as to conform to the old MSDOS 8+3 convention, but use lower-case letters; however, two copies of the index page (index.html and index.htm) are supplied. You may have to configure your server software to be able to render file names with a .htm extension correctly.

Compressed PCL format files

The text of the book is also available for download as a compressed set of files in Hewlett-Packard's PCL format, which will allow you to print a copy on LaserJet compatible printers (provided these can support a Symbols font). The set has been compressed with Info-ZIP's compression utility, and a short extract is available for testing purposes in the file http://www.scifac.ru.ac.za/compilers/sample.zip (about 6K).

After downloading this file, unpack it and then copy the required files directly to a printer with no intermediate filtering. For example, issue the DOS command


and you should get the bibliography section - about 4 pages. That forms a useful check that the system is compatible. If, after that, you wish to print a copy of a particular chapter, the entire set of files can be obtained by anonymous ftp from http://www.scifac.ru.ac.za/compilers/longpcl.zip (about 750K)

Some people who have tried this complain that the pages are too long. If when you copy BIBLIO.PCL to your printer you get the (obvious) situation that the pages seem too long, make sure you have set the printer for A4 paper. If the results are still unsatisfactory, the file http://www.scifac.ru.ac.za/compilers/shortpcl.zip contains the text set for slightly shorter page length on A4 paper. At present (12 November 1999) the index for this version is out of kilter with the page numbers.

Postscript edition

The text of the book is also available for download as a compressed set of files in Postscript format, which will allow you to view the text with Ghostscript/Ghostview or print it on a suitable printer. This version also boasts a better set of diagrams. The compressed file is about 1.2MB, but expands to require 18MB of storage.
pversion.tgzVersion compressed with tar and gzip
pversion.zipVersion compressed with Info-ZIP utility

Adobe® PDF edition

The text of the book is also available for download as a compressed set of files in PDF format, which will allow you to view and/or print the text with Adobe Acrobat or Ghostview. This version was constructed from the Postscript version using the ps2pdf utility packaged as part of Ghostscript. The compressed file is about 1.2MB, but expands to require 8MB of storage.
pdfvers.tgzVersion compressed with tar and gzip
pdfvers.zipVersion compressed with Info-ZIP utility
pdfvers.pdfComplete text in one PDF file (1MB) courtesy of Irwin Oppenheim of the Netherlands.


The latest versions of the software sources for the book are available for anonymous FTP using the links shown below. These files are currently supplied as self-extracting MS-DOS executables within a "zip" wrapper. These were created with the freely available program LHA.EXE, and incorporate corrections that have emerged since the book was published. They may also be decompressed using LHA on other systems.

cocorc.exe        103 Kb  Minimal Coco/R for C          (Updated 2002)
cocorm.exe         76 Kb  Minimal Coco/R for Modula-2   (Updated 2002)
cocorp.exe         65 Kb  Minimal Coco/R for Pascal     (Updated 2002)

common.exe 93 Kb Files common to all languages (Updated November 1999) csources.exe 350 Kb C++ specific sources (Updated November 1999) msources.exe 345 Kb Modula-2 specific sources (Updated November 1999) psources.exe 312 Kb Pascal specific sources (Updated November 1999) fileio.exe 153 Kb Modula-2 FileIO module (Updated November 1999)
All of the sources above
lha213.exe 43 Kb LHArc decompressor readme.1st 11 Kb Installation and setup instructions

Details of how to install the software can be found in Appendix A.


If you are interested you might also like to visit the WWW pages for a course I give based on this text, which can be found at http://www.cs.ru.ac.za/courses/CSc301/Translators/trans.htm.

This contains a collection of exercises, tutorials, tests, examinations, and so on. The material is supplied "as is" for external readers, and is a bit of a mixed bag that changes dynamically as the course proceeds.

Complete courseware for the last few years is available from this site on application to the author.

Change List