You are here
EECS 665 Laboratory
Welcome to EECS 665: Compiler Construction. The design, implementation, and interaction of the various phases of compilation is the core knowledge taught in this class. You will learn how compilers for computer programming languages are constructed using open source compiler construction tools such as Lex, Yacc, and GCC. Learning will focus on lexical analysis, parser generation, peephole optimization, and machine code generation.
The laboratory for this class makes use of open source compiler construction software and open source compilers. Lexical analyzers will constructed using the Lex tool. This tool constructs a C program that performs lexical analysis by converting an input stream of ASCII characters into a user defined TOKEN stream used by the parser. The user defined TOKEN stream is constructed by matching the input stream against a set of regular expressions with each regular expression having a defined output TOKEN produced when the match succeeds.
Parsers will be constructed in the class using the LALR(1) parser generator YACC. This tool constructs a C program that performs parsing by converting a Backus-Naur Form (BNF) like grammar definition into a sequence of users actions. A user defined action is general C code that is associated with a grammar rule and is executed when that grammar rule is used to parse the input TOKEN stream. The user action can be as simple as doing nothing but is generally used to build an abstract syntax tree (AST) or perform evaluation.
Other open source tools may be used in addition to these two core compiler construction tools. For instance, in most laboratories GCC and Make will be used to build your projects into executables. Other compiler construction tools may also be used in certain laboratories. For instance, projects based on ANTLR and/or LLVM may be introduced during the course.
Students completing this course will leave with knowledge of the core phases of program compilation and will be able to design and implement each of these phases. By the end of the course students will have constructed complete compilers capable of translating of high-level programming languages into assembly level machine code.

