Difference between revisions of "BSc: Compilers Construction"

From IU
Jump to navigation Jump to search
m (M.petrishchev moved page BSc:CompilersConstruction.S22 to BSc:CompilersConstruction over redirect)
 
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
  +
 
= Compiler Construction =
 
= Compiler Construction =
  +
* '''Course name''': Compiler Construction
  +
* '''Code discipline''': n/a
  +
* '''Subject area''': Programming Languages and Software Engineering
   
  +
== Short Description ==
* <span>'''Course name:'''</span> Compiler Construction
 
  +
This course covers the following concepts: Overall compilation architecture; Lexical analysis; Syntax analysis; Semantic analysis; Code generation; Program optimization; Virtual machines and JIT technology.
* <span>'''Course number:'''</span> n/a
 
* <span>'''Subject area:'''</span> Programming Languages and Software Engineering
 
   
== Course characteristics ==
+
== Prerequisites ==
   
=== Key concepts of the class ===
+
=== Prerequisite subjects ===
   
* Overall compilation architecture
 
* Lexical analysis
 
* Syntax analysis
 
* Semantic analysis
 
* Code generation
 
* Program optimization
 
* Virtual machines and JIT technology
 
   
  +
=== Prerequisite topics ===
=== What is the purpose of this course? ===
 
   
The software development process and the depth of programming cannot be understood without a detailed analysis of the compilation process, from the lexical analysis to the syntactical and semantic analysis up to code generation and optimization, and without understanding both strength and limitation of this process. This course dig deeper into this topic building on the fundamental notions studied in theoretical computer science of which is the natural continuation. The typical compiler pipeline will be studied and a project will allow students to practice with the relevant tools.
 
   
=== Course Objectives Based on Bloom’s Taxonomy ===
+
== Course Topics ==
  +
{| class="wikitable"
  +
|+ Course Sections and Topics
  +
|-
  +
! Section !! Topics within the section
  +
|-
  +
| Introduction to compilers and compiler construction ||
  +
# Basic notions: source and target languages, target architecture, compilation phases.
  +
# The history of languages and compiler development. Typical compiler examples.
  +
# Compilation & interpretation. Virtual machines, JIT & AOT technologies. Hybrid modes.
  +
|-
  +
| Lexical, syntax and semantic analyses ||
  +
# Compilation pipeline & compilation data structures
  +
# Lexical analysis and deterministic state automata
  +
# Bottom-up and top-down parsing
  +
# Principles of semantic analysis
  +
|-
  +
| Code generation, optimization and virtual machines ||
  +
# Low-level code generation: machine instructions, assembly language
  +
# Virtual machines’ architecture and their byte codes.
  +
# The notion of language projections.
  +
# Introduction to optimization techniques.
  +
|}
  +
== Intended Learning Outcomes (ILOs) ==
  +
  +
=== What is the main purpose of this course? ===
  +
The software development process and the depth of programming cannot be understood without a detailed analysis of the compilation process, from the lexical analysis to the syntactical and semantic analysis up to code generation and optimization, and without understanding both strength and limitation of this process. This course dig deeper into this topic building on the fundamental notions studied in theoretical computer science of which is the natural continuation. The typical compiler pipeline will be studied and a project will allow students to practice with the relevant tools.
   
=== What should a student remember at the end of the course? ===
+
=== 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 ...
 
* Understanding in depth the compilation process
 
* Understanding in depth the compilation process
 
* Realizing the limits of the process and of Semantic Analysis
 
* Realizing the limits of the process and of Semantic Analysis
Line 32: Line 55:
 
* Perform semantic analysis
 
* Perform semantic analysis
   
=== What should a student be able to understand at the end of the course? ===
+
==== 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 ...
 
 
* How to design and develop compilers and language-related tools.
 
* How to design and develop compilers and language-related tools.
 
* The contents of each phase of the compilation process.
 
* The contents of each phase of the compilation process.
Line 39: Line 62:
 
* How to design a virtual machine for a language.
 
* How to design a virtual machine for a language.
   
=== What should a student be able to apply at the end of the course? ===
+
==== 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 ...
  +
* To be able to develop a language compiler.
  +
== Grading ==
   
  +
=== Course grading range ===
* To be able to develop a language compiler.
 
  +
{| class="wikitable"
  +
|+
  +
|-
  +
! Grade !! Range !! Description of performance
  +
|-
  +
| A. Excellent || 85-100 || -
  +
|-
  +
| B. Good || 75-84 || -
  +
|-
  +
| C. Satisfactory || 60-75 || -
  +
|-
  +
| D. Poor || 0-59 || -
  +
|}
   
=== Course evaluation ===
+
=== Course activities and grading breakdown ===
  +
{| class="wikitable"
 
{|
+
|+
  +
|-
|+ Course grade breakdown
 
  +
! Activity Type !! Percentage of the overall course grade
!
 
!
 
!align="center"| '''Proposed points'''
 
 
|-
 
|-
| Labs/seminar classes
+
| Labs/seminar classes || 40
| 40
 
|align="center"| 40
 
 
|-
 
|-
| Interim performance assessment
+
| Interim performance assessment || 40
| 30
 
|align="center"| 40
 
 
|-
 
|-
| Exams
+
| Exams || 30
| 30
 
|align="center"| 30
 
 
|}
 
|}
   
  +
=== Recommendations for students on how to succeed in the course ===
If necessary, please indicate freely your course’s features in terms of students’ performance assessment.
 
   
=== Labs/seminar classes: ===
 
   
  +
== Resources, literature and reference materials ==
In-class participation 1 point for each individual contribution in a class but not more than 1 point a week (i.e. 14 points in total for 14 study weeks), overall course contribution (to accumulate extra-class activities valuable to the course progress, e.g. a short presentation, book review, very active in-class participation, etc.) up to 6 points.
 
   
=== Interim performance assessment: ===
+
=== Open access resources ===
  +
* Alfred V.Aho, Monica S.Lam, Ravi Sethi, Jeffrey D. Ullman. Compilers. Principles, Techniques, & Tools, Second Edition, Addison-Wesley, 2007, ISBN 0-321-48681-1.
  +
* N. Wirth, Compiler Construction, Addison-Wesley, 1996, ISBN 0-201-40353-6
  +
* http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf, 2005
   
  +
=== Closed access resources ===
In-class tests up to 10 points for each test (i.e. up to 40 points in total for 2 theory and 2 practice tests), computational practicum assignment up to 10 points for each task (i.e. up to 30 points for 3 tasks).
 
   
=== Exams: ===
 
   
  +
=== Software and tools used within the course ===
Mid-term exam up to 30 points, final examination up to 30 points.
 
  +
  +
= Teaching Methodology: Methods, techniques, & activities =
   
  +
== Activities and Teaching Methods ==
'''Overall score:''' 100 points (100%).
 
  +
{| class="wikitable"
 
  +
|+ Activities within each section
=== Grades range ===
 
  +
|-
 
  +
! Learning Activities !! Section 1 !! Section 2 !! Section 3
{|
 
|+ Course grading range
 
!
 
!
 
!align="center"| '''Proposed range'''
 
 
|-
 
|-
  +
| Development of individual parts of software product code || 1 || 1 || 1
| A. Excellent
 
| 85-100
 
|align="center"| 85-100
 
 
|-
 
|-
  +
| Homework and group projects || 1 || 1 || 1
| B. Good
 
| 75-84
 
|align="center"| 75-84
 
 
|-
 
|-
  +
| Oral polls || 1 || 0 || 0
| C. Satisfactory
 
| 60-75
 
|align="center"| 60-75
 
 
|-
 
|-
  +
| Discussions || 1 || 1 || 0
| D. Poor
 
| 0-59
+
|-
  +
| Reports || 0 || 1 || 0
|align="center"| 0-59
 
|}
+
|}
  +
== Formative Assessment and Course Activities ==
   
  +
=== Ongoing performance assessment ===
If necessary, please indicate freely your course’s grading features: The semester starts with the default range as proposed, but it may change slightly (usually reduced) depending on how the semester progresses.
 
   
=== Resources and reference material ===
+
==== Section 1 ====
  +
{| class="wikitable"
 
  +
|+
* Alfred V.Aho, Monica S.Lam, Ravi Sethi, Jeffrey D. Ullman. ''<span>Compilers. Principles, Techniques, &amp; Tools, Second Edition, Addison-Wesley, 2007, ISBN 0-321-48681-1.</span>''
 
  +
|-
* N. Wirth, ''<span>Compiler Construction, Addison-Wesley, 1996, ISBN 0-201-40353-6</span>''
 
  +
! Activity Type !! Content !! Is Graded?
* http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf, 2005
 
  +
|-
 
  +
| Question || What is compilation process? || 1
== Course Sections ==
 
  +
|-
 
  +
| Question || What’s the difference between compiler and interpreter? || 1
The main sections of the course and approximate hour distribution between them is as follows:
 
  +
|-
 
  +
| Question || How to compile a program? || 0
{|
 
|+ Course Sections
 
!align="center"| '''Section'''
 
! '''Section Title'''
 
!align="center"| '''Lecture Hours'''
 
!align="center"| '''Seminars (labs)'''
 
!align="center"| '''Self-study'''
 
!align="center"| '''Knowledge evaluation'''
 
 
|-
 
|-
  +
| Question || How to run a program? || 0
|align="center"| 1
 
| Introduction to compilers and compiler construction
 
|align="center"| 12
 
|align="center"| 6
 
|align="center"| 12
 
|align="center"| 2
 
 
|-
 
|-
  +
| Question || How to debug a program? || 0
|align="center"| 2
 
  +
|}
| Lexical, syntax and semantic analyses
 
  +
==== Section 2 ====
|align="center"| 8
 
  +
{| class="wikitable"
|align="center"| 4
 
  +
|+
|align="center"| 8
 
|align="center"| 1
 
 
|-
 
|-
  +
! Activity Type !! Content !! Is Graded?
|align="center"| 3
 
| Code generation, optimization and virtual machines
 
|align="center"| 8
 
|align="center"| 4
 
|align="center"| 8
 
|align="center"| 1
 
 
|-
 
|-
  +
| Question || Abstract syntax tree & symbol tables: what is it for and how create and manage them? || 1
|align="center"| 4
 
  +
|-
| Project presentation
 
  +
| Question || How to organize communication between compilation phases? || 1
|align="center"|
 
  +
|-
|align="center"|
 
  +
| Question || What are basic differences between bottom-up and top-down parsing? || 1
|align="center"|
 
  +
|-
|align="center"| 2
 
  +
| Question || How to implement a hash function for a symbol table? || 0
|}
 
  +
|-
 
  +
| Question || How to write a grammar for an expression using YACC/Bison tool? || 0
=== Section 1 ===
 
  +
|}
 
=== Section title: ===
+
==== Section 3 ====
  +
{| class="wikitable"
 
  +
|+
Introduction to compilers and compiler construction
 
  +
|-
 
  +
! Activity Type !! Content !! Is Graded?
=== Topics covered in this section: ===
 
  +
|-
 
  +
| Question || What’s the difference between assembly and machine instructions? || 1
* Basic notions: source and target languages, target architecture, compilation phases.
 
  +
|-
* The history of languages and compiler development. Typical compiler examples.
 
  +
| Question || What’s the similarities and differences between real target platforms and virtual machines? || 1
* Compilation &amp; interpretation. Virtual machines, JIT &amp; AOT technologies. Hybrid modes.
 
  +
|-
 
  +
| Question || Explain some of widely used approaches for optimizing program source code? How these approaches can be implemented in a compiler? || 1
=== What forms of evaluation were used to test students’ performance in this section? ===
 
  +
|-
 
  +
| Question || Explain the idea behind the notion of control flow graph. || 0
<div class="tabular">
 
  +
|-
 
  +
| Question || What is “basic block” in CFG and what is it for? || 0
<span>|a|c|</span> &amp; '''Yes/No'''<br />
 
  +
|}
Development of individual parts of software product code &amp; 1<br />
 
  +
=== Final assessment ===
Homework and group projects &amp; 1<br />
 
  +
'''Section 1'''
Midterm evaluation &amp; 0<br />
 
Testing (written or computer based) &amp; 0<br />
 
Reports &amp; 0<br />
 
Essays &amp; 0<br />
 
Oral polls &amp; 1<br />
 
Discussions &amp; 1<br />
 
 
 
 
</div>
 
=== Typical questions for ongoing performance evaluation within this section ===
 
 
# What is compilation process?
 
# What’s the difference between compiler and interpreter?
 
 
=== Typical questions for seminar classes (labs) within this section ===
 
 
# How to compile a program?
 
# How to run a program?
 
# How to debug a program?
 
 
=== Test questions for final assessment in this section ===
 
 
 
# What are significant phases of a compilation process?
 
# What are significant phases of a compilation process?
 
# Why do we need optimization phase?
 
# Why do we need optimization phase?
 
# What’s the difference between syntax and semantic analyses?
 
# What’s the difference between syntax and semantic analyses?
  +
'''Section 2'''
 
=== Section 2 ===
 
 
=== Section title: ===
 
 
Lexical, syntax and semantic analyses
 
 
=== Topics covered in this section: ===
 
 
* Compilation pipeline &amp; compilation data structures
 
* Lexical analysis and deterministic state automata
 
* Bottom-up and top-down parsing
 
* Principles of semantic analysis
 
 
=== What forms of evaluation were used to test students’ performance in this section? ===
 
 
<div class="tabular">
 
 
<span>|a|c|</span> &amp; '''Yes/No'''<br />
 
Development of individual parts of software product code &amp; 1<br />
 
Homework and group projects &amp; 1<br />
 
Midterm evaluation &amp; 0<br />
 
Testing (written or computer based) &amp; 0<br />
 
Reports &amp; 1<br />
 
Essays &amp; 0<br />
 
Oral polls &amp; 0<br />
 
Discussions &amp; 1<br />
 
 
 
 
</div>
 
=== Typical questions for ongoing performance evaluation within this section ===
 
 
# Abstract syntax tree &amp; symbol tables: what is it for and how create and manage them?
 
# How to organize communication between compilation phases?
 
# What are basic differences between bottom-up and top-down parsing?
 
 
=== Typical questions for seminar classes (labs) within this section ===
 
 
# How to implement a hash function for a symbol table?
 
# How to write a grammar for an expression using YACC/Bison tool?
 
 
=== Test questions for final assessment in this section ===
 
 
 
# Characterize the principles of top-down and bottom-up parsing.
 
# Characterize the principles of top-down and bottom-up parsing.
 
# Explain how a symbol table can be implemented.
 
# Explain how a symbol table can be implemented.
 
# AST: is it a tree or a graph? What’s about semantic attributes in an AST?
 
# AST: is it a tree or a graph? What’s about semantic attributes in an AST?
  +
'''Section 3'''
  +
# Give some simple examples of language-code projections.
  +
# How the object code for an expression can be optimized?
  +
# How to avoid tail recursion while optimizing code?
   
=== Section 3 ===
+
=== The retake exam ===
  +
'''Section 1'''
   
=== Section title: ===
+
'''Section 2'''
   
  +
'''Section 3'''
Code generation, optimization and virtual machines
 
 
=== Topics covered in this section: ===
 
 
* Low-level code generation: machine instructions, assembly language
 
* Virtual machines’ architecture and their byte codes.
 
* The notion of language projections.
 
* Introduction to optimization techniques.
 
 
=== What forms of evaluation were used to test students’ performance in this section? ===
 
 
<div class="tabular">
 
 
<span>|a|c|</span> &amp; '''Yes/No'''<br />
 
Development of individual parts of software product code &amp; 1<br />
 
Homework and group projects &amp; 1<br />
 
Midterm evaluation &amp; 0<br />
 
Testing (written or computer based) &amp; 0<br />
 
Reports &amp; 0<br />
 
Essays &amp; 0<br />
 
Oral polls &amp; 0<br />
 
Discussions &amp; 0<br />
 
 
 
 
</div>
 
=== Typical questions for ongoing performance evaluation within this section ===
 
 
# What’s the difference between assembly and machine instructions?
 
# What’s the similarities and differences between real target platforms and virtual machines?
 
# Explain some of widely used approaches for optimizing program source code? How these approaches can be implemented in a compiler?
 
 
=== Typical questions for seminar classes (labs) within this section ===
 
 
# Explain the idea behind the notion of control flow graph.
 
# What is “basic block” in CFG and what is it for?
 
 
=== Test questions for final assessment in this section ===
 
 
# Give some simple examples of language-code projections.
 
# How the object code for an expression can be optimized?
 
# How to avoid tail recursion while optimizing code?
 

Latest revision as of 12:56, 12 July 2022

Compiler Construction

  • Course name: Compiler Construction
  • Code discipline: n/a
  • Subject area: Programming Languages and Software Engineering

Short Description

This course covers the following concepts: Overall compilation architecture; Lexical analysis; Syntax analysis; Semantic analysis; Code generation; Program optimization; Virtual machines and JIT technology.

Prerequisites

Prerequisite subjects

Prerequisite topics

Course Topics

Course Sections and Topics
Section Topics within the section
Introduction to compilers and compiler construction
  1. Basic notions: source and target languages, target architecture, compilation phases.
  2. The history of languages and compiler development. Typical compiler examples.
  3. Compilation & interpretation. Virtual machines, JIT & AOT technologies. Hybrid modes.
Lexical, syntax and semantic analyses
  1. Compilation pipeline & compilation data structures
  2. Lexical analysis and deterministic state automata
  3. Bottom-up and top-down parsing
  4. Principles of semantic analysis
Code generation, optimization and virtual machines
  1. Low-level code generation: machine instructions, assembly language
  2. Virtual machines’ architecture and their byte codes.
  3. The notion of language projections.
  4. Introduction to optimization techniques.

Intended Learning Outcomes (ILOs)

What is the main purpose of this course?

The software development process and the depth of programming cannot be understood without a detailed analysis of the compilation process, from the lexical analysis to the syntactical and semantic analysis up to code generation and optimization, and without understanding both strength and limitation of this process. This course dig deeper into this topic building on the fundamental notions studied in theoretical computer science of which is the natural continuation. The typical compiler pipeline will be studied and a project will allow students to practice with the relevant tools.

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

  • Understanding in depth the compilation process
  • Realizing the limits of the process and of Semantic Analysis
  • Read and write grammars for programming language constructs
  • Perform lexical analysis and use lexical analyzer generators
  • Perform top-down parsing, bottom-up parsing and use parser generators
  • Perform semantic analysis

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

  • How to design and develop compilers and language-related tools.
  • The contents of each phase of the compilation process.
  • How integrate compilers into an IDE.
  • How to design a virtual machine for a language.

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

  • To be able to develop a language compiler.

Grading

Course grading range

Grade Range Description of performance
A. Excellent 85-100 -
B. Good 75-84 -
C. Satisfactory 60-75 -
D. Poor 0-59 -

Course activities and grading breakdown

Activity Type Percentage of the overall course grade
Labs/seminar classes 40
Interim performance assessment 40
Exams 30

Recommendations for students on how to succeed in the course

Resources, literature and reference materials

Open access resources

  • Alfred V.Aho, Monica S.Lam, Ravi Sethi, Jeffrey D. Ullman. Compilers. Principles, Techniques, & Tools, Second Edition, Addison-Wesley, 2007, ISBN 0-321-48681-1.
  • N. Wirth, Compiler Construction, Addison-Wesley, 1996, ISBN 0-201-40353-6
  • http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf, 2005

Closed access resources

Software and tools used within the course

Teaching Methodology: Methods, techniques, & activities

Activities and Teaching Methods

Activities within each section
Learning Activities Section 1 Section 2 Section 3
Development of individual parts of software product code 1 1 1
Homework and group projects 1 1 1
Oral polls 1 0 0
Discussions 1 1 0
Reports 0 1 0

Formative Assessment and Course Activities

Ongoing performance assessment

Section 1

Activity Type Content Is Graded?
Question What is compilation process? 1
Question What’s the difference between compiler and interpreter? 1
Question How to compile a program? 0
Question How to run a program? 0
Question How to debug a program? 0

Section 2

Activity Type Content Is Graded?
Question Abstract syntax tree & symbol tables: what is it for and how create and manage them? 1
Question How to organize communication between compilation phases? 1
Question What are basic differences between bottom-up and top-down parsing? 1
Question How to implement a hash function for a symbol table? 0
Question How to write a grammar for an expression using YACC/Bison tool? 0

Section 3

Activity Type Content Is Graded?
Question What’s the difference between assembly and machine instructions? 1
Question What’s the similarities and differences between real target platforms and virtual machines? 1
Question Explain some of widely used approaches for optimizing program source code? How these approaches can be implemented in a compiler? 1
Question Explain the idea behind the notion of control flow graph. 0
Question What is “basic block” in CFG and what is it for? 0

Final assessment

Section 1

  1. What are significant phases of a compilation process?
  2. Why do we need optimization phase?
  3. What’s the difference between syntax and semantic analyses?

Section 2

  1. Characterize the principles of top-down and bottom-up parsing.
  2. Explain how a symbol table can be implemented.
  3. AST: is it a tree or a graph? What’s about semantic attributes in an AST?

Section 3

  1. Give some simple examples of language-code projections.
  2. How the object code for an expression can be optimized?
  3. How to avoid tail recursion while optimizing code?

The retake exam

Section 1

Section 2

Section 3