ECE 46800 - Introduction to Compilers and Translation Engineering

Lecture Hours: 3 Lab Hours: 1 Credits: 4

Professional Attributes
Advanced CMPE
EE Elective

Normally Offered: Each Fall

Requisites:
ECE 36200 and ECE 36800

Catalog Description:
The design and construction of compilers and other translators. Topics include compilation goals, organization of a translator, grammars and languages, symbol tables, lexical analysis, syntax analysis (parsing), error handling, intermediate and final code generation, assemblers, interpreters, and an introduction to optimization. Emphasis is on engineering a compiler or interpreter for a small programming language - typically a C or Pascal subset. Projects involved the stepwise implementation (and documentation) of such a system.

Required Text(s):
  1. Crafting a Compiler, C. Fischer & R. LeBlanc, Addison Wesley, 1991, ISBN No. 978-0805321661.
Recommended Text(s):
  1. Various tutorial papers from ACM and IEEE Digital Libraries.

Learning Outcomes:

A student who successfully fulfills the course requirements will have demonstrated:
  1. an understanding of the terminology, representation and use of formal languages and grammars. [1]
  2. an understanding of the terminology and techniques of lexical analysis, parsing, semantic processing, code generation, and optimization. [1]
  3. an ability to design and implement a compiler, translator or interpreter for a small language based on their knowledge of (i) and (ii). [1,2,6]

Lecture Outline:

Weeks Topics
1 Structure of a compiler
2 Scanning, scanner generation
2 Grammars, parsing, parser generation
1 Semantic processing
1 Symbol tables and declarations
2 Processing expressions and control structures
2 Procedures and functions
2 Code optimizations
1 Program analysis
1 Tests

Lab Outline:

Week Topic
1 Introduction and project overview -- describe the project steps and how they interact, turn-in procedures, academic honest policies. Overview and work on the use of the Lex and Antlr programs for developing a lexical analyzer (i.e. lexer) for the project language.
2 Debugging help and continuation of code development started in lab 2.
3 Overview and work on the sue of the Yacc and Antlr tools for developing an LR or LL parser for the project language.
4 Debugging help and continuation of code development started in labs 2 and 3.
5 Overview of the data structures needed to develop a symbol table. Use of the parser developed in lab 2 to drive semantic actions for variables declarations.
6 Debugging help and continuation of code development started in lab 5.
7 Overview and implementation of semantic routines for expressions, assignment statements and read and write statements. This lab builds on the code created in the first six labs. Discussion of the proper IR for statements and expressions in the program.
8 Debugging help and continuation of code development started in lab 6.
9 Overview of function body code generation, including actual parameter handing, generating code for parameter references, and generating code for return values. The code developed will be integrated with the code developed in the first eight labs.
10 Overview of function call code generation, including passing arguments and code generation obtain the return value from a function call. The code developed will be integrated with the code developed in the first nine labs.
11 Debugging help and continuation of code development started in labs 9 and 10.
12 Overview of code generation with a limited number of register (i.e. register allocation.) This code will be integrated with the code developed in labs 1 through 11.
13 Overview of instruction scheduling, generating code from an instruction schedule. This code will be integrated with the code developed in labs 1 through 12.
14 Debugging help and continuation of code development started in labs 12 and 13.
15 Overall project integration and debugging.