Programming Language Translation
Data is displayed for the academic year: 2024./2025.
Laboratory exercises
Course Description
The processes of incremental hierarchical translation of end-user languages, high-level languages, and languages of virtual machines into the target language of a given computer system are studied. The techniques and principles of language translation processes in modern pervasive, ubiquitous, and invisible distributed systems are described. A brief survey and history of programming languages and language translators are given. Language translation is explained through basic processes of source program analysis and target program synthesis. Major phases of analysis (lexical, syntax, and semantic analysis) and synthesis (intermediate code generation, optimization, and target code generation) are included. Run-time and load-time support for program execution are presented. Language translator generators are studied.
Prerequisites
programming; algorithms and data structures; computer architecture; operating systems; theory of formal languages, automata, and grammars (regular expressions; finite automata; context-free grammar; pushdown automata)
Study Programmes
University undergraduate
[FER3-EN] Computing - study
(5. semester)
Learning Outcomes
- breakdown the design of a computer system into problem analysis phase and solution synthesis phase
- describe lexical, syntax, and semantic properties of a programming language using formal grammar
- select optimal formal grammar for formal description of a programming language
- select optimal parsing technique for programming language translation
- design and implement a compiler from formal specification of a programming language
- design an efficient language translation process with respect to processor resources and memory hierarchy
Forms of Teaching
Lectures
Lecturer-driven classroom presentations of theoretical concepts with examples and problem solving
LaboratorySoftware implementation of specific parts of compiler or compiler in general. Students individually implement given assignment in a recommended programming language or tool, and submit their solutions to automatic online evaluation.
Grading Method
Continuous Assessment | Exam | |||||
---|---|---|---|---|---|---|
Type | Threshold | Percent of Grade | Threshold | Percent of Grade | ||
Laboratory Exercises | 50 % | 40 % | 50 % | 0 % | ||
Class participation | 0 % | 10 % | 0 % | 0 % | ||
Mid Term Exam: Written | 50 % | 25 % | 0 % | |||
Final Exam: Written | 50 % | 25 % | ||||
Exam: Written | 50 % | 100 % | ||||
Exam: Oral | 100 % |
Week by Week Schedule
- Programs that take (other) programs as input such as interpreters, compilers, type-checkers, documentation, generators, Data structures to represent code for execution, translation, or transmission, Interpretation vs; compilation to native code vs; compilation to portable intermediate representation, Language translation pipeline: parsing, optional type-checking, translation, linking, execution
- Lexical analysis using regular expressions, Lexical analyser generators
- Top-down parsing (S, Q, and LL(k) grammar, recursive descent parsing)
- Bottom-up parsing (shift-identify, shift-reduce, LR parsing)
- Parser generators
- Abstract syntax trees, Attributed syntax trees, High-level program representations such as abstract syntax trees, Scope and binding resolution
- Type checking, Attribute and attribute-translation grammars
- Midterm exam
- Run-time representation of core language constructs such as objects (method tables) and first-class functions (closures), Run-time layout of memory: call-stack, heap, static data, Procedure calls and method dispatching
- Memory management, Manual memory management: allocating, de-allocating, and reusing heap memory, Automated memory management: garbage collection as an automated technique using the notion of reachability, Dynamic memory management approaches and techniques: malloc/free, garbage collection
- Data layout for objects and activation records, Just-in-time compilation and dynamic recompilation, Other common features of virtual machines, such as class loading, threads, and security, Static and dynamic linking
- Basic blocks, Static single assignment, Source code, native code, and virtual machine code, Separate compilation; Linking, Absolute, relocatable, and virtual machine target code, Syntax-driven code generation, Intermediate code generation
- Control-flow graphs, Def-use chains, Instruction scheduling, Instruction selection, Register allocation
- Implementing loops, recursion, and tail calls, Machine-independent optimization, Machine-dependent optimization, Peephole optimization
- Final exam
Literature
Siniša Srbljić (2009.), Prevođenje programskih jezika, Element
General
ID 209708
Winter semester
5 ECTS
L3 English Level
L2 e-Learning
60 Lectures
0 Seminar
0 Exercises
10 Laboratory exercises
0 Project laboratory
0 Physical education excercises
Grading System
88 Excellent
75 Very Good
63 Good
50 Sufficient