72671 - Complements of Programming Languages

Academic Year 2022/2023

  • 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. 5898)

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

  • 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 will verify that the student has acquired skills of compilation and interpretation, especially the ability to compilation problems. The exam also includes the development of a project.

Teaching tools

Projector, blackboard, laptop, computing laboratory

Office hours

See the website of Cosimo Laneve