Skip to main content
Till KTH:s startsida

ID2202 Compilers and Execution Environments 7.5 credits

Welcome to the course in Compilers and Execution Environments!

In this course, you will learn how a compiler works. You will learn about compiler theory, for instance regular expressions, parsing theory, optimization algorithms, code generation strategies, garbage collection, and more. Moreover, you will gain significant practical experience in designing and implementing a complete compiler from scratch. You will develop a compiler for a rather small language called Cigrid, which is a subset of C/C++, specifically designed for teaching. Your compiler will compile into x86 assembly code, such that you can benchmark your optimization strategies against a state-of-the-art compiler, such as GCC or Clang. 

The course is given each fall during period 2 (October to December).

For details, please see the course homepage:

https://canvas.kth.se/courses/42986

 

 

Information per course offering

Choose semester and course offering to see current information and more about the course, such as course syllabus, study period, and application information.

Termin

Course syllabus as PDF

Please note: all information from the Course syllabus is available on this page in an accessible format.

Course syllabus ID2202 (Autumn 2021–)
Headings with content from the Course syllabus ID2202 (Autumn 2021–) are denoted with an asterisk ( )

Content and learning outcomes

Course contents

The course covers technologies for implementation of programming languages by means of compilers, both for real and virtual execution environments, technologies to read, understand, translate, improve as well as execute programs:

  • To read programs: lexical analysis and syntax analysis. Finite state machines, regular expression context free grammars, LL and LR-parsing.
  • To understand programs: semantic analysis, type checking.
  • To translate programs: machines and instructions.
  • Intermediary code, choice of instructions, conventions for procedure calls.
  • To improve programs: machine independent optimisations; computer-oriented optimisations (register allocation, scheduling of instructions).
  • To execute programs: virtual execution environments and runtime systems. Memory management, garbage collection, to load and link programs, just-in-time compilation.

Intended learning outcomes

After passing the course, the student shall be able to

  • use methods for lexical, syntactic and semantic analysis
  • use methods for generation of machine code
  • use methods for optimizing programs
  • give an account of common components in execution environments

in order to

  • obtain an understanding of how a programming language is implemented as well as for the general theories that are used and how these can be applied.

For higher grades, the student should design more complex components of a compiler. The details are specified in the course memo.

Literature and preparations

Specific prerequisites

Knowledge in basic computer engineering/architecture, 7.5 higher education credits, equivalent to completed course IS1200/IS1500.

Knowledge in algorithms and data structures, 7.5 higher education credits, equivalent to completed course ID1020/ID1021.

Active participation in a course offering where the final examination is not yet reported in LADOK is considered equivalent to completion of the course. Registering for a course is counted as active participation. The term 'final examination' encompasses both the regular examination and the first re-examination.

Recommended prerequisites

Very good programming experience in one or more high-level languages.
ID1019 Programming II or corresponding course. 

Equipment

No information inserted

Literature

Information on course literature is given in the course PM.

Examination and completion

If the course is discontinued, students may request to be examined during the following two academic years.

Grading scale

A, B, C, D, E, FX, F

Examination

  • DAT1 - Computer based exam, 7.5 credits, grading scale: A, B, C, D, E, FX, F

Based on recommendation from KTH’s coordinator for disabilities, the examiner will decide how to adapt an examination for students with documented disability.

The examiner may apply another examination format when re-examining individual students.

Opportunity to complete the requirements via supplementary examination

No information inserted

Opportunity to raise an approved grade via renewed examination

No information inserted

Examiner

Ethical approach

  • All members of a group are responsible for the group's work.
  • In any assessment, every student shall honestly disclose any help received and sources used.
  • In an oral assessment, every student shall be able to present and answer questions about the entire assignment and solution.

Further information

Course room in Canvas

Registered students find further information about the implementation of the course in the course room in Canvas. A link to the course room can be found under the tab Studies in the Personal menu at the start of the course.

Offered by

Main field of study

Computer Science and Engineering

Education cycle

Second cycle

Add-on studies

No information inserted

Transitional regulations

For students who have been registered in the course during autumn term 2019 or earlier and have either TEN1 or INL1 reported in the National Student Record Base (LADOK) are offered oral examination of the other course component (either TEN1 or INL1) up until and including the spring term 2021. If the student wants such an examination, they must contact the examiner via email latest final May 2021. Oral examination is not offered for students who have been registered in the course during 2019 or earlier, and who do not have any of the items reported in the National Student Record Base (LADOK).

Supplementary information

In this course, the EECS code of honor applies, see: http://www.kth.se/en/eecs/utbildning/hederskodex.