Skip to main content
KBS_Icon_questionmark link-ico

Compilers And Formal Languages

Key information

  • Module code:

    6CCS3CFL

  • Level:

    6

  • Semester:

      Autumn

  • Credit value:

    15

Module description

Aims and Learning Outcomes

To explain the techniques behind compilers, lexers and parsers. To introduce the mathematical formalisms of regular expressions, context-free grammars, and to show their applications to computer languages. To generate code for low level machine languages and to illustrate compiler techniques.

On successful completion of this module, students will:

Have learned:

  • How to use regular expressions for lexing programs and data.
  • How to design grammars for parsing programs.
  • How to implement a parser and an interpreter.
  • How to implement a compiler.

Be able to:

  • Implement the central components of a small compiler (including lexer, parser and code-generator).

Syllabus

An indication of the types of topics:

  1. Formal languages
  • alphabets, strings, languages
  • mathematical background, sets and relations, proofs
  1. Regular expressions
  • regular expression matching
  • derivatives of regular expressions
  • lexing and token generation
  1. Finite Automata
  • Deterministic Finite Automata (DFA)
  • Non-Deterministic Finite Automata (NFA)
  • equivalence of DFA, NFA and regular expressions
  1. Parsing Techniques
  • context-free grammars
  • parser combinators
  1. Interpreters and Compilers:
  • code generation for the WHILE-language
  • compilation to the Java Virtual Machine and the LLVM-IR
  • compiling a functional language
  • compiler optimisation techniques

Assessment details

2024/25 academic year may be updated. The confirmed details will be available on the Student Handbook and on the module KEATS page at the beginning of the semester.

  • 100% Examination

Semester 1 only study abroad students will be required to take this exam in an alternative assessment format in the January exam period.

Full year study abroad students will be required to take this exam in person in January.

Module description disclaimer

King’s College London reviews the modules offered on a regular basis to provide up-to-date, innovative and relevant programmes of study. Therefore, modules offered may change. We suggest you keep an eye on the course finder on our website for updates.

Please note that modules with a practical component will be capped due to educational requirements, which may mean that we cannot guarantee a place to all students who elect to study this module.

Please note that the module descriptions above are related to the current academic year and are subject to change.