Before choosing courseID2202 Compilers and Execution Environments 7.5 creditsAdministrate About course

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/19990

Choose semester and course offering

Choose semester and course offering to see information from the correct course syllabus and course offering.

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 should 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.

Course Disposition

No information inserted

Literature and preparations

Specific prerequisites *

  • Completed course in basic computer engineering/architecture equivalent to IS1200 Computer Hardware Engineering.
  • Completed course in algorithms and data structures corresponding to ID1020.

Active participation in a course offering where the final examination is not yet reported in LADOK is considered equivalent to completion of the course. This applies only to students who are first-time registered for the prerequisite course offering or have both that and the applied-for course offering in their individual study plan.

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

David Broman

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 web

Further information about the course can be found on the Course web at the link below. Information on the Course web will later be moved to this site.

Course web ID2202

Offered by

EECS/Computer Science

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.