Module overview
The aim of this module is to expose students to ways of representing an transforming programs and other languages. This include the definition of languages through grammars and the parsing languages into data-structures. The module then explores the ideas of translating between languages, and mapping domain-specific languages to different backends (as seen in many AI tool-chains). The course also covers the step of compiling down from high-level representations to instructions, ensuring students understanding the complete lowering process.
Aims and Objectives
Learning Outcomes
Subject Specific Intellectual and Research Skills
Having successfully completed this module you will be able to:
- Design ASTs to capture a target language or DSL
- Construct grammars to parse existing languages
- Develop AST re-writing algorithms to transform and optimise code
Subject Specific Practical Skills
Having successfully completed this module you will be able to:
- Create a source-to-source code translator
- Create a compiler from an existing imperative language to a given instruction set
- Develop test and verification infrastructure to support development and optimisation
- Implement a parser for a context-free language
Knowledge and Understanding
Having successfully completed this module, you will be able to demonstrate knowledge and understanding of:
- Explain how high-level language constructs are lowered into instruction sequences
- Identify the advantages and disadvantages of compiler, interpreted, and embedded languages.
- Describe common compiler optimisations and predict how it might affect high-level code.
- Theory of grammars and parsing automata
Syllabus
Languages:
-Grammars (follows on from RegEx in yr1)
-Parsers
-ASTs
Language processors:
-Interpreters
-Transformers (source to source)
-DSLs and Metaprogramming
Compilation:
- Mapping expression evaluation into instructions
- Converting control-flow statements into instructions
-Functions, stacks, and frames
Modern compilers:
-Optimisation
-Register allocation
- Intermediate Representations
-Basic Blocks & SSA
Learning and Teaching
Teaching and learning methods
- Lectures
- Guided self-study
- Computing labs
Type | Hours |
---|---|
Lecture | 32 |
Independent Study | 28 |
Specialist Laboratory | 10 |
Completion of assessment task | 80 |
Total study time | 150 |
Assessment
Summative
This is how we’ll formally assess what you have learned in this module.
Method | Percentage contribution |
---|---|
Exam | 30% |
Coursework | 70% |
Referral
This is how we’ll assess you if you don’t meet the criteria to pass this module.
Method | Percentage contribution |
---|---|
Coursework | 70% |
Exam | 30% |
Repeat
An internal repeat is where you take all of your modules again, including any you passed. An external repeat is where you only re-take the modules you failed.
Method | Percentage contribution |
---|---|
Exam | 30% |
Coursework | 70% |