Skip to main content

DD2557 Program Semantics and Analysis 7.5 credits

To give a semantics for a programming language means to give a precise definition of the behaviour of programs written in this language. Once the semantics of the language has been described formally, one can go about and prove various language properties like determinism, prove correctness of program implementations based on abstract machines, justify various program analyses used in syntax-oriented editors and program transformations used in optimising compilers, and specify and prove correctness of concrete programs. This provides the formal basis for a variety of software tools for program analysis, optimisation and verification.

Choose semester and 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.


For course offering

Spring 2025 semant25 programme students

Application code


Headings with content from the Course syllabus DD2557 (Spring 2023–) are denoted with an asterisk ( )

Content and learning outcomes

Course contents

Part I. Operational semantics and language implementation: natural semantics, structural operational semantics, abstract machines, correctness of language implementation.

Part II. Denotational semantics and program analysis: denotational semantics, fixed point theory, abstract interpretation, program analysis and program transformation.

Part III. Axiomatic semantics and program verification: axiomatic semantics, program specification and verification, weakest preconditions, verification condition generation.

Intended learning outcomes

After passing the course, the student should be able to

  • construct the state space of a program as a basis for program behaviour analysis
  • translate programs to abstract machine code and execute it
  • compute the denotation of a program
  • extend a programming language with new language features, and extend its semantics and abstract machine implementations accordingly
  • suggest and justify program transformations supported by an appropriate program analysis
  • specify and verify programs in Hoare logic
  • generate verification conditions of a given program and specification
  • relate different semantic styles formally 
  • prove language properties such as determinism and termination formally 
  • prove the correctness of a given program transformation by showing equivalence between the original program and the transformed program formally
  • show properties of a given semantics formally.

Literature and preparations

Specific prerequisites

Knowledge and skills in programming, 5 credits, equivalent to completed course DD1337/DD1310-DD1318/DD1321/DD1331/DD100N/ID1018.

Knowledge in basic computer science, 6 credits, equivalent to completed course DD2325/DD1320/DD1325/DD1327/DD2325/ID1020/ID1021.

Knowledge in discrete mathematics, 6 higher education credits, equivalent to completed course SF1688/SF1610/SF1630/SF1662/SF1679.

Recommended prerequisites

No information inserted


No information inserted


No information inserted

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


  • HEM1 - Home assignments, 2.5 credits, grading scale: P, F
  • LAB1 - Laboratory work, 2.5 credits, grading scale: P, F
  • TEN1 - Home exam, 2.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


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

Supplementary information

In this course, the EECS code of honor applies, see: