Introduction:Decomposition of a compiler into front end and back end. Compiler as a staged pipeline. Choosing the source program language and the target assembler.
Lexical analysis:describing programming language symbols with regular expressions, breaking the compiled program into lexical tokens Homework: construction of lexical analyzer based on finite automata.
Parsing:describing syntax with a context-free grammar, parsing procedure and error recoveryHomework: construction of stack-based LR(k) syntax analyzer
Abstract syntax:simplified internal representation of the compiled programHomework: generating an abstract syntax tree of the compiled program.
Semantic analysis:type checking, unreachable code detection,…Homework: construction of semantic analyzer for type-checking.
Activation records:description of records for activation of nested or recursive functions, and their implementation with stack or heap.Homework: activation records design
Intermediate code:tree- or instruction-based intermediate code, temporary variables, translation to intermediate code.Homework: construction of intermediate code generator
Basic blocks:canonization of calls and jumps in intermediate code, grouping of statements into basic blocks, permutation of basic blocksHomework: formation of basic blocks
Instruction selection:translation of intermediate code to target assembler using only temporary variablesHomework: target code generator (without register allocation)
Liveness analysis:activity analysis of temporary variables based on flow graphs and dataflow equations.Homework: construction of a flow graph.
Register allocation:coloring of inference graphs, spilling temporary variables into activation records.Homework: allocation of registers to temporary variables and spilling.
Conclusion:
Homework: integration of earlier homework into a working compiler.
Compilers
Boštjan Slivnik
Andrew W. Appel, Modern Compiler Implementation in Java, Cambridge University Press, 2002.
Boštjan Vilfan, Prevajanje programskih jezikov, 1. del, Fakulteta za elektrotehniko in računalništvo, 1991.
Steven Muchnick, Advanced Compiler Design and Implementation, Morgan Kaufmann, 1997.
Presentation of compiler architecture and functional parts, as well as construction and implementation of a working compiler from a chosen programming language into assembler.
General competences:
The ability to understand and solve professional challenges in computer and information science
The ability to define, understand and solve creative professional challenges in computer and information science,
The ability to apply acquired knowledge in independent work for solving technical and scientific problems in computer and information science, the ability to upgrade acquired knowledge
Subject-specific competences:
Practical knowledge and skills of computer hardware, software and information technology necessary for successful professional work in computer and information science
The ability to independently perform both less demanding and complex engineering and organisational tasks in certain narrow areas and independently solve specific well-defined tasks in computer and information science
Basic skills in computer and information science, allowing the continuation of studies in the second study cycle
Knowledge and understanding:
Understanding the workings of a modern compiler implies familiarity with algorithms for syntax and semantic program analysis, generation of intermediate and target machine code, as well as awareness of compilers’ limitations. By knowing all this, one also knows and understands how compiled programs work.
Application:
Compiler is a fundamental software development tool, and therefore the acquired knowledge is (explicitly or implicitly) useful in all programming tasks.
Reflection:
Understanding of relations between writing programs and their execution.
Transferable skills:
Algorithms for analysis of structured texts, writing efficiently coded programs.
Lectures and homework with explicit focus on simultaneous studies (for homeworks).
Continuing (homework, midterm exams, project work)
Final (written exam)
grading: 5 (fail), 6-10 (pass) (according to the Statute of UL)
SLIVNIK, Boštjan. LL conflict resolution using the embedded left LR parser. Computer science and information systems, ISSN 1820-0214. [Print ed.], Sep. 2012, vol. 9, no. 3, str. 1105-1124, ilustr. [COBISS-SI-ID 9583700]
POTOČNIK, Matic, ČIBEJ, Uroš, SLIVNIK, Boštjan. Linter - a tool for finding bugs and potential problems in Scala code. V: Proceedings of the 29th Annual ACM Symposium on Applied Computing, Gyeongju, Korea, March 24-28, 2014, Proceedings of the 29th Annual ACM Symposium on Applied Computing, Gyeongju, Korea, March 24-28, 2014. [S. l.]: Association for Computing Machinery, cop. 2014, str. 1615-1616, graf. prikazi. [COBISS-SI-ID 10520660]
SLIVNIK, Boštjan. LLLR parsing. V: Proceedings of the 28th annual ACM Symposium on Applied Computing 2013, Coimbra, Portugal, March 18-22. [S. l.]: Association for Computing Machinery, 2013, str. 1698-1699. [COBISS-SI-ID 9735508]
SLIVNIK, Boštjan. The embedded left LR parser. V: GANZHA, Maria (ur.), MACIASZEK, Leszek (ur.), PAPRZYCKI, Marcin (ur.). FedCSIS : proceedings of the Federated Conference on Computer Science and Information Systems, September 18-21, 2011, Szczecin, Poland. Los Alamitos: IEEE Computer Society Press, 2011, str. 871-878, graf. prikazi. [COBISS-SI-ID 8628564]
SLIVNIK, Boštjan, VILFAN, Boštjan. Producing the left parse during bottom-up parsing. Information processing letters, ISSN 0020-0190. [Print ed.], Dec. 2005, vol. 96, no. 6, str. [220]-224. [COBISS-SI-ID 5075284]
SLIVNIK, Boštjan, VILFAN, Boštjan. Improved error recovery in generated LR parsers. Informatica, ISSN 0350-5596, 2004, vol. 28, no. 3, str. 257-263, ilustr. [COBISS-SI-ID 4902484]