Skip to main content
Skip header

Programming Languages and Compilers

* Exchange students do not have to consider this information when selecting suitable courses for an exchange stay.

Course Unit Code460-2018/01
Number of ECTS Credits Allocated6 ECTS credits
Type of Course Unit *Optional
Level of Course Unit *First Cycle
Year of Study *Second Year
Semester when the Course Unit is deliveredSummer Semester
Mode of DeliveryFace-to-face
Language of InstructionCzech
Prerequisites and Co-Requisites Course succeeds to compulsory courses of previous semester
Name of Lecturer(s)Personal IDName
BEH01Ing. Marek Běhálek, Ph.D.
Summary
Students get an overview of the area of programming, main programming paradigms (imperative, functional, logic) and their typical representatives. They also get some theoretical body of knowledge and practical experience of compiling methods, especially concentrated to the source code analysis and intermediate code synthesis phases. Students develop practical abilities to use compiler generators like JavaCC.
Learning Outcomes of the Course Unit
Students get an overview of the area of programming, main programming paradigms (imperative, functional, logic) and their typical representatives. They also get some theoretical body of knowledge and practical experience of compiling methods, especially concentrated to the source code analysis and intermediate code synthesis phases. Students develop practical abilities to use compiler generators like JavaCC.

After this lectures student should be able to effectively implement analyzers of a structured text data or of simple languages. Also they should understand concepts and constructions common for today's programming languages.
Course Contents
Lectures:
Introduction:
Goals and contents of the course, requirements, organization, resources. Programming languages classification. Usage and applications of compilers. Source and target languages.
History of programming languages and compilers:
theoretical aspects, first programming languages and compilers, high-order programming languages, structured programming, modular languages, object-oriented languages, scripting languages.

Functional and logic programming languages: Declarative style of programming, advantages and disadvantages of this approach, basics of Lambda Calculus, implementation of practical examples in Haskell.
Scripting languages: description of differences between traditional languages and scripting languages, description of some representatives of scripting languages, practical examples, overview of PHP.
Imperative programming languages: basic principles, imperative programming languages. Examples of different programming paradigms.

Object-oriented programming: basic principles, less known object-oriented programming languages.
Structure and functions of a compiler:
Source code models, transformations. Compiler organization - phases, passes. One-pass and optimising compilers. Utility programs. Testing and maintenance of a compiler.

Lexical analysis:
Function of a scanner, symbol representation. Regular languages, finite automaton, regular expression. Scanner implementation.

Parsing:
Goals and methods of the syntactic analysis. Top-down and Bottom-up analysis. LL(1) grammars, FIRST and FOLLOW set computation. Parsing table.

Parser implementation:
Pushdown automaton for LL(1) languages. Recursive descent analysis.
Syntax directed translation:
Translation grammar, attribute translation grammar. Implementation of attribute translation during top-down parsing. Compiler Compiler JavaCC.

Symbol table:
Basic notions - binding, range, visibility, life time. Functions of symbol table. Programming language model. Organization of symbol table. Block structured symbol table. Implementation.

Internal representation of program:
Formats of internal representation - graph, stack code, three-address code. Implementation of three-address code. Translation of expressions. Array items addressing. Translation of Boolean expressions. Generation of stack code as attribute translation.

Run-time program structure:
Run-time system. Subroutines - activation, static and dynamic structure, activation record. Memory organization, memory allocation for activation records, access pointers. Parameter passing.


Laboratories (only on PC labs):
Examples of different programming paradigms.
Examples of declarative style of programming. Practical implementation of some simple tasks in Haskell.
Implementation of some tasks in Haskell.
Scripting languages: Implementation of simple task in PHP.
Imperative and object oriented languages. Examples of programs written in some less known languages.
Work on firs project.
Implementation in simple filters and lexical analyzers.
Practical realization of grammars for a basic constructions common in programming languages.
Implementation of algorithms for a computation of sets FIRST a FOLLOW.
Demonstration of LL(1) a LR(1) based syntactic analyzers. Implementation of a syntactic analyzer using recursive descent.
Implementation of a simple compiler using compiler compiler JavaCC.
Work on second project.
Recommended or Required Reading
Required Reading:
Torben Mogensen: Basics of Compiler Design - freely available at http://www.diku.dk/hjemmesider/ansatte/torbenm/Basics/
Beneš, M.: Překladače. Elektronická skripta.

Torben Mogensen: Basics of Compiler Design - zdarma dostupné online na http://www.diku.dk/hjemmesider/ansatte/torbenm/Basics/
Recommended Reading:
Aho, A. V., Lam M.S., Sethi, R., Ullman, J. D.: Compilers. Principles, Techniques, and Tools. Addison Wesley; 2nd edition (September 10, 2006). ISBN 0321486811.7

Pierce B.C.: Types and Programming Languages, MIT Press, 2002, ISBN: 9780262162098.
Aho, A. V., Lam M.S., Sethi, R., Ullman, J. D.: Compilers. Principles, Techniques, and Tools. Addison Wesley; 2nd edition (September 10, 2006). ISBN 0321486811.

Pierce B.C.: Types and Programming Languages, MIT Press, 2002, ISBN: 9780262162098.
Planned learning activities and teaching methods
Lectures, Tutorials, Project work
Assesment methods and criteria
Task TitleTask TypeMaximum Number of Points
(Act. for Subtasks)
Minimum Number of Points for Task Passing
Exercises evaluation and ExaminationCredit and Examination100 (100)51
        Exercises evaluationCredit45 (45)21
                First projectProject15 0
                Second projectProject30 0
        ExaminationExamination55 25