Re: Project on Compiler

jhall@garden.WPI.EDU (John Clinton Hall)
Thu, 13 Jan 1994 20:05:44 GMT

          From comp.compilers

Related articles
Project on Compiler (1994-01-13)
Re: Project on Compiler (1994-01-13)
Re: Project on Compiler jhall@garden.WPI.EDU (1994-01-13)
Re: Project on Compiler (1994-01-14)
Re: Project on Compiler (Kurt Bischoff) (1994-01-14)
Re: new version of PCCTS (Terence Parr) (1994-01-14)
Re: Project on Compiler (1994-01-16)
| List of all articles for this month |

Newsgroups: comp.compilers
From: jhall@garden.WPI.EDU (John Clinton Hall)
Keywords: courses, tools
Organization: Worcester Polytechnic Institute
References: 94-01-044
Date: Thu, 13 Jan 1994 20:05:44 GMT (Sridhar Alluri) writes:
>... We are supposed to write a compiler for a subset of Pascal. I would like
>to know how complex the project is going to be.

I wrote a subset of Ada in one semester for my compiler course, so it is
certainly a doable project. To get started, I'd say go to the library and
check out the "bird" book (_Lex & Yacc_, by John R. Levine, Tony Mason,
and Doug Brown, published by O'Reilly and Associates, Inc.). It is an
excellent tutorial on lex and yacc.

You should also check out the "dragon" book (_Compilers, Principles,
Techniques, and Tools_, by Alfred V. Aho, Ravi Sethi, and Jeffrey D.
Ullman) and _Crafting A Compiler with C_, by Charles N. Fischer and
Richard J. LeBlanc, Jr. Both contain chapters on code generation and code
optimization, and the Fischer/LeBlanc book contains an entire chapter on
symbol tables.

A couple of other books you might want to check out (but which are harder
to find) are _Design of Compilers: Techniques of Programming Languages_
and _Fundamentals of Compilers: An Introduction to Computer Language_,
both by Karen A. Lemone and published by CRC Press, Inc. (last published
in 1992). They both discuss as a central theme the design of a compiler
for a subset of Ada.

There are also a number of other parser generators out there, if you don't
want to use lex/yacc. One that sticks out in my mind is Ox. But one that
I can personally speak for is PCCTS, the Purdue Compiler Construction Tool
Set, which I feel is an excellent product. It generates an LL(k) parser
and allows you to specify keyword and other token regular expressions in
the parser file (with lex/yacc, you define your lexical scanner in lex,
and then there is this magical link to the parser you write in yacc). It
also allows the creation of attributed grammars and can generate your AST
(abstract syntax tree) for you.

PCCTS is available for anonymous ftp, although I don't remember the site
address (Terence, please refresh my memory). Also, the new version is
supposed to generate C++ Parser and Scanner objects, but I don't even know
if the new version is out yet, since I just got back from a vacation.
(Terence, is it out yet?)

Worcester Polytechnic Institute

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.