Download presentation
Presentation is loading. Please wait.
1
Goran Šuković, University of Montenegro 1/21 Compiler Construction Course at University of Montenegro 7 th Workshop on “Software Engineering Education and Reverse Engineering”, Risan, 9 – 14. Sep. 2007.
2
Goran Šuković, University of Montenegro 2/21 Agenda History History Module structure Module structure Workload Workload Learning outcomes Learning outcomes Lectures and practicals Lectures and practicals Recommended books Recommended books Future Future
3
Goran Šuković, University of Montenegro 3/21 History (1) Started in 1988 – professor Ratko Orlandić Started in 1988 – professor Ratko Orlandić one-semester elective module for 4th year students, Mathematics and Computer Science programme one-semester elective module for 4th year students, Mathematics and Computer Science programme 2 lectures + 2 practicals per week 2 lectures + 2 practicals per week From 1993 – compulsory module From 1993 – compulsory module
4
Goran Šuković, University of Montenegro 4/21 History (2) 2001 – first major revision 2001 – first major revision one-semester compulsory module for 3 rd year students, academic studies, Computer Science programme, Mathematics and Computer Science programme, and also applied studies one-semester compulsory module for 3 rd year students, academic studies, Computer Science programme, Mathematics and Computer Science programme, and also applied studies 3 lectures + 2 practicals per week 3 lectures + 2 practicals per week 2006 – new revision, 2 lectures + 2 practicals, 5 ECTS credits, starting in 2008 2006 – new revision, 2 lectures + 2 practicals, 5 ECTS credits, starting in 2008
5
Goran Šuković, University of Montenegro 5/21 Why to study compilers? The number of people who write compilers is small, so why is a module about compiler construction a compulsory part of a computer science course? The number of people who write compilers is small, so why is a module about compiler construction a compulsory part of a computer science course? One reason is that, though few graduates of the course will end up writing compilers, all will have to use them One reason is that, though few graduates of the course will end up writing compilers, all will have to use them Many of the techniques used in compilers have application in other areas such as dialogue and human-computer interface design Many of the techniques used in compilers have application in other areas such as dialogue and human-computer interface design
6
Goran Šuković, University of Montenegro 6/21 Module structure Number of ECTS credits: 6 Number of ECTS credits: 6 Prerequisite knowledge Prerequisite knowledge –Students must have a prior knowledge of programming in C Prerequisite modules Prerequisite modules –Programming I –Programming II
7
Goran Šuković, University of Montenegro 7/21 Taken by academic studies, Computer Science programme academic studies, Computer Science programme academic studies, Mathematics and Computer Science programme academic studies, Mathematics and Computer Science programme applied studies, Information technologies programme applied studies, Information technologies programme
8
Goran Šuković, University of Montenegro 8/21 Workload Lectures: 14 x 2 hr 15 min lectures. Lectures: 14 x 2 hr 15 min lectures. Practicals: 14 x 1 hr 30 min practical. Practicals: 14 x 1 hr 30 min practical. Private study: 74.5 hrs. Private study: 74.5 hrs. Assessment: Assessment: –Midterm – 3 hours written exam (worth 35 marks) –Final – 3 hours written exam (worth 35 marks) –Homeworks – 6 HW (worth 4 marks each) –Quizzes – 3 quizzes (worth 2 marks each)
9
Goran Šuković, University of Montenegro 9/21 Learning Outcomes (1) The aim of this module is to introduce the student to the theory and practice of programming language compilation The aim of this module is to introduce the student to the theory and practice of programming language compilation It works through the “front end” of compilation: lexical and syntax analysis. By the middle of the module the student will be in a position to write a lexical scanner and a parser for a context-free language, including the use of compiler tools It works through the “front end” of compilation: lexical and syntax analysis. By the middle of the module the student will be in a position to write a lexical scanner and a parser for a context-free language, including the use of compiler tools Student will also have a solid understanding on the underlying theory of formal languages Student will also have a solid understanding on the underlying theory of formal languages
10
Goran Šuković, University of Montenegro 10/21 Learning Outcomes (2) Student should have a better appreciation of good programming practice in terms of program compilation Student should have a better appreciation of good programming practice in terms of program compilation Student should be able to describe compiler construction methods and algorithms, and especially apply them to examples Student should be able to describe compiler construction methods and algorithms, and especially apply them to examples Student be able to implement the "back end" of a compiler for a simple programming language using the techniques presented in the lectures Student be able to implement the "back end" of a compiler for a simple programming language using the techniques presented in the lectures
11
Goran Šuković, University of Montenegro 11/21 Learning Outcomes (3) Student assess the advantages of standard programming language features with respect to their implementation and performance costs Student assess the advantages of standard programming language features with respect to their implementation and performance costs Student read critically a programming language specification Student read critically a programming language specification
12
Goran Šuković, University of Montenegro 12/21 Content – Lectures (1) Introduction to compiling Introduction to compiling Automata. Regular expressions. Intro to lexical analysis Automata. Regular expressions. Intro to lexical analysis Lexical analysis. Flex. Grammars and languages Lexical analysis. Flex. Grammars and languages Top-down parsing Top-down parsing Bottom-up parsing. LR(0), LR(1), and SLR(1) Bottom-up parsing. LR(0), LR(1), and SLR(1) LALR parsers LALR parsers Syntax-directed translation Syntax-directed translation
13
Goran Šuković, University of Montenegro 13/21 Content – Lectures (2) Semantical analysis. Type checking for imperative languages Semantical analysis. Type checking for imperative languages Run-time organization Run-time organization Object-oriented languages Object-oriented languages Intermediate languages Intermediate languages Code generation Code generation Program analysis and transformation Program analysis and transformation Dataflow analysis Dataflow analysis Loop optimization. Register allocation Loop optimization. Register allocation
14
Goran Šuković, University of Montenegro 14/21 Content – Practicals (1) DFA and NFA DFA and NFA Regular expressions. Transforming regular expressions to NFA Regular expressions. Transforming regular expressions to NFA Transforming NFA to DFA. Minimizing number of states in DFA Transforming NFA to DFA. Minimizing number of states in DFA FLEX examples FLEX examples Writing and transforming context-free grammars Writing and transforming context-free grammars
15
Goran Šuković, University of Montenegro 15/21 Content – Practicals (2) BISON examples BISON examples Intermediate code examples Intermediate code examples Overview of MIPS Overview of MIPS Using SPIM Using SPIM Generating MIPS from AST Generating MIPS from AST
16
Goran Šuković, University of Montenegro 16/21 Homeworks 1 st HW – Automata 1 st HW – Automata 2 nd HW – Flex for Decaf 2 nd HW – Flex for Decaf 3 rd HW – Grammars and languages 3 rd HW – Grammars and languages 4 th HW – Building AST for Decaf using Bison 4 th HW – Building AST for Decaf using Bison 5 th HW – Semantic analyzer for Decaf 5 th HW – Semantic analyzer for Decaf 6 th HW – MIPS Code Generation 6 th HW – MIPS Code Generation
17
Goran Šuković, University of Montenegro 17/21 Recommended Books Torczon, Cooper - Engineering a Compiler, Morgan Kaufmann 2002 Torczon, Cooper - Engineering a Compiler, Morgan Kaufmann 2002 Aho A.V. et al. - Compilers: Principles, Techniques and Tools, 2 nd Edition, Addison Wesley 2006 Aho A.V. et al. - Compilers: Principles, Techniques and Tools, 2 nd Edition, Addison Wesley 2006 Andrew W. Appel - Modern Compiler Implementation in C/Java/ML, Cambridge University Press 1998/2002 Andrew W. Appel - Modern Compiler Implementation in C/Java/ML, Cambridge University Press 1998/2002 D Grune et al. - Modern Compiler Design, Wiley 2000 D Grune et al. - Modern Compiler Design, Wiley 2000
18
Goran Šuković, University of Montenegro 18/21 Teaching Materials Notes and exercise sheets are provided Notes and exercise sheets are provided Copies of slides and examples used in lectures can be downloaded from the module web page Copies of slides and examples used in lectures can be downloaded from the module web page Information and feedback are posted on the module web pages (www.pmf.cg.ac.yu) Information and feedback are posted on the module web pages (www.pmf.cg.ac.yu)www.pmf.cg.ac.yu
19
Goran Šuković, University of Montenegro 19/21 Students (2006-7) Bologna students Non Bologna 20 students, 14 passed, A – 0 B – 3 C – 3 D – 2 E – 6 F – 6 26 students, 12 passed 10 – 0 9 – 0 8 – 1 7 – 6 6 – 5 5 – 14
20
Goran Šuković, University of Montenegro 20/21 Student' remarks Practicals/exams/lecturer are too demanding Programming in C is very hard I need more time for homeworks I don't know how to use pointers in C... read data from files... start Flex...
21
Goran Šuković, University of Montenegro 21/21 Future From 2008 From 2008 –Substantial reduction of lectures –Less demanding homeworks –Using Java instead C –Using JLex and JBison instead Flex and Bison –MIPS or x86 or... More information More information –www.pmf.cg.ac.yu www.pmf.cg.ac.yu –compilers@rc.pmf.cg.ac.yu
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.