Subject: Compiler and Languages Theory

Scientific area:

Computing

Contact hours:

64 Hours

Number of ECTS:

6 ECTS

Language:

Portuguese

General Objectives:

1 - Understand the foundations of formal languages, grammars, regular expressions, finite automata, and pushdown automata.
2 - Analyse equivalence and properties of languages, grammars, and automata, including minimisation and recognition techniques.
3 - Apply lexical, top-down and bottom-up syntactic, and semantic analysis methods for programming languages.
4 - Design and implement lexical analysers, parsers, symbol tables, type checkers, and code-generation mechanisms.
5 - Use parser-generation tools, particularly ANTLR, to build compilers, translators, and simple programming languages.
6 - Formulate and solve compilation problems by integrating mathematical, scientific, and engineering knowledge.
7 - Collaborate effectively in projects, communicate technical decisions clearly, and develop autonomous learning skills in response to technological change.

Contents / Syllabus:

1 - Equivalence between regular languages, regular grammars, regular expressions/equations, and deterministic, nondeterministic, and epsilon-transition finite automata.
2 - Conversion between formalisms for the specification and recognition of regular languages.
3 - Properties of regular sets, including closure operations, finite-automata minimisation, and the pumping lemma.
4 - Context-free languages: derivations, derivation trees, grammar transformations, and Chomsky and Greibach normal forms.
5 - Pushdown automata, generalised and deterministic pushdown automata, and empty-stack language recognition.
6 - Top-down and bottom-up parsing, including LL(k) and LR(k) languages, First and Follow sets, and parsing tables.

Bibliography / Information Sources:

Leonel Nóbrega , 2020 , Sebenta de Teoria das Linguagens e Compiladores ,
Alfred Aho, Ravi Sethi, Jeffrey Ullman , 2006 , Compilers: Principles, Technics and Tools , Addison-Wesley
John E. Hopcroft, Rajeev Motwani, Jeffrey Ullman , 2006 , Introduction to Automata theory, Languages and Computation (3rd Ed) , Pearson
Kenneth C Louden , 1997 , Compiler Construction: Principles and Practice , PWS Pub. Co.
Rui Gustavo Crespo , 2001 , Processadores de Linguagens, da Concepção à Implementação , IST Press

Assessment Methods and Criteria:

Classification Type: Quantitativa (0-20)

Evaluation Methodology:
The course follows an integrated teaching approach, combining theoretical exposition, guided problem solving, and practical development. Each topic is introduced through motivating examples, followed by the formalisation of concepts, definitions, properties, and algorithms, and their application to problem solving. Classes include exercises on constructing and transforming grammars and automata, language analysis, parsing-table construction, and the application of lexical, syntactic, and semantic analysis techniques. Learning and development tools are used, including ANTLR for parser and translator generation, linking theoretical foundations with the implementation of language-processing systems. Practical work is carried out in groups of two students and involves developing an application such as a calculator, translator, or compiler for a simple language. The project includes implementation, source-code submission, a report explaining technical decisions, and a functional presentation/demonstration. This component promotes autonomy, collaboration, technical communication, and problem-solving skills. Assessment includes two individual written tests, assessing theoretical knowledge and its application, and a group practical project. The written tests account for 90% of the final grade (45% each), while the project accounts for 10%. Students who do not pass during the regular assessment period may take the written tests during the resit period.