CSC402 Homepage

Programming Language Implementation

Fall 2015


Dr. Lutz Hamel
Tyler Hall Rm 251
Office hours: Friday 11am-noon Tyler Rm 251, Wednesday 11am-12:30pm Tyler Rm 52


Greg Breard
Office Hours: Wed 11-12:30 Tyler Rm 52, Tues + Thurs 2:30-4 Tyler Rm 135


** Final due in Sakai Friday 12/18 @ 11:55pm (please see format below) **

The report for the final project must contain the following sections in order to receive full credit; you must also submit a zip file with your working source code:

[11/30/15] For assignment #7: here is what the code for the keyword parameters should look like:
declare idiv(dividend,divisor) {
     return dividend/divisor;

put idiv(divisor->2,dividend->3)
Also, the warnings ANTLR gives you about the 'else' statement are ok - they are just warnings, ANTLR still generates code. The warning essentially states that in an ambiguous statement such as
if  then if  then  else 
The else is associated with the closest if statement.
[11/23/15] posted assignment #7
[11/2/15] here is a hint when building ASTs especially with regards to the Basic for loop. Consider the program snippet
for x = 1 to 10 step 2
next x
could be represented as the AST
    ('=' x 1)
    (NUM 10)
    ('step' 2)
Now consider the snippet
for x = 1 to 10
next x
Here is the implicit assumption of step 1, but in the AST we can make that assumption explicit making the interpretation much more coherent over the different possibilities:
    ('=' x 1)
    (NUM 10)
    ('step' 1)
This is a common AST trick where when building the tree we simply fill out snippets of tree that are assumed in the input program.
[11/2/15] Note the extended deadlines in Sakai [10/29/15] Posted assignment #6
[10/26/15] *** Midterm due Monday 11/2/15 in Sakai ***
[10/18/15] posted assignment #5
[10/8/15] posted assignment #4
[10/7/15] ** We will have class on Monday 10/12 **
[9/30/15] posted assignment #3
[9/23/15] posted assignment #2
[9/21/15] Assignment #1 should now be submitted via Sakai. I have posted a new version of Assignment #1
[9/20/15] Here is a version of nextToken() that implements EOF correctly (Thanks Austin!)
    private char nextToken () throws Exception {
	int i;	
	char c;
	// skip white space
	while ((i = == 32 || i == 10 || i == 13 || i == 11);
	if (i == -1)
		throw(new EOFException());
	c = (char) i;
	currentToken = c;
	return c;
[9/18/15] Here is a zip file with a handcoded LL(1) parser for a small example language. Save this file onto your UbuntuBox, unzip it, and take a look at the README file.
[9/18/15] posted assignment #1
[9/15/15] I posted draft book chapters on the topics of language processors and language tools, take a look.
[9/10/15] The Linux virtual machine is now available for download:


Download this file (careful ~2.5GB) and import this into VirtualBox using the file->import appliance menu point. Once imported you can start the machine by double clicking on UbuntuBox.
[9/9/15] Please install Virtual Box version 4.3 on your computer.
[9/9/15] Welcome!


If any of these questions interest you then CSC402 is for you. We will spend the semester looking at programming language implementations: from syntax highlighters to code analyzers, from interpreters and virtual machines to compilers.

As part of the course we will construct interpreters and translators for domain specific languages such as calculator languages and command line languages for steering your favorite game character. The course will also include one large semester project of a language implementation project of your choosing. This could be a graphics language, a new programming language (think Ruby), a domain specific language such as PHP or a new command line shell interpreter for Unix/DOS.

The goal of the course is to give you a solid foundation with respect to programming language implementation which includes grammar construction, parsing techniques, intermediate representations, tree construction, tree pattern matching techniques, among many other topics. The course is designed around a set of programming language implementation design patterns that shed light on the overall construction of programming language processors. These tools will enable you to add domain specific and general programming language implementations to your tool chest to solve difficult engineering problems.

Final Project Ideas

When I say implementation that could mean: as an interpreter, as a compiler to a virtual machine, or as a compiler to actual machine code.

Documents of Interest:

NOTE: email submissions are not acceptable for assignments.