P.D. Terry, Rhodes University
(Last updated 15 September 2005)
Compiling with C# and Java, an introductory text on compiler construction using C# and Java, was be published by Pearson Education in November 2004 but (following standard practice) carries a publication date of 2005.
The subject of compiler writing and the development of compilers is one of the classical fields of computer science for which there are now many freely available resources on the Internet. This page contains links to various web sites where useful material related to compiler construction may be found.
The original report on Coco/R by Mössenböck (1990) can be obtained from http://www.scifac.ru.ac.za/resourcekit/pdf/CocoReport.pdf or from ftp://ftp.ssw.uni-linz.ac.at/pub/Papers/Coco.Report.ps.Z
The latest version of Coco/R from Linz (which can deal with LL(1) conflicts) can be obtained, along with source code, documentation and examples, from http://www.ssw.uni-linz.ac.at/Coco/
For details of how to obtain versions of the Coco/R distributions for a variety of other languages and operating systems, visit the Coco/R home page at http://www.scifac.ru.ac.za/coco/
Comp.compilers is a moderated usenet news group, addressing the topics of compilers in particular, and programming language design and implementation in general. It started in 1986 and now has an estimated total readership of over 100 000. Further details can be found at http://compilers.iecc.com/
At least two books on compiler construction have been placed on the WWW:
Compilers and Compiler Generators - an introduction with C++
P.D. Terry
Rhodes University, Grahamstown, South Africa
(originally published by International Thomson, England, 1997)
http://www.scifac.ru.ac.za/compilersParsing Techniques - a practical guide
Dick Grune and Ceriel J.H. Jacobs
Vrije Universiteit, Amsterdam, The Netherlands
(Originally published by Ellis Horwood, Chichester, England, 1990)
http://www.cs.vu.nl/~dick/PTAPG.html
A comprehensive set of tutorial articles is available as
Jack Crenshaw's "Let's build a compiler"
http://compilers.iecc.com/crenshaw/
Albrecht Wöß and Hanspeter Mössenböck of the University of Linz in Austria have made available their "Compiler Construction Course - Concepts and Practical Application to .NET", which discusses all phases of compilation, showing the theoretical concepts underlying each phase as well as how to implement them efficiently. In this course students use C# to develop a small compiler for a C#-like programming language (Z#), translating a source program into the code of a virtual machine (CLR). This material - which includes a comprehensive set of PowerPoint slides - is published under the Microsoft Curriculum Licence and is available at
"Compiler Construction Course - Concepts and Practical Application to .NET"
Albrecht Wöß and Hanspeter Mössenböck
http://dotnet.jku.at/courses/CC/
There are several sites dedicated to maintaining lists of compilers and compiler-writing tools. While some of these are not completely up to date at all times, useful leads can be found by visiting the following.
Compilers.net's directory and search machine on compilers and programming languages at http://www.compilers.net/
Idiom Consulting's catalogue of free compilers at http://www.idiom.com/free-compilers/
The Compiler Connection at http://www.compilerconnection.com/
Burks (Brighton University Resource Kit for Students) at http://burks.bton.ac.uk/burks
The Programming Web Directory list of compiler construction tools at http://www.programming-x.com/programming/compiler-construction.html
The Free Country list of free compilers at http://www.thefreecountry.com/compilers/index.shtml
Although the best-known C# compiler is that which is available as part of Microsoft's Visual Studio suite, the C# software described in Compiling with C# and Java was developed using the "shared source" (SSCLI) implementation, downloadable from Microsoft's site at http://msdn.microsoft.com/net/sscli/Other software for developing .NET applications is freely downloadable from Microsoft's site at http://msdn.microsoft.com/netframework/downloads/ This includes the .NET framework with the CLR, the .NET class library, the C# compiler and other tools, and the entire API documentation. (Note that Visual Studio .NET is not included, as the Visual Studio software is not free of charge.)
The inner workings of the .NET system are documented at http://msdn.microsoft.com/net/ecma/
A list of languages for which compilers have been released for the .NET system can be found at http://jasonbock.net/dotnetlanguages.html
The Gardens Point Component Pascal compiler for .NET described by John Gough in his book Compiling for the .NET Common Language Runtime (CLR) (Prentice-Hall, 2002) is available from http://www.citi.qut.edu.au/research/plas/index.jsp
Other material relevant to John Gough's book is to be found at http://www.softwareautomata.com
The Gardens Point Parser Generator (gppg) is a Yacc/Bison like parser generator developed by Wayne Kelly. Both the parser generator and the parser runtime components are implemented entirely in C#. They make extensive use of generic collection classes and so require Beta Version 2.0 of the .NET Framework. The parser generator takes a Bison/Yacc style grammar specification with semantic actions coded in C# and produces an LALR(1) parser. It is designed to be simple, efficient and as similar as possible to Yacc/Bison in functionality. It does not include a scanner/lexical analyzer generator. The parser's interfaces however, are designed to be as simple as possible, with minimal object-orientation. The Gardens Point Parser Generator is available from http://g2.fit.qut.edu.au/GPPG.
An on-line tutorial on Application Development with C# and .NET, developed by the University of Linz in Austria is available at http://dotnet.jku.at/courses/dotnet/. This includes approximately 700 PowerPoint slides and approximately 200 exercises with sample solutions, and is available in English and in German. It ties in with the textbooks by Mössenböck, Beer, Birngruber and Wöß: .NET Application Development (Addison-Wesley, 2004) and Mössenböck: C# to the Point (Addison-Wesley, 2004)
As distinct from the Microsoft .NET systems, Mono is an open source cross-platform implementation of Microsoft's .NET Development Framework. It includes a C# compiler (generating .NET virtual machine code, not native code), a runtime for CLR (the Common Language Infrastructure) and a set of libraries. Mono currently works on Linux (both x86 and PPC), Windows, S390, with work being carried on for Strong/ARM and SPARC. http://www.mono-project.com/about/index.html
Some of the Java software in Compiling with C# and Java was developed using the J2 SDK from Sun, available at http://java.sun.com
Another well-known Java compiler that has proved eminently satisfactory is the open source Jikes compiler from IBM's DeveloperWorks at http://oss.software.ibm.com/developerworks/opensource/jikes/
A list of compilers that target the JVM can be found at http://www.robert-tolksdorf.de/vmlanguages.html
A popular system for generating recursive descent compilers in Java is JavaCC, obtainable from https://javacc.dev.java.net along with various example grammars and tutorials in its use.
Fascinating material on the UCSD Pascal system mentioned in Chapter 2 can be found at the on-line Jefferson Computer Museum at http://www.threedee.com/jcm/psystem/The ISO standard for EBNF, mentioned in Chapter 5, is available at http://www.cl.cam.ac.uk/~mgk25/iso-ebnf.html
The Pascal to C translator program p2c mentioned in Chapter 2, and the perfect hash function generator gperf mentioned in Chapter 8, are available by anonymous ftp from any of the sites that mirror the Free Software Foundation GNU archives. Details of these sites can be found at http://www.gnu.org/prep/ftp.html
The ANTLR compiler construction kit mentioned in Chapter 8 is available from http://www.antlr.org
While every attempt has been made to ensure that the material 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
GRAHAMSTOWN 6140
South Africa
Tel: +27-46-603-8292
FAX: +27-46-636-1915
e-mail: p.terry@ru.ac.za