COMP207P - Compilers

This database contains the 2017-18 versions of syllabuses. Syllabuses from the 2016-17 session are available here.

Note: Whilst every effort is made to keep the syllabus and assessment records correct, the precise details must be checked with the lecturer(s).

Code COMP207P
Year 2
Prerequisites None
Term 2
Taught By Earl Barr (100%)
Aims This is a practical course whose primary goal is develop an understanding of the operation of compilers and the development and specification of computer-based languages. The course pulls together threads from underlying theory, most notably from logic and from data structures and algorithms, and builds on these a practical exercise in which students create a compiler of their own using commonly available compiler development tools.
Learning Outcomes To be able to: build lexical analysers and use them in the construction of parsers; express the grammar of a programming language; build syntax analysers and use them in the construction of parsers; perform the operations of semantic analysis; build a code generator; discuss the merits of different optimisation schemes.

Content

Anatomy of a compiler
The importance of compilers
Structure of a compiler
Analysis (lexical, syntax and semantic analysis)
Synthesis (intermediate code generation, optimisation and code generation)
Compilers vs. interpreters

Lexical analysis (scanning)
Tokens
Regular expressions
Finite state automata (deterministic and non-deterministic)
Translating regular expressions into finite state automata
Automatic lexer generators (JLex/JFlex)

Syntax analysis (parsing)
Context-free grammars
Derivations and (concrete/abstract) syntax trees
Handling ambiguous grammars
Top-down parsing (LL(k) grammars, recursive descent parsers)
Bottom-up parsing (LR(k) grammars, shift-reduce parsers)
Automatic parser generators (CUP)
Syntactic error recovery

Syntax-directed translation
Syntax-directed definitions
Abstract syntax tree construction

Semantic analysis
Symbol table management
Scoping and type checking
Basic implementation techniques (Visitor methodology)

Intermediate code generation
Three address code
IR instructions
Translation methodologies

Code generation and optimisation
Run-time storage organisation
A simple code generation algorithm
Optimisation of intermediate code
Optimisation of target code (Peephole optimisation)

Method of Instruction

Lecture presentations, problem classes, lab classes.

Assessment

The course has the following assessment components:

  • Written Examination (2.5 hours, 80%);
  • Coursework Section (20%).

To pass this course, students must:

  • Obtain an overall pass mark of 40% for all components combined;
  • Obtain a minimum mark of 30% in each component worth ? 30% of the module as a whole.

Resources

Reading list available via the UCL Library catalogue.