Module Code - Title:
CE4717
-
LANGUAGE PROCESSORS
Year Last Offered:
2025/6
Hours Per Week:
Grading Type:
N
Prerequisite Modules:
CE4703
Rationale and Purpose of the Module:
To introduce the theory of compiler design and show its application in a simple compiler. An important part of the module is the implementation of a compiler for a simple, Pascal-like, language.
Syllabus:
Compiler structure: Definition of terms. Source, object and executable files. Symbols, definition and resolution. Phases of a compiler and their functions. Single and multi-pass compilation. Cross-compilation, interpreters and pseudo-machines.
Grammars: Mathematical grammars for language definition. BNF and EBNF notations. Parse trees. Properties of grammars. The Chomsky hierarchy. Syntax diagrams. Restrictions on grammars.
Parsing: Top-down parsing. Lookahead. Recursive descent. LL(l) grammars. First, follow and predict sets.
Syntactic error detection and recovery for recursive descent parsers.
Semantic processing: The symbol table. Handling semantic errors.
Code generation for a simple stack machine: Translation of expressions to reverse-Polish form. Procedure calls and block structure. Static and dynamic scope. Storage management for modern languages.
Scanning: Regular expressions. State machine implementation. Nondeterministic automata and translation to deterministic automata. The use of a scanner generator such as LEX.
Table-driven parsing techniques:
LL(l) table-driven parsers. Shift-reduce parsers. LR parsing. The LR(0) Characteristic Finite State Machine. LR(l). SLR. LALR(l). The use of a parser generator such as yacc.
Code generation for register architectures. Introduction to code optimisation techniques.
Learning Outcomes:
Cognitive (Knowledge, Understanding, Application, Analysis, Evaluation, Synthesis)
1. Describe the structure, phases, major data structures and algorithms of a compiler.
2. Given a formal EBNF grammar for a computer language, construct a parser program for that language.
3. Given examples of syntactic structures, design appropriate formal grammar constructs describing them.
4. Analyse a grammar in terms of the LL(1), LR(0), SLR &LALR(1) criteria.
5. Create (by hand) scanning and parsing automata for simple grammars.
6. Use scanner and parser synthesis tools such as lex and yacc.
7. Construct a compiler for a simple computer language.
Affective (Attitudes and Values)
None
Psychomotor (Physical Skills)
None
How the Module will be Taught and what will be the Learning Experiences of the Students:
Lectures/Labs
Research Findings Incorporated in to the Syllabus (If Relevant):
Prime Texts:
Terry, P. (2005)
Compiling with C# and Java
, Pearson
Appel, A.W. (2002)
Modern Compiler Implementation in Java
, Cambridge
Other Relevant Texts:
Aho, A.V., Lam, M.S., Sethi, R. & Ullman, J.D. (2007)
Compilers: Principles, Techniques, & Tools, 2nd ed.
, Pearson
Parr, T. (2007)
The Definitive ANTLR Reference
, Pragmatic Bookshelf
Cooper, K.D. & L. Torczon (2004)
Engineering a Compiler
, Morgan Kaufmann
Grune, D., H.E. Bal, C.J.H. Jacobs & K.G. Langendoen (2001)
Modern Compiler Design
, Wiley
Waite, W.M. & L.R. Carter (1993)
An Introduction to Compiler Construction
, Harper Collins
Holub, A.I. (1990)
Compiler Design in C
, Prentice Hall
Programme(s) in which this Module is Offered:
Semester(s) Module is Offered:
Module Leader:
Colin.Flanagan@ul.ie