- Docente: Cosimo Laneve
- Credits: 6
- SSD: INF/01
- Language: Italian
- Teaching Mode: Traditional lectures
- Campus: Bologna
- Corso: Second cycle degree programme (LM) in Computer Science (cod. 6698)
Learning outcomes
Nowadays the software development requires fast and sophisticated code transformation and analysis tools. For example, Java code is verified by the Virtual Machine before execution to check basic correctness properties about the memory and the locks that are used. Facebook, before releasing its mobile apps, always submits them to a tool that finds bugs without running the code. The applications of performance-critical systems and asset-management systems would be impossible to build and evolve without compilers that derive correct and optimized machine code from high-level source code. The objective of this course is to discuss modern code transformation and analysis techniques and illustrate their implementation. For this reason, the course will refer to a framework, ANTLR, now widely used in academia and industry to build all sorts of languages, tools, and frameworks. For example, Twitter search uses ANTLR for query parsing, with over 2 billion queries a day. LEARNING OUTCOMES: At the end of the course, the student knows the fundamentals of code transformation and static analysis. He is able to apply the theory by extending a small, yet expressive and powerful language, by means of the ANTLR framework.
Course contents
Introduction to code transformation and analysis. The ANTLR framework and the corresponding Lexical and Syntactical Analysis. Semantic analysis: symbol table, type checking, static analysis of properties about resource and asset consumptions. Intermediate code generation for standard and advanced features of programming languages. Virtual Machines and Interpreters.
Readings/Bibliography
-
Cosimo Laneve: Note per il corso di Complementi di Linguaggi di Programmazione, 2025.
-
Torben Morgensen: Basics of Compiler Design. 2010.
- Terence Parr: Language Implementation Patterns. 2010
- material on the e-learning website
Teaching methods
Lectures, computing laboratory
Assessment methods
The exam consists of a written test and an oral examination.
The written test assesses whether the student has acquired skills in compilation and interpretation, with particular emphasis on the ability to solve compilation-related problems. It includes three exercises, and the maximum score for the written test is 27 points; the test is considered passed with a grade of 16 or higher. The oral examination involves a discussion of the preliminary development of a project that students carry out in groups of up to three people. The maximum score for the oral part is 5 points.
Teaching tools
Projector, blackboard, laptop, computing laboratory
Office hours
See the website of Cosimo Laneve