Skip to main content
Skip header
Terminated in academic year 2009/2010

Programming Languages and Compilers

Type of study Bachelor
Language of instruction Czech
Code 456-0525/01
Abbreviation PJP
Course title Programming Languages and Compilers
Credits 6
Coordinating department Department of Computer Science
Course coordinator Ing. Marek Běhálek, Ph.D.

Subject syllabus

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.

Projects:
There will be two projects in this course. Firs will be an implementation of some task in less known programming language. Second will be a simple compiler.

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

Literature

Aho, A. V., Sethi, R., Ullman, J. D.: Compilers. Principles, Techniques, and Tools. Addison-Wesley, 1987

Advised literature

Sylaby přednášek
Melichar, Češka, Ježek, Richta: Konstrukce překladačů. Vydavatelství ČVUT, Praha, 1999, ISBN 80-01-02028-2
Young S. J.: Programovací jazyky pro RT aplikace. SNTL, Praha, 1988.
Literatura studijní