Course

Title: Compilers
Number: 4105605
Time: Wed., Friday 1:15-2:30
Place: EA 101

Description

This course introduces the principles and techniques of compiler design and implementation. Emphasis is placed on using various compiler generation tools to implement a small compiler.

Teaching Assistants

 

Textbook

A. V. Aho, R. Sethi and J. D. Ullman, Compilers: Principles, Techniques, and Tools, Addison-Wesley, 1986.

Classnotes

Semester Project

        Each person will be responsible for creating an abstract syntax tree for a different grammar, such as the following:

Java

MiniBasic

SableCC

Simple C language

4. 6. 9. IDL for C++  (to create C++ declarations from Corba IDL declarations)

 Small Pascal

 Jasmin

 OQL

 

For the given AST, you should write a “prettyPrinter” which is able to print an XML document that uses CSS tags that allow the program to be displayed in a CSS pane on a browser.  The “network prettyprinter” should run on any browser that supports CSS 2.0.  CSS (Cascade Style Sheets) allow you to use a “.css” file to control the printing of XML documents.  The .css file selects the parts of a file for assigning certain colors, relative nesting and offsets, and other print styles.  The selected parts of the file which are assigned these styles can depend on the following:

nested tags

CLASS=  parameter within a tag

ID=   parameter within a tag

 

You need to use the given SableCC AST grammar (available at ftp://xbean.cs.ccu.edu.tw/SableCC/sableCCGrammars/grammars/grammars/  to create a parser which outputs an XML document for each input program.  The XML document should use the following format:

<Name  CLASS=Alternative  ID=subscript > nested parts </Name>

The “Name” is the left-side nonterminal of a production.  The CLASS= assignment is only needed if there is a curly bracket at the beginning of a SableCC rule, giving a name to that alternative (similar to an instance class for the abstract class “Name”).  The “ID=” is used to allow access to elements of SableCC lists, and also to refer to right-side objects with the same Nonterminal but different names given in square brackets.  The name in the square brackets is used instead of the subscript.  If the SableCC square bracket refers to a list, then the value of “subscript” is a name like “squareBracketName[subscript]”.

Grades

   Grades will be placed here.

Compiler grades

Documents