Formal Languages and Compilers
IFJ Acad. year 2022/2023 Winter semester 5 credits
This course discusses formal languages and their models. Based on these models, it explains the construction of compilers. The lectures are organized as follows: (I) Basic notions: formal languages and their models, grammars, automata; compilers. (II) Regular languages and lexical analysis: regular languages and expressions, finite automata and transducers, lexical analyzer; Lex; symbol table. (III) Context-free languages and syntax analysis: context-free grammars, pushdown automata and transducers, deterministic top-down syntax analysis (recursive descent), the essence of deterministic bottom-up syntax analysis; Yacc. (IV) Semantic analysis and code generation: semantic checks, intermediate code generation, optimization, code generation.
Language of instruction
- 39 hrs lectures
- 13 hrs projects
- 55 pts final exam (written part)
- 20 pts mid-term test (written part)
- 25 pts projects
Course Web Pages
Subject specific learning outcomes and competences
Fundamental familiarity with the theory of formal languages. The ability of a compiler construction.
Familiarity with formal languages and their models. Grasp of compiler construction.
Why is the course taught
The IFJ class gives a clear, comprehensive introduction to formal language theory and its applications in computer science for undergraduate students. It covers all rudimental topics concerning formal languages and their models, especially grammars and automata, and sketches the basic ideas underlying the theory of computation, including computability and decidability. Emphasizing the relationship between theory and application, the class describes many real-world applications, including computer science engineering techniques for language processing and their implementation.
More specifically, IFJ
- Covers the theory of formal languages and their models, including all essential concepts and properties
- Explains how language models underlie compilers
- Pays a special attention to programming language analyzers, such as scanners and parsers, based on four language models-regular expressions, finite automata, context-free grammars, and pushdown automata
- Discusses the mathematical notion of a Turing machine as a universally accepted formalization of the intuitive notion of a procedure
- Covers the general theory of computation, particularly computability and decidability
In short, this class represents a theoretically oriented treatment of formal languages and their models with a focus on their applications. It introduces all formalisms concerning them with enough rigor to make all results quite clear and valid. Every complicated mathematical passage is preceded by its intuitive explanation so that even the most complex parts of the class are easy to grasp. After taking this class, students should be able to understand the fundamental theory of formal languages and computation, write compilers, and confidently follow the most advanced books on the subject.
- Discrete Mathematics (IDM)
Prerequisite knowledge and skills
Knowledge of discrete mathematics.
- Copy of lectures (electronic and paper)
- Meduna, A.: Automata and Languages. London, Springer, 2000.
- Meduna, A.: Elements of Compiler Design. New York, US, Tailor & Francis, 2008.
- Meduna, A.: Formal Languages and Computation. New York, Taylor & Francis, 2014.
- Parsons, T. W.: Introduction to Compiler Construction. Freeman, New York, 1992.
Syllabus of lectures
- Formal languages.
- Translation of languages and the structure of a compiler.
- Regular languages and their models: regular expressions and finite automata.
- Lexical analysis: lexical analyzer; Lex; symbol table.
- Context-free languages and their models: context-free grammars and pushdown automata.
- Syntax analysis: deterministic syntax analysis, FIRST and FOLLOW, LL grammars.
- Deterministic top-down syntax analysis: recursive descent.
- Deterministic bottom-up syntax analysis: simple precedence analysis; Yacc.
- Semantic analysis and intermediate form generation.
- Code generation.
- Chomsky hierarchy and the corresponding models.
- Remarks and summary. Preliminary discussion of the VYPe contents.
Syllabus - others, projects and individual work of students
Students in teams (3 through 4 students per a team) implement a compiler of a simple programming language (including a documentation).
There is a midterm test for 20 points without a spare or correction term. Students solve one team project during the semester (25 points) that is handed over before given deadline. Exam prerequisites: To be allowed to take the final written exam, the student has to obtain 20 points during the semester; out of these 20 points, at least four points have to be obtained for the programming part of the project.
In case of a serious obstacle (e.g. illness), the student should inform the faculty about that andsubsequently provide the evidence of such an obstacle.
- The midterm test takes place approximately in the middle of the semester without a spare or correction term (20 points). If student cannot attend the midterm test, (s)he can ask to derive points from the evaluation of his/her first attempt of the final exam. To enter the final exam in this case, at least 12 points from project are required.
- To apply theoretical knowledge, students work on a team project (25 points). Continuously, the team leader checks the team's progress. In case of illness of the most team members, the team can ask the responsible teacher to extend the time for the project.
- Finally, there is a final exam with two correction terms (55 points).
To be allowed to take the final written exam, the student has to obtain 20 points during the semester; out of these 20 points, at least 4 points have to be obtained for the programming part of the project.
|Mon||exam||2023-01-23||D0206 D105||14:00||16:00||IFJ: 1. oprava|
|Wed||exam||2022-11-02||E104 E105 E112||11:00||12:20||PZK St 2. 11. 2022 - Běh 1|
|Wed||lecture||3., 4., 5., 8., 11., 12., 13. of lectures||E104 E105 E112||11:00||13:50||320||2BIA 3BIT||xx 10 - 19||Meduna|
|Wed||lecture||6., 7., 9., 10. of lectures||E104 E105 E112||11:00||13:50||320||2BIA 3BIT||xx 10 - 19||Křivka|
|Wed||lecture||2022-09-21||E104 E105 E112||11:00||13:50||320||2BIA 3BIT||xx 10 - 19||Křivka, Meduna|
|Wed||exam||2022-11-02||E104 E105 E112||12:30||13:50||PZK St 2. 11. 2022 - Běh 2|
|Thu||exam||2022-11-03||D105||08:00||09:20||PZK Čt 3. 11. 2022 - Běh 3|
|Thu||lecture||1., 2., 3., 4., 5., 6., 7., 8., 10., 11., 12. of lectures||D105||08:00||10:50||320||2BIB 3BIT||xx 20 - 29||Burgetová|
|Thu||lecture||2022-12-15||D105||08:00||10:50||320||2BIB 3BIT||xx 20 - 29||Meduna|
|Thu||exam||2023-01-12||A112 A113 C228 D0206 D0207 D105 E104 E105 E112 G202 N103||09:00||11:50||IFJ: řádná|
|Thu||exam||2022-11-03||D105||09:30||10:50||PZK Čt 3. 11. 2022 - Běh 4|
Course inclusion in study plans