Course Code: Ν2-5020
Weekly Duty: 4 (2Th + 2L)
Typical Semester: 5th
Course Category: Special Infrastructure Course
Prerequisites: Computer Programming

Learning Outcomes

The purpose of this course is to familiarize students with the basic structure of a compiler, to explain how the different compilation phases work.

The course aims to offer students the opportunity to integrate and synthesize their knowledge relating to operating systems, computer organization, languages and automata theory, data structures and programming.

More specifically, the learning objectives of the course are students, after completion of the course, be able to:

  • describe the role of a compiler and distinguish the compiler’s phases and its differences and relations with other related software like preprocessors, interpreters, debuggers, linkers, loaders etc.
  • recognize the importance of grammar to develop a compiler, describe the grammar of a programming language using regular expressions and production rules, describe finite state automata and
  • understand their role as recognition engines

  • describe the operation steps of a top-down and a down-up parser and how they can be created with the help of a programming language like C and generators like flex and bison
  • describe the role of the symbol table and the importance of the suitability of its structure and organization
  • recognize the concept of intermediate code, how to create and how to optimize it
  • recognize the characteristics of a final code execution environment.

Course Content

Introduction to computer language processors, compilation phases, interpretation, virtual machines, programming languages. Grammars, regular expressions, finite automata, transition tables. Lexical analysis, implementation techniques, lexical errors handling, use of lexical analyzer generators. Syntax analysis – context free grammars, ambiguous grammars, productive rules, top-down parsing, bottom-up parsing, LR(k) parsing, syntax errors handling, use of syntax analyzer generators. Semantic analysis, type checking. Intermediate code generation, intermediate languages, translation to intermediate code. Intermediate code optimization. Code generation – register allocation, storage management, etc. Code optimization. linking and loading of executable programs to memory.

Practical work in the use of flex and bison for generating lexical and syntax analyzers.

  1. Aho V. Alfred, Sethi Ravi and Jeffrey D. Ullman, Μεταγλωττιστές: Αρχές, Τεχνικές & εργαλεία, Επιμέλεια Ελληνικής Έκδοσης: Παναγιώτης Σπ. Αλεφραγκής – Αγγελος Σπ. Βώρος – Νικόλαος Σπ. Βώρος – Κων/νος Ν. Μασσέλος, Εκδόσεις Νέων Τεχνολογιών, 2012.
  2. Παπασπύρου Ν.και Σκορδαλάκης Ε. Μταγλωττιστές, Εκδόσεις Συμμετρία, 2002.
  3. Κ. Λάζος, Π. Κατσαρός, Ζ. Καραΐσκος. Μεταγλωττιστές Γλωσσών Προγραμματισμού: θεωρία και πράξη. Εκδόσεις Θεσαλλονίκη 2004.
  4. Γεωργούλη Κ. και Ξανθάκης Σ., Επεξεργαστές Γλωσσών Προγραμματισμού, Εκδόσεις Νέων Τεχνολογιών, 1992
  5. Grune D., Bal H., Jacobs C. and Langendoen K., Modern Compiler Design, Wiley, 2000.
  6. Andrew W. Appel, Modern Compiler Implementation in Java. Cambridge University Press, 1998.
  7. Alblas H and Nymeyer A., Practice and Principles of Compiler Building with C, Prentice Hall, 1996.

Internationalisation I18n