Difference between revisions of "BSc: Advanced Compilers Construction and Program Analysis"
m (M.petrishchev moved page BSc:AdvancedCompilersConstructionandProgramAnalysis.S22 to BSc:AdvancedCompilersConstructionandProgramAnalysis) |
|||
(44 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | |||
= Advanced Compilers Construction and Program Analysis = |
= Advanced Compilers Construction and Program Analysis = |
||
+ | * '''Course name''': Advanced Compilers Construction and Program Analysis |
||
+ | * '''Code discipline''': XYZ |
||
+ | * '''Subject area''': Programming Languages and Software Engineering |
||
+ | == Short Description == |
||
− | * <span>'''Course name:'''</span> Advanced Compilers Construction and Program Analysis |
||
+ | This course covers the following concepts: Advanced Compilers Construction and Program Analysis concepts: |
||
− | * <span>'''Course number:'''</span> XYZ |
||
− | * <span>'''Knowledge area:'''</span> xxx |
||
− | == Course characteristics == |
||
− | + | Key concepts of the class |
|
+ | * Type Systems |
||
+ | * Lambda calculi as the core representation |
||
+ | * Type checking and type inference |
||
+ | * Simple types and derived forms |
||
+ | * Subtyping |
||
+ | * Imperative objects |
||
+ | * Recursive types |
||
+ | * Universal polymorphism |
||
+ | * Compiling lazy functional languages |
||
+ | == Prerequisites == |
||
− | * Advanced Compilers Construction and Program Analysis concepts: |
||
+ | === Prerequisite subjects === |
||
− | === What is the purpose of this course? === |
||
− | Advanced Compilers Construction and Program Analysis have become |
||
− | === |
+ | === Prerequisite topics === |
− | ==== What should a student remember at the end of the course? ==== |
||
+ | == Course Topics == |
||
− | By the end of the course, the students should be able to recognize and define |
||
+ | {| class="wikitable" |
||
+ | |+ Course Sections and Topics |
||
+ | |- |
||
+ | ! Section !! Topics within the section |
||
+ | |- |
||
+ | | Introduction to subject, computer networks basics, transport layer protocols, and socket programming || |
||
+ | # General introduction to the course |
||
+ | # Computer networks basic |
||
+ | # Socket programming |
||
+ | # UDP socket programming |
||
+ | # TCP socket programming |
||
+ | |- |
||
+ | | || |
||
+ | |- |
||
− | * |
||
+ | | Coordination, consistency, and replication in distributed systems || |
||
− | * |
||
− | * |
||
− | * |
||
− | * |
||
+ | |- |
||
− | ==== What should a student be able to understand at the end of the course? ==== |
||
+ | | Fault tolerance and security in distributed systems || |
||
− | |||
− | By the end of the course, the students should be able to describe and explain (with examples) |
||
+ | |} |
||
− | * |
||
− | * |
||
− | * |
||
− | * |
||
− | * |
||
− | * |
||
− | |||
− | ==== What should a student be able to apply at the end of the course? ==== |
||
− | |||
− | By the end of the course, the students should be able to apply |
||
− | |||
− | * |
||
− | * |
||
− | * |
||
− | * |
||
− | * |
||
− | |||
− | === Course evaluation === |
||
+ | Course Sections |
||
− | <div id="tab:OSCourseGradingRange"> |
||
+ | {| class="wikitable" |
||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
+ | |+ The main sections of the course and approximate hour distribution between |
||
− | |+ Course grade breakdown |
||
+ | them is as follows: |
||
− | !align="center"| '''Component''' |
||
− | ! '''Points''' |
||
|- |
|- |
||
+ | ! Section Title !! Lecture Hours !! Seminars (labs) !! Selfstudy !! Knowledge evaluation |
||
− | | Laboratory assignments |
||
− | |align="right"| 55% |
||
|- |
|- |
||
+ | | Lambda Calculus and Simple Types|| 10 || 10 || 10 || 2 |
||
− | | Final exam |
||
− | |align="right"| 35% |
||
|- |
|- |
||
+ | | References, Exceptions, Imperative Objects, Featheweight Java || 8 || 8 || 8 || 1 |
||
− | | Attendance |
||
+ | |- |
||
− | |align="right"| 10% |
||
+ | | Recursive Types, Type Reconstruction, Universal Polymorphism || 6 || 6 || 6 || 1 |
||
+ | |- |
||
+ | | Compiling Lazy Functional Languages || 8 || 8 || 8 || 1 |
||
+ | |- |
||
+ | | Project Presentation || || || || 2 |
||
|} |
|} |
||
− | '''Important:''' In order to successfully finish the course, the student is required to score at least 50% in final exam. |
||
− | </div> |
||
+ | Section 1 |
||
− | === Grades range === |
||
+ | Section title: Lambda calculus and simple types |
||
+ | Topics covered in this section: |
||
− | <div id="tab:OSCourseGradingRange"> |
||
+ | * The history of typed languages. Type systems and language design. |
||
+ | * Basic notions: untyped lambda calculus, nameless representation, simple types. |
||
+ | {| class="wikitable" |
||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
+ | |+ |
||
− | |+ Course grading range |
||
+ | ! Form of evaluation !! Usage!! |
||
|- |
|- |
||
+ | | Development of individual parts of software product code || 1 || |
||
− | | A. Excellent |
||
− | |align="right"| 90-100 |
||
|- |
|- |
||
+ | | Homework and group projects || 1 || |
||
− | | B. Good |
||
− | |align="right"| 75-89 |
||
|- |
|- |
||
+ | | Midterm evaluation || 0 || |
||
− | | C. Satisfactory |
||
− | |align="right"| 60-74 |
||
|- |
|- |
||
+ | | Testing (written or computer based) || 0 || |
||
− | | D. Poor |
||
+ | |- |
||
− | |align="right"| 0-59 |
||
+ | | Reports || 1 || |
||
+ | |- |
||
+ | | Essays || 0 || |
||
+ | |- |
||
+ | | Oral polls || 1 || |
||
+ | |- |
||
+ | | Discussions || 1 || |
||
|} |
|} |
||
− | </div> |
||
+ | Typical questions for ongoing performance evaluation within this section |
||
+ | * What is the role of the type system in language design? |
||
+ | * How to evaluate lambda terms using call-by-name/call-by-value strategies? |
||
+ | * What is the typing relation? |
||
+ | * What is type safety? |
||
+ | * What is erasure of types? |
||
+ | * What is general recursion? |
||
+ | Typical questions for seminar classes (labs) within this section |
||
− | === Resources and reference material === |
||
+ | * Evaluate a given lambda expression using call-by-name strategy. |
||
− | * '''Textbook:'''. Available online: |
||
+ | * Convert a given lambda expression to/from a nameless representation. |
||
− | * '''Reference:'''. Available online: |
||
+ | * Draw a type derivation tree for a given lambda term in simply typed lambda calculus. |
||
− | * '''Reference:'''. Available online: h |
||
+ | * Provide a type for a given lambda term in a given simple type system. |
||
+ | Test questions for final assessment in this section |
||
+ | * Present an implementation of an interpreter for untyped lambda calculus. |
||
+ | * Present an implementation of a type checker for simply typed lambda |
||
+ | calculus. |
||
− | == Course Sections == |
||
+ | Section 2 |
||
− | The course is organized in 8 weeks, with every weeks 4 academics hours of lectures and 4 academic hours of tutorials/labs. The main sections of the course and approximate hour distribution between them is as follows: |
||
+ | Section title: References, exceptions, imperative objects, Featherweight Java |
||
− | <div id="tab:OSCourseSections"> |
||
+ | Topics covered in this section: |
||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
+ | * References, store typings, raising and handling exceptions |
||
− | |+ Course Sections |
||
+ | * Subsumption and the subtyping relation, coercion semantics, the Bottom Type |
||
− | !align="center"| '''Section''' |
||
+ | * Object-oriented programming and lambda calculus with imperative objects |
||
− | ! '''Section Title''' |
||
+ | * Featherweight Java |
||
− | !align="center"| '''Teaching Hours''' |
||
+ | |||
+ | |||
+ | {| class="wikitable" |
||
+ | |+ |
||
+ | |- |
||
+ | ! Form of evaluation !! Usage!! |
||
+ | |- |
||
+ | | Development of individual parts of software product code|| 1 || |
||
+ | |- |
||
+ | | Homework and group projects|| 1 || |
||
+ | |- |
||
+ | | Midterm evaluation|| 1 || |
||
+ | |- |
||
+ | | Testing (written or computer based) || 0 || |
||
|- |
|- |
||
+ | | Reports|| 1 || |
||
− | |align="center"| 1 |
||
− | | Introduction to subject, computer networks basics, transport layer protocols, and socket programming |
||
− | |align="center"| 12 |
||
|- |
|- |
||
+ | | Essays|| 0 || |
||
− | |align="center"| 2 |
||
− | | Multithreaded socket programming, remote procedure calls, and distributed system architecture |
||
− | |align="center"| 24 |
||
|- |
|- |
||
+ | | Oral polls|| 1 || |
||
− | |align="center"| 3 |
||
− | | Coordination, consistency, and replication in distributed systems |
||
− | |align="center"| 24 |
||
|- |
|- |
||
+ | | Discussions|| 1 || |
||
− | |align="center"| 4 |
||
− | | Fault tolerance and security in distributed systems |
||
− | |align="center"| 30 |
||
|} |
|} |
||
− | </div> |
||
− | === Section 1: === |
||
+ | Typical questions for ongoing performance evaluation within this section |
||
− | ==== Section title ==== |
||
+ | * How operational semantic changes when introducing references? |
||
+ | * How operational semantic changes when introducing exceptions? |
||
+ | * What is the concept of imperative objects? |
||
+ | * What are the features of Featherweight Java? |
||
+ | * Explain effects of call-by-name and call-by-value evaluation strategies on terms with references. |
||
+ | Typical questions for seminar classes (labs) within this section |
||
− | Introduction to subject, computer networks basics, transport layer protocols, and socket programming |
||
+ | * Evaluate given expression with references. |
||
+ | * Evaluate given expression with exceptions. |
||
+ | * Draw a type derivation tree for a given lambda term in simply typed |
||
+ | lambda calculus with references and exceptions. |
||
+ | * Provide a type for a given lambda term in a given simple type system with references and exceptions. |
||
− | + | Test questions for final assessment in this section |
|
+ | * Present and/or explain an implementation of an interpreter for lambda calculus with references and exceptions. |
||
+ | * Present and/or explain an implementation of a type checker for simply typed lambda calculus with references and exceptions. |
||
− | * General introduction to the course |
||
− | * Computer networks basic |
||
− | * Socket programming |
||
− | * UDP socket programming |
||
− | * TCP socket programming |
||
+ | Section 3 |
||
− | ==== What forms of evaluation were used to test students’ performance in this section? ==== |
||
+ | Section title: Recursive types, type reconstruction, universal polymorphism |
||
+ | What forms of evaluation were used to test students’ performance in |
||
− | <div id="tab:OSSectionEval1"> |
||
+ | this section? |
||
+ | {| class="wikitable" |
||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
− | | |
+ | |+ Form of evaluation |
− | ! '''Yes/No''' |
||
|- |
|- |
||
+ | ! Form of evaluation !! Usage!! |
||
− | | Development of individual parts of software product code |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Development of individual parts of software product code|| 1 || |
||
− | | Homework and group projects |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Homework and group projects|| 1 || |
||
− | | Midterm evaluation |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Midterm evaluation|| 0 || |
||
− | | Testing (written or computer based) |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Testing (written or computer based) || 0 || |
||
− | | Reports |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Reports|| 1 || |
||
− | | Essays |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Essays|| 0 || |
||
− | | Oral polls |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Oral polls|| 1 || |
||
− | | Discussions |
||
+ | |- |
||
− | |align="center"| 1 |
||
+ | | Form of evaluation || Usage || |
||
+ | |- |
||
+ | | Discussions|| 1 || |
||
|} |
|} |
||
− | </div> |
||
− | |||
− | ==== Typical questions for ongoing performance evaluation within this section ==== |
||
− | |||
− | #? |
||
− | #. |
||
− | #? |
||
− | #? |
||
− | #? |
||
− | #? |
||
− | #? |
||
− | |||
− | ==== Typical questions for seminar classes (labs) within this section ==== |
||
− | |||
− | # |
||
− | # |
||
− | # |
||
− | # |
||
− | # |
||
− | + | Topics covered in this section: |
|
+ | * Recursive types, induction and coinduction, finite and infinite types |
||
+ | * Polymorphism, type reconstruction, universal types |
||
+ | * System F and Hindley-Milner type system |
||
+ | Typical questions for ongoing performance evaluation within this section |
||
− | # ? |
||
+ | * What is the concept of recursive types? |
||
− | #? |
||
+ | * What is the motivation for universal types? |
||
− | #? |
||
+ | * Explain the differences between System F and Hindley-Milner type system. |
||
− | #? |
||
+ | Typical questions for seminar classes (labs) within this section |
||
− | === Section 2: === |
||
+ | * Evaluate given expression in System F with recursive types. |
||
+ | * Draw a type derivation tree for a given term in System F. |
||
+ | * Provide a type for a given term in System F. |
||
+ | Test questions for final assessment in this section |
||
− | ==== Section title ==== |
||
+ | * Present and/or explain an implementation of an interpreter for lambda calculus with references and exceptions. |
||
+ | * Present and/or explain an implementation of a type checker for simply typed lambda calculus with references and exceptions. |
||
+ | * Present and/or explain the Hindley-Milner type inference algorithm. |
||
+ | Section 4 |
||
− | ==== Topics covered in this section ==== |
||
+ | Section title: Compiling lazy functional languages |
||
+ | Topics covered in this section: |
||
− | * |
||
+ | * Challenges of compiling lazy functional languages |
||
− | * |
||
+ | * Representing functional closures at run-time |
||
− | * |
||
+ | * Representing lazy data structures at run-time |
||
+ | * The syntax and semantics of the STG language |
||
− | + | What forms of evaluation were used to test students’ performance in |
|
+ | this section? |
||
+ | {| class="wikitable" |
||
− | <div id="tab:OSSectionEval1"> |
||
+ | |+ Form of evaluation |
||
− | |||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
− | |''' Form ''' |
||
− | ! '''Yes/No''' |
||
|- |
|- |
||
+ | ! Form of evaluation !! Usage!! |
||
− | | Development of individual parts of software product code |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Development of individual parts of software product code|| 1 || |
||
− | | Homework and group projects |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Homework and group projects|| 1 || |
||
− | | Midterm evaluation |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Midterm evaluation|| 0 || |
||
− | | Testing (written or computer based) |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Testing (written or computer based) || 0 || |
||
− | | Reports |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Reports|| 1 || |
||
− | | Essays |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Essays|| 0 || |
||
− | | Oral polls |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Oral polls|| 1 || |
||
− | | Discussions |
||
+ | |- |
||
− | |align="center"| 1 |
||
+ | | Form of evaluation || Usage || |
||
+ | |- |
||
+ | | Discussions|| 1 || |
||
|} |
|} |
||
− | </div> |
||
+ | Typical questions for ongoing performance evaluation within this section |
||
+ | * How are closures represented during run-time? |
||
+ | * How are lazy data structures represented during run-time? |
||
+ | * Describe the main constructions of the STG Language? |
||
− | + | Typical questions for seminar classes (labs) within this section |
|
+ | * Explain how a given term in STG language evaluates. |
||
− | #? |
||
+ | * Translate a given lambda term into STG language |
||
− | #? |
||
− | #? |
||
− | #? |
||
− | #? |
||
+ | Test questions for final assessment in this section |
||
− | |||
+ | * Present and/or explain the STG machine. |
||
− | ==== Typical questions for seminar classes (labs) within this section ==== |
||
+ | * Present an implementation of a type checker for simply typed lambda |
||
+ | calculus. |
||
+ | == Intended Learning Outcomes (ILOs) == |
||
− | # You have a list of large numbers, and you need to find if they are prime or not. Would you use multithreading, multiprocessing, or sequential programming in order to complete the task asap? Prove it in practice. |
||
− | # You need to send multiple requests to a server and receive responses. Assume there is a few msecs of delay before you receive the response from the server. Would you use multithreading, multiprocessing, or sequential programming in order to complete the task asap? Prove it in practice. (Order of the requests/responses doesn't matter) |
||
− | # Discuss two ways of creating the threads using threading module in Python: 1) passing the worker function as a target, 2) subclassing the Thread class |
||
− | # Given the function implemented locally, make it available to be called through RPC from remote process? Use xmlRPC. |
||
− | + | === What is the main purpose of this course? === |
|
+ | This course partially covers two major topics: |
||
+ | 1. Theory and Implementation of Typed Programming Languages and |
||
+ | 2. Compilation of Lazy Functional Languages. |
||
+ | We will study different type system features in detail, starting from an untyped language of lambda calculus and gradually adding new types and variations along the way. The course assumes familiarity with basics of compiler construction, basics of functional programming and familiarity with some static type systems (C++ and Java would suffice, but knowing type systems of Haskell or Scala will help). |
||
+ | Even though the most obvious benefit of static type systems is that it allows programmers to detect some errors early, it is by far not the only application. Types are used also as a tool for abstraction, documentation, language safety, efficiency and more. In this course we will look at features of type systems occurring in many programming languages, like C++, Java, Scala and Haskell. |
||
+ | After we have reached System F, a type system at the core of languages like Haskell, we will look into how lazy functional languages are implemented. We will in particular look in detail at Spineless Tagless Graph reduction machine (also known as STG machine) that is used to compile Haskell code. |
||
+ | Evaluation of the course consists of Lecture Quizzes, Lab Participation and the Final Project (split into several stages). The Final Project is a team project where students build a complete interpreter or compiler for a statically typed programming language, incorporating some of the features covered in this course. |
||
− | #. |
||
− | # ? |
||
− | # ? |
||
− | # ? |
||
− | # ? |
||
− | # |
||
+ | = Course Objectives Based on Bloom’s Taxonomy = |
||
+ | What should a student remember at the end of the course? |
||
+ | * Remember syntax and computation rules of untyped lambda calculus. |
||
+ | * Remember nameless representation of lambda terms. |
||
+ | * Remember definition of normal form, weak head normal form. |
||
+ | * Remember syntax, typing and computation rules of simply typed lambda calculus. |
||
+ | * Remember definition of imperative objects. |
||
+ | * Remember syntax and semantics of Featherweight Java. |
||
+ | * Remember typing rules for subtyping. |
||
+ | * Remember typing rules for pairs, tuples, records, sums, variants, and lists. |
||
+ | * Remember typing rules for let-bindings and type ascription. |
||
+ | * Remember typing rules for recursive types. |
||
+ | * Remember definition and typing rules for universal polymorphism. |
||
+ | * Remember syntax, typing and computation rules for System F. |
||
+ | * Remember representation of closures when compiling functional languages. |
||
+ | * Remember representation of lazy data structures when compiling. |
||
+ | * Remember the syntax and semantics of the STG language. |
||
+ | What should a student be able to understand at the end of the course? |
||
+ | * Understand how type systems relate to language design |
||
− | === Section 3: Coordination, consistency, and replication in distributed systems === |
||
+ | * Understand differences between call-by-name, call-by-need, and call-byvalue evaluation strategies. |
||
+ | * Understand the tradeoffs introduced by various type system features. |
||
+ | * Understand the idea of nameless representation of terms. |
||
+ | * Understand the tradeoffs of mutable references and exceptions introduced in a language. |
||
+ | * Understand how imperative objects model objects in modern objectoriented langauges. |
||
+ | * Understand the difficulties of compiling lazy expressions. |
||
+ | * Understand the differences between Hindley–Milner type system and System F. |
||
+ | What should a student be able to apply at the end of the course? |
||
− | ==== Section title ==== |
||
+ | * Implement an interpreter for a programming language with untyped lambda calculus as its core representation. |
||
− | Coordination, consistency, and replication in distributed systems |
||
+ | * Implement an interpreter for a programming language with simply typed lambda calculus as its core representation. |
||
+ | * Implement type checking algorithm for a language with simple types, recursive types, imperative objects, and universal polymorphism. |
||
+ | * Implement Damas–Hindley–Milner type inference algorithm for a programming language with a Hindley-Milner style type system. |
||
+ | Course evaluation: |
||
− | ==== Topics covered in this section ==== |
||
+ | * Labs/seminar classes (proposed points: 20) |
||
− | * |
||
+ | * Interim performance assessment (proposed points: 10) |
||
− | * |
||
+ | * Exams (proposed points: 70) |
||
− | * |
||
− | * |
||
+ | === ILOs defined at three levels === |
||
− | ==== What forms of evaluation were used to test students’ performance in this section? ==== |
||
+ | ==== Level 1: What concepts should a student know/remember/explain? ==== |
||
− | <div id="tab:OSSectionEval1"> |
||
+ | By the end of the course, the students should be able to ... |
||
+ | |||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
+ | ==== Level 2: What basic practical skills should a student be able to perform? ==== |
||
− | |''' Form ''' |
||
+ | By the end of the course, the students should be able to ... |
||
− | ! '''Yes/No''' |
||
+ | |||
+ | |||
+ | ==== Level 3: What complex comprehensive skills should a student be able to apply in real-life scenarios? ==== |
||
+ | By the end of the course, the students should be able to ... |
||
+ | |||
+ | == Grading == |
||
+ | |||
+ | === Course grading range === |
||
+ | {| class="wikitable" |
||
+ | |+ |
||
|- |
|- |
||
+ | ! Grade !! Range !! Description of performance |
||
− | | Development of individual parts of software product code |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | A. Excellent || 85-100 || - |
||
− | | Homework and group projects |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | B. Good || 75-84 || - |
||
− | | Midterm evaluation |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | C. Satisfactory || 60-74 || - |
||
− | | Testing (written or computer based) |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | D. Poor || 0-59 || - |
||
− | | Reports |
||
+ | |} |
||
− | |align="center"| 0 |
||
+ | |||
+ | === Course activities and grading breakdown === |
||
+ | {| class="wikitable" |
||
+ | |+ |
||
|- |
|- |
||
+ | ! Activity Type !! Percentage of the overall course grade |
||
− | | Essays |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Laboratory assignments || 55% |
||
− | | Oral polls |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Final exam || 35% |
||
− | | Discussions |
||
+ | |- |
||
− | |align="center"| 1 |
||
+ | | Attendance || 10% |
||
|} |
|} |
||
+ | === Recommendations for students on how to succeed in the course === |
||
− | </div> |
||
+ | == Resources, literature and reference materials == |
||
− | ==== Typical questions for ongoing performance evaluation within this section ==== |
||
+ | === Open access resources === |
||
− | #? |
||
+ | * Textbook:. Available online: |
||
− | #? |
||
+ | * Reference:. Available online: |
||
− | #? |
||
+ | * Reference:. Available online: |
||
− | #? |
||
− | #? |
||
− | |||
− | ==== Typical questions for seminar classes (labs) within this section ==== |
||
+ | === Closed access resources === |
||
− | # |
||
− | # |
||
− | # |
||
− | # |
||
− | ==== Test questions for final assessment in this section ==== |
||
+ | === Software and tools used within the course === |
||
− | # |
||
− | # |
||
− | # |
||
− | # |
||
+ | === Resources and reference material === |
||
− | === Section 4: Fault tolerance and security in distributed systems === |
||
+ | * Benjamin C. Pierce. ’‘Types and Programming Languages. The MIT Press 2002” |
||
+ | * Simon Peyton Jones. ’‘Implementing functional languages: a tutorial. Prentice Hall 1992” |
||
+ | * Simon Peyton Jones. ’‘Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-machine. Journal of Functional Programming 1992” |
||
+ | = Teaching Methodology: Methods, techniques, & activities = |
||
− | ==== Section title ==== |
||
+ | == Activities and Teaching Methods == |
||
− | Fault tolerance and security in distributed systems |
||
+ | {| class="wikitable" |
||
+ | |+ Activities within each section |
||
+ | |- |
||
+ | ! Learning Activities !! Section 1 !! Section 2 !! Section 3 !! Section 4 |
||
+ | |- |
||
+ | | Development of individual parts of software product code || 1 || 1 || 1 || 1 |
||
+ | |- |
||
+ | | Homework and group projects || 1 || 1 || 1 || 1 |
||
+ | |- |
||
+ | | Testing (written or computer based) || 1 || 1 || 1 || 1 |
||
+ | |- |
||
+ | | Oral polls || 1 || 1 || 1 || 1 |
||
+ | |- |
||
+ | | Discussions || 1 || 1 || 1 || 1 |
||
+ | |} |
||
+ | == Formative Assessment and Course Activities == |
||
− | + | === Ongoing performance assessment === |
|
+ | ==== Section 1 ==== |
||
− | * |
||
+ | {| class="wikitable" |
||
− | * |
||
+ | |+ |
||
− | |||
− | ==== What forms of evaluation were used to test students’ performance in this section? ==== |
||
− | |||
− | <div id="tab:OSSectionEval1"> |
||
− | |||
− | {| style="border-spacing: 2px; border: 1px solid darkgray;" |
||
− | |''' Form ''' |
||
− | ! '''Yes/No''' |
||
|- |
|- |
||
+ | ! Activity Type !! Content !! Is Graded? |
||
− | | Development of individual parts of software product code |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Question || ? || 1 |
||
− | | Homework and group projects |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Question || . || 1 |
||
− | | Midterm evaluation |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Question || ? || 1 |
||
− | | Testing (written or computer based) |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Question || ? || 1 |
||
− | | Reports |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Question || ? || 1 |
||
− | | Essays |
||
− | |align="center"| 0 |
||
|- |
|- |
||
+ | | Question || ? || 1 |
||
− | | Oral polls |
||
− | |align="center"| 1 |
||
|- |
|- |
||
+ | | Question || ? || 1 |
||
− | | Discussions |
||
+ | |} |
||
− | |align="center"| 1 |
||
+ | ==== Section 2 ==== |
||
− | |} |
||
+ | {| class="wikitable" |
||
+ | |+ |
||
+ | |- |
||
+ | ! Activity Type !! Content !! Is Graded? |
||
+ | |- |
||
+ | | Question || You have a list of large numbers, and you need to find if they are prime or not. Would you use multithreading, multiprocessing, or sequential programming in order to complete the task asap? Prove it in practice. || 0 |
||
+ | |- |
||
+ | | Question || You need to send multiple requests to a server and receive responses. Assume there is a few msecs of delay before you receive the response from the server. Would you use multithreading, multiprocessing, or sequential programming in order to complete the task asap? Prove it in practice. (Order of the requests/responses doesn't matter) || 0 |
||
+ | |- |
||
+ | | Question || Discuss two ways of creating the threads using threading module in Python: 1) passing the worker function as a target, 2) subclassing the Thread class || 0 |
||
+ | |- |
||
+ | | Question || Given the function implemented locally, make it available to be called through RPC from remote process? Use xmlRPC. || 0 |
||
+ | |} |
||
+ | ==== Section 3 ==== |
||
+ | {| class="wikitable" |
||
+ | |+ |
||
+ | |- |
||
+ | ! Activity Type !! Content !! Is Graded? |
||
+ | |- |
||
+ | | Question || ? || 1 |
||
+ | |- |
||
+ | | Question || ? || 1 |
||
+ | |- |
||
+ | | Question || ? || 1 |
||
+ | |- |
||
+ | | Question || ? || 1 |
||
+ | |- |
||
+ | | Question || ? || 1 |
||
+ | |} |
||
+ | ==== Section 4 ==== |
||
+ | {| class="wikitable" |
||
+ | |+ |
||
+ | |- |
||
+ | ! Activity Type !! Content !! Is Graded? |
||
+ | |- |
||
+ | | Question || Same as above || 0 |
||
+ | |} |
||
+ | === Final assessment === |
||
+ | '''Section 1''' |
||
+ | # ? |
||
+ | # ? |
||
+ | # ? |
||
+ | # ? |
||
+ | '''Section 2''' |
||
+ | # |
||
+ | '''Section 3''' |
||
+ | '''Section 4''' |
||
+ | # Same as above |
||
+ | === The retake exam === |
||
− | </div> |
||
+ | '''Section 1''' |
||
+ | '''Section 2''' |
||
− | ==== Typical questions for ongoing performance evaluation within this section ==== |
||
+ | '''Section 3''' |
||
− | # |
||
− | # |
||
− | # |
||
− | ==== Typical questions for seminar classes (labs) within this section ==== |
||
− | # Same as above |
||
− | ==== Test questions for final assessment in this section ==== |
||
+ | '''Section 4''' |
||
− | # Same as above |
Latest revision as of 16:31, 20 February 2023
Advanced Compilers Construction and Program Analysis
- Course name: Advanced Compilers Construction and Program Analysis
- Code discipline: XYZ
- Subject area: Programming Languages and Software Engineering
Short Description
This course covers the following concepts: Advanced Compilers Construction and Program Analysis concepts:
Key concepts of the class
- Type Systems
- Lambda calculi as the core representation
- Type checking and type inference
- Simple types and derived forms
- Subtyping
- Imperative objects
- Recursive types
- Universal polymorphism
- Compiling lazy functional languages
Prerequisites
Prerequisite subjects
Prerequisite topics
Course Topics
Section | Topics within the section |
---|---|
Introduction to subject, computer networks basics, transport layer protocols, and socket programming |
|
Coordination, consistency, and replication in distributed systems | |
Fault tolerance and security in distributed systems |
Course Sections
Section Title | Lecture Hours | Seminars (labs) | Selfstudy | Knowledge evaluation |
---|---|---|---|---|
Lambda Calculus and Simple Types | 10 | 10 | 10 | 2 |
References, Exceptions, Imperative Objects, Featheweight Java | 8 | 8 | 8 | 1 |
Recursive Types, Type Reconstruction, Universal Polymorphism | 6 | 6 | 6 | 1 |
Compiling Lazy Functional Languages | 8 | 8 | 8 | 1 |
Project Presentation | 2 |
Section 1 Section title: Lambda calculus and simple types
Topics covered in this section:
- The history of typed languages. Type systems and language design.
- Basic notions: untyped lambda calculus, nameless representation, simple types.
Form of evaluation | Usage | |
---|---|---|
Development of individual parts of software product code | 1 | |
Homework and group projects | 1 | |
Midterm evaluation | 0 | |
Testing (written or computer based) | 0 | |
Reports | 1 | |
Essays | 0 | |
Oral polls | 1 | |
Discussions | 1 |
Typical questions for ongoing performance evaluation within this section
- What is the role of the type system in language design?
- How to evaluate lambda terms using call-by-name/call-by-value strategies?
- What is the typing relation?
- What is type safety?
- What is erasure of types?
- What is general recursion?
Typical questions for seminar classes (labs) within this section
- Evaluate a given lambda expression using call-by-name strategy.
- Convert a given lambda expression to/from a nameless representation.
- Draw a type derivation tree for a given lambda term in simply typed lambda calculus.
- Provide a type for a given lambda term in a given simple type system.
Test questions for final assessment in this section
- Present an implementation of an interpreter for untyped lambda calculus.
- Present an implementation of a type checker for simply typed lambda
calculus.
Section 2
Section title: References, exceptions, imperative objects, Featherweight Java
Topics covered in this section:
- References, store typings, raising and handling exceptions
- Subsumption and the subtyping relation, coercion semantics, the Bottom Type
- Object-oriented programming and lambda calculus with imperative objects
- Featherweight Java
Form of evaluation | Usage | |
---|---|---|
Development of individual parts of software product code | 1 | |
Homework and group projects | 1 | |
Midterm evaluation | 1 | |
Testing (written or computer based) | 0 | |
Reports | 1 | |
Essays | 0 | |
Oral polls | 1 | |
Discussions | 1 |
Typical questions for ongoing performance evaluation within this section
- How operational semantic changes when introducing references?
- How operational semantic changes when introducing exceptions?
- What is the concept of imperative objects?
- What are the features of Featherweight Java?
- Explain effects of call-by-name and call-by-value evaluation strategies on terms with references.
Typical questions for seminar classes (labs) within this section
- Evaluate given expression with references.
- Evaluate given expression with exceptions.
- Draw a type derivation tree for a given lambda term in simply typed
lambda calculus with references and exceptions.
- Provide a type for a given lambda term in a given simple type system with references and exceptions.
Test questions for final assessment in this section
- Present and/or explain an implementation of an interpreter for lambda calculus with references and exceptions.
- Present and/or explain an implementation of a type checker for simply typed lambda calculus with references and exceptions.
Section 3
Section title: Recursive types, type reconstruction, universal polymorphism
What forms of evaluation were used to test students’ performance in this section?
Form of evaluation | Usage | |
---|---|---|
Development of individual parts of software product code | 1 | |
Homework and group projects | 1 | |
Midterm evaluation | 0 | |
Testing (written or computer based) | 0 | |
Reports | 1 | |
Essays | 0 | |
Oral polls | 1 | |
Form of evaluation | Usage | |
Discussions | 1 |
Topics covered in this section:
- Recursive types, induction and coinduction, finite and infinite types
- Polymorphism, type reconstruction, universal types
- System F and Hindley-Milner type system
Typical questions for ongoing performance evaluation within this section
- What is the concept of recursive types?
- What is the motivation for universal types?
- Explain the differences between System F and Hindley-Milner type system.
Typical questions for seminar classes (labs) within this section
- Evaluate given expression in System F with recursive types.
- Draw a type derivation tree for a given term in System F.
- Provide a type for a given term in System F.
Test questions for final assessment in this section
- Present and/or explain an implementation of an interpreter for lambda calculus with references and exceptions.
- Present and/or explain an implementation of a type checker for simply typed lambda calculus with references and exceptions.
- Present and/or explain the Hindley-Milner type inference algorithm.
Section 4 Section title: Compiling lazy functional languages
Topics covered in this section:
- Challenges of compiling lazy functional languages
- Representing functional closures at run-time
- Representing lazy data structures at run-time
- The syntax and semantics of the STG language
What forms of evaluation were used to test students’ performance in this section?
Form of evaluation | Usage | |
---|---|---|
Development of individual parts of software product code | 1 | |
Homework and group projects | 1 | |
Midterm evaluation | 0 | |
Testing (written or computer based) | 0 | |
Reports | 1 | |
Essays | 0 | |
Oral polls | 1 | |
Form of evaluation | Usage | |
Discussions | 1 |
Typical questions for ongoing performance evaluation within this section
- How are closures represented during run-time?
- How are lazy data structures represented during run-time?
- Describe the main constructions of the STG Language?
Typical questions for seminar classes (labs) within this section
- Explain how a given term in STG language evaluates.
- Translate a given lambda term into STG language
Test questions for final assessment in this section
- Present and/or explain the STG machine.
- Present an implementation of a type checker for simply typed lambda
calculus.
Intended Learning Outcomes (ILOs)
What is the main purpose of this course?
This course partially covers two major topics: 1. Theory and Implementation of Typed Programming Languages and 2. Compilation of Lazy Functional Languages. We will study different type system features in detail, starting from an untyped language of lambda calculus and gradually adding new types and variations along the way. The course assumes familiarity with basics of compiler construction, basics of functional programming and familiarity with some static type systems (C++ and Java would suffice, but knowing type systems of Haskell or Scala will help). Even though the most obvious benefit of static type systems is that it allows programmers to detect some errors early, it is by far not the only application. Types are used also as a tool for abstraction, documentation, language safety, efficiency and more. In this course we will look at features of type systems occurring in many programming languages, like C++, Java, Scala and Haskell. After we have reached System F, a type system at the core of languages like Haskell, we will look into how lazy functional languages are implemented. We will in particular look in detail at Spineless Tagless Graph reduction machine (also known as STG machine) that is used to compile Haskell code.
Evaluation of the course consists of Lecture Quizzes, Lab Participation and the Final Project (split into several stages). The Final Project is a team project where students build a complete interpreter or compiler for a statically typed programming language, incorporating some of the features covered in this course.
Course Objectives Based on Bloom’s Taxonomy
What should a student remember at the end of the course?
- Remember syntax and computation rules of untyped lambda calculus.
- Remember nameless representation of lambda terms.
- Remember definition of normal form, weak head normal form.
- Remember syntax, typing and computation rules of simply typed lambda calculus.
- Remember definition of imperative objects.
- Remember syntax and semantics of Featherweight Java.
- Remember typing rules for subtyping.
- Remember typing rules for pairs, tuples, records, sums, variants, and lists.
- Remember typing rules for let-bindings and type ascription.
- Remember typing rules for recursive types.
- Remember definition and typing rules for universal polymorphism.
- Remember syntax, typing and computation rules for System F.
- Remember representation of closures when compiling functional languages.
- Remember representation of lazy data structures when compiling.
- Remember the syntax and semantics of the STG language.
What should a student be able to understand at the end of the course?
- Understand how type systems relate to language design
- Understand differences between call-by-name, call-by-need, and call-byvalue evaluation strategies.
- Understand the tradeoffs introduced by various type system features.
- Understand the idea of nameless representation of terms.
- Understand the tradeoffs of mutable references and exceptions introduced in a language.
- Understand how imperative objects model objects in modern objectoriented langauges.
- Understand the difficulties of compiling lazy expressions.
- Understand the differences between Hindley–Milner type system and System F.
What should a student be able to apply at the end of the course?
- Implement an interpreter for a programming language with untyped lambda calculus as its core representation.
- Implement an interpreter for a programming language with simply typed lambda calculus as its core representation.
- Implement type checking algorithm for a language with simple types, recursive types, imperative objects, and universal polymorphism.
- Implement Damas–Hindley–Milner type inference algorithm for a programming language with a Hindley-Milner style type system.
Course evaluation:
- Labs/seminar classes (proposed points: 20)
- Interim performance assessment (proposed points: 10)
- Exams (proposed points: 70)
ILOs defined at three levels
Level 1: What concepts should a student know/remember/explain?
By the end of the course, the students should be able to ...
Level 2: What basic practical skills should a student be able to perform?
By the end of the course, the students should be able to ...
Level 3: What complex comprehensive skills should a student be able to apply in real-life scenarios?
By the end of the course, the students should be able to ...
Grading
Course grading range
Grade | Range | Description of performance |
---|---|---|
A. Excellent | 85-100 | - |
B. Good | 75-84 | - |
C. Satisfactory | 60-74 | - |
D. Poor | 0-59 | - |
Course activities and grading breakdown
Activity Type | Percentage of the overall course grade |
---|---|
Laboratory assignments | 55% |
Final exam | 35% |
Attendance | 10% |
Recommendations for students on how to succeed in the course
Resources, literature and reference materials
Open access resources
- Textbook:. Available online:
- Reference:. Available online:
- Reference:. Available online:
Closed access resources
Software and tools used within the course
Resources and reference material
- Benjamin C. Pierce. ’‘Types and Programming Languages. The MIT Press 2002”
- Simon Peyton Jones. ’‘Implementing functional languages: a tutorial. Prentice Hall 1992”
- Simon Peyton Jones. ’‘Implementing Lazy Functional Languages on Stock Hardware: The Spineless Tagless G-machine. Journal of Functional Programming 1992”
Teaching Methodology: Methods, techniques, & activities
Activities and Teaching Methods
Learning Activities | Section 1 | Section 2 | Section 3 | Section 4 |
---|---|---|---|---|
Development of individual parts of software product code | 1 | 1 | 1 | 1 |
Homework and group projects | 1 | 1 | 1 | 1 |
Testing (written or computer based) | 1 | 1 | 1 | 1 |
Oral polls | 1 | 1 | 1 | 1 |
Discussions | 1 | 1 | 1 | 1 |
Formative Assessment and Course Activities
Ongoing performance assessment
Section 1
Activity Type | Content | Is Graded? |
---|---|---|
Question | ? | 1 |
Question | . | 1 |
Question | ? | 1 |
Question | ? | 1 |
Question | ? | 1 |
Question | ? | 1 |
Question | ? | 1 |
Section 2
Activity Type | Content | Is Graded? |
---|---|---|
Question | You have a list of large numbers, and you need to find if they are prime or not. Would you use multithreading, multiprocessing, or sequential programming in order to complete the task asap? Prove it in practice. | 0 |
Question | You need to send multiple requests to a server and receive responses. Assume there is a few msecs of delay before you receive the response from the server. Would you use multithreading, multiprocessing, or sequential programming in order to complete the task asap? Prove it in practice. (Order of the requests/responses doesn't matter) | 0 |
Question | Discuss two ways of creating the threads using threading module in Python: 1) passing the worker function as a target, 2) subclassing the Thread class | 0 |
Question | Given the function implemented locally, make it available to be called through RPC from remote process? Use xmlRPC. | 0 |
Section 3
Activity Type | Content | Is Graded? |
---|---|---|
Question | ? | 1 |
Question | ? | 1 |
Question | ? | 1 |
Question | ? | 1 |
Question | ? | 1 |
Section 4
Activity Type | Content | Is Graded? |
---|---|---|
Question | Same as above | 0 |
Final assessment
Section 1
- ?
- ?
- ?
- ?
Section 2
Section 3
Section 4
- Same as above
The retake exam
Section 1
Section 2
Section 3
Section 4