Turbo Pascal Lex/Yacc 


This is a compiler generator toolset I've written in my spare time when I was a student of Mathematics at the University of Mainz. At that time I used to program a lot in Borland's Turbo Pascal. Being interested in compiler construction, I thought it would be nice to have Turbo Pascal versions of the lex and yacc tools which are part of the UNIX/C programming environment. Nothing like this was available, and so I decided to write them myself. Judging from the email I still get, these programs have become fairly popular. They are not only used in the scientific community for the purpose of teaching compiler construction, but also for serious software projects both in academic institutions and commercial companies all over the world. There is one book I know of [Nino Silverio, Réaliser un compilateur: Les outil Lex et Yacc, Éditions Eyrolles, France, 1994, ISBN 2-212-08834-5] which devotes three chapters to TP Lex/Yacc. Furthermore, an article about TP Lex/Yacc has appeared in a special issue of the CCAI Journal [A. Gräf, TP Lex and Yacc: A compiler generator toolset for Turbo Pascal, Journal of Communication and Cognition - Artificial Intelligence (CCAI), 12(4), 1995, pp. 383-424.].

As of April 2000, the latest release is TP Lex and Yacc Version 4.1a. This a maintenance release which fixes some compilation problems with newer fpc versions, as well as two bugs ("memory overflow" at startup, weird Lex output when regular definitions have trailing blanks). Currently I can only test this with Linux fpc, so if you can provide patches and binaries for other systems, please get in touch with me. Thanks to all of you who already reported bugs or send in other contributions.

Version 4.1 of TP Lex/Yacc supports all recent flavours of Turbo and Borland Pascal, including Delphi, and the Free Pascal Compiler (fpc), a GPL'ed Turbo Pascal-compatible compiler which currently runs on DOS and Linux (other ports are under development). Thanks are due to Berend de Boer (berend@pobox.com) who contributed the BP/Delphi support, and to Michael van Canneyt (michael.vancanneyt@wisa.be) who added the patches necessary to make TP Lex/Yacc compile with Free Pascal. The sources and a few other items are available below:

Note that the version of TP Lex/Yacc which is currently distributed with the Free Pascal compiler, as of fpc 0.99.14, is still Version 4.1, but the changes to 4.1a will hopefully soon be integrated in a forthcoming fpc release.

Quite a few other TP Lex/Yacc versions are floating around on the net. The present version is based on Berend de Boer's 4.0 version (available from the Garbo MsDos & Windows archive), which in turn is based on my 3.0a version:

The 3.0a package is also still available from simtel20 and mirrors. The above should be considered the official thread of TPLY development. Several people have started to develop other ports based on the 3.0a version. Among them are Thierry Coq's Delphi parser package which contains a Delphi grammar together with a modified version of TP Lex/Yacc, and Robert Zierer's Delphi port of TP Yacc.

Scott J. Miles has contributed his Glyd 2.0 package featuring a nice GUI frontend for TP Lex/Yacc (see screenshot), along with modified parser and lexical analyser skeletons and LexLib/YaccLib libraries for use with Delphi. (The lex and yacc executables contained in this package are still from version 4.1, so you might wish to replace these with the latest ones.)

Michiel Rook has also released a new Delphi Yacc & Lex package based on TP Lex/Yacc 4.1, for which he cleaned up the sources and ported them to the latest Delphi and Kylix environments. He also provides a Debian package.

Please note that I can't support these offsprings, so you should contact the corresponding authors in case of trouble.

Albert Graef (ag@muwiinfa.geschichte.uni-mainz.de)
Department of Musicinformatics
Johannes Gutenberg-University Mainz