Presentation is loading. Please wait.

Presentation is loading. Please wait.

Organization of the New Course on Complier Construction in Novi Sad Vladimir Kurbalija, Mirjana Ivanović Department of Mathematics and Informatics University.

Similar presentations


Presentation on theme: "Organization of the New Course on Complier Construction in Novi Sad Vladimir Kurbalija, Mirjana Ivanović Department of Mathematics and Informatics University."— Presentation transcript:

1 Organization of the New Course on Complier Construction in Novi Sad Vladimir Kurbalija, Mirjana Ivanović Department of Mathematics and Informatics University of Novi Sad Serbia

2 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Agenda Previous CC Course Previous CC Course Current CC Course Current CC Course Assessment by students in Novi Sad Assessment by students in Novi Sad Questionnaire and Exam results Questionnaire and Exam results JCCC – Material JCCC – Material Conclusion Conclusion

3 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad CC Course in Novi Sad One of core software courses at Computer Science directions One of core software courses at Computer Science directions 7th semester CC1 (obligatory), 8th semester CC2 (elective), for students of 7th semester CC1 (obligatory), 8th semester CC2 (elective), for students of Computer Science, Computer Science, Business Computer Science, Business Computer Science, Teaching of Computer Science Teaching of Computer Science

4 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Previous CC Course Practical approach Practical approach Development of Pascal- compiler Development of Pascal- compiler Subset of Pascal language: Subset of Pascal language: data types: boolean and integer standard types, arrays and fixed records as structured types; data types: boolean and integer standard types, arrays and fixed records as structured types; basic statements: assignment statement, procedure call, if and while statements; basic statements: assignment statement, procedure call, if and while statements; Standard input/output ( read and write ) procedures, user defined procedures including recursion. Standard input/output ( read and write ) procedures, user defined procedures including recursion. The implementation: The implementation: recursive-descent manner for syntax analysis recursive-descent manner for syntax analysis code generation for abstract P machine code generation for abstract P machine

5 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Previous CC Course - Exercises Students repeat and train practical skills gained during lectures Students repeat and train practical skills gained during lectures Several independent tasks – small grammars Several independent tasks – small grammars Implementation language is Modula-2 Implementation language is Modula-2 Compiler generator Coco/R Compiler generator Coco/R Tasks: Tasks: Lexical and syntax analysis and some parts of semantic analysis using Coco/R Lexical and syntax analysis and some parts of semantic analysis using Coco/R “Hand written” parsers (LA & SA) “Hand written” parsers (LA & SA) “Hand written” parsers with semantic analysis and rarely with code generation or interpretation “Hand written” parsers with semantic analysis and rarely with code generation or interpretation Some algorithms on grammars (memory organisation, checking consistency, computing first and follow sets…) Some algorithms on grammars (memory organisation, checking consistency, computing first and follow sets…)

6 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Agenda Previous CC Course Previous CC Course Current CC Course Current CC Course Assessment by students in Novi Sad Assessment by students in Novi Sad Questionnaire and Exam results Questionnaire and Exam results JCCC – Material JCCC – Material Conclusion Conclusion

7 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course More theoretical approach on lectures More theoretical approach on lectures Course goes through all phases of a compiler writing Course goes through all phases of a compiler writing Shows the theoretical concepts underlying each phase as well as how to implement it efficiently Shows the theoretical concepts underlying each phase as well as how to implement it efficiently Examples: MicroJava compiler in Java, target language – subset of Java byte code Examples: MicroJava compiler in Java, target language – subset of Java byte code Goals of the course Goals of the course acquire the practical skills to write a simple compiler for an imperative programming language acquire the practical skills to write a simple compiler for an imperative programming language understand the concepts of scanning, parsing, name management in nested scopes, and code generation. understand the concepts of scanning, parsing, name management in nested scopes, and code generation. learn to transfer the skills also to general software engineering tasks learn to transfer the skills also to general software engineering tasks

8 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course Structure of Lectures Overview (1 week) Overview (1 week) Lexical Analysis (1 week) Lexical Analysis (1 week) Syntax Analysis (2 weeks) --- TEST Syntax Analysis (2 weeks) --- TEST Attribute Grammars (1 week) Attribute Grammars (1 week) Symbol Table (2 weeks) Symbol Table (2 weeks) Code Generation (3 weeks) --- TEST Code Generation (3 weeks) --- TEST BU Parsing (2 weeks) BU Parsing (2 weeks) Compiler Generators (1 week) --- TEST Compiler Generators (1 week) --- TEST

9 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Students should acquire practical skills in compiler writing Students should acquire practical skills in compiler writing One (big) project divided in smaller subtasks One (big) project divided in smaller subtasks Students should write a small compiler for a Java-like language - MicroJava Students should write a small compiler for a Java-like language - MicroJava The implementation language is also Java The implementation language is also Java

10 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Study material: Study material: Teaching material (slides) Teaching material (slides) Description of the project Description of the project Specification of MicroJava language (tokens, language grammar, semantic and context constraints) Specification of MicroJava language (tokens, language grammar, semantic and context constraints) Specification of MicroJava virtual machine (similar but simpler than Java VM) – Memory layout and Instruction set Specification of MicroJava virtual machine (similar but simpler than Java VM) – Memory layout and Instruction set Specification of object file format Specification of object file format

11 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises The project consists of three levels: The project consists of three levels: Level 1 – implementation of a scanner and a parser for the language MicroJava, error handling – 3 TASKS Level 1 – implementation of a scanner and a parser for the language MicroJava, error handling – 3 TASKS Level 2 - deals with symbol table handling and type checking – 1 TASK Level 2 - deals with symbol table handling and type checking – 1 TASK Level 3 - deals with code generation for the MicroJava – 1 TASK Level 3 - deals with code generation for the MicroJava – 1 TASK

12 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Level 1 – Task 1 Lexical analysis Lexical analysis Implementation of a scanner for MicroJava Implementation of a scanner for MicroJava Scanner should skip blanks, end of line characters, tabulator characters and comments Scanner should skip blanks, end of line characters, tabulator characters and comments Types of errors: Types of errors: The occurrence of an invalid character (e.g., $) The occurrence of an invalid character (e.g., $) A missing quote at the end of the character constant ('x) A missing quote at the end of the character constant ('x) Integer constants that are too large Integer constants that are too large Some algorithms for token recognition are explained Some algorithms for token recognition are explained Given material: Given material: A frameworks of Scanner.java and Token.java classes A frameworks of Scanner.java and Token.java classes Test examples Test examples

13 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Level 1 – Task 2 Syntax analysis Syntax analysis Implementation of a recursive descent parser for MicroJava Implementation of a recursive descent parser for MicroJava Without error handling – stop on first error Without error handling – stop on first error The algorithm for recursive descent parser is explained The algorithm for recursive descent parser is explained Given material: Given material: A complete grammar of MicroJava A complete grammar of MicroJava A framework of Parser.java class A framework of Parser.java class Test examples – Programs in MicroJava Test examples – Programs in MicroJava

14 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Level 1 – Task 3 Error handling Error handling Modification of the parser and error() method Modification of the parser and error() method 2 kinds of algorithms: 2 kinds of algorithms: method with special anchors method with special anchors method with general anchors method with general anchors These 2 algorithms are explained in detail These 2 algorithms are explained in detail Given material: Given material: Set of anchors Set of anchors

15 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Level 2 Semantic analysis Semantic analysis Symbol table handling and type checking Symbol table handling and type checking Semantic analyzer should check Semantic analyzer should check Type compatibility Type compatibility Predeclared names Predeclared names Scope Scope Students should implement Obj.java, Struct.java, Scope.java and Tab.java classes and modify parser Students should implement Obj.java, Struct.java, Scope.java and Tab.java classes and modify parser The functionality of these classes is explained The functionality of these classes is explained Given material: Given material: Frameworks of Obj.java, Struct.java, Scope.java and Tab.java classes Frameworks of Obj.java, Struct.java, Scope.java and Tab.java classes Context conditions in the grammar Context conditions in the grammar Test examples Test examples

16 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Current CC Course – Exercises Level 3 Code generation Code generation Generate code for the MicroJava Virtual Machine (stack machine) Generate code for the MicroJava Virtual Machine (stack machine) MicroJava Virtual Machine and its instruction set (57 instructions) are described in detail MicroJava Virtual Machine and its instruction set (57 instructions) are described in detail Students should implement Code.java, Item.java and Label.java classes and modify parser Students should implement Code.java, Item.java and Label.java classes and modify parser Given material: Given material: Full implementation of MicroJava VM Full implementation of MicroJava VM Decoder.java class for viewing generated code Decoder.java class for viewing generated code Frameworks of Code.java, Item.java and Label.java classes Frameworks of Code.java, Item.java and Label.java classes Test examples Test examples

17 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Agenda Previous CC Course Previous CC Course Current CC Course Current CC Course Assessment by students in Novi Sad Assessment by students in Novi Sad Questionnaire and Exam results Questionnaire and Exam results JCCC – Material JCCC – Material Conclusion Conclusion

18 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Assessment by students in Novi Sad Questionnaire - students opinion Questionnaire - students opinion 52 students, 34 filled questionnaire 52 students, 34 filled questionnaire 26 questions 26 questions For every question grade 1 to 5 For every question grade 1 to 5 Meaning of answers: Meaning of answers: 1 – “I do not agree at all” 1 – “I do not agree at all” 5 – “I agree completely” 5 – “I agree completely”

19 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Agenda Previous CC Course Previous CC Course Current CC Course Current CC Course Assessment by students in Novi Sad Assessment by students in Novi Sad Questionnaire and Exam results Questionnaire and Exam results JCCC – Material JCCC – Material Conclusion Conclusion

20 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Questionnaire - General The organization of the course was good The organization of the course was good 12345 1121416AVERAGE: 4.26 The possibility of passing the exam using colloquiums and tests is useful The possibility of passing the exam using colloquiums and tests is useful 12345 222919AVERAGE: 4.21 Type and difficulty of tasks are correct Type and difficulty of tasks are correct 12345 1214125AVERAGE: 3.53 The amount of material is good The amount of material is good 12345 0071215AVERAGE: 4.24

21 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Questionnaire - General Lectures and exercises were good synchronized Lectures and exercises were good synchronized 12345 008917AVERAGE: 4.26 Teaching material is good Teaching material is good 12345 141595AVERAGE: 3.38 The quality of course is good The quality of course is good 12345 008188AVERAGE: 4.00 Course is useful Course is useful 12345 0271312AVERAGE: 4.03

22 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Questionnaire - Lectures Lectures were good prepared Lectures were good prepared 12345 0121219AVERAGE: 4.44 Teaching style is good Teaching style is good 12345 1041415AVERAGE: 4.24 I have learned enough during lectures I have learned enough during lectures 12345 1219102AVERAGE: 3.29 Lecturer was willing to give additional answers Lecturer was willing to give additional answers 12345 003921AVERAGE: 4.55 The speed of presentation was adequate The speed of presentation was adequate 12345 0391210AVERAGE: 3.85 Generally, I am satisfied with the lectures Generally, I am satisfied with the lectures 12345 0161610AVERAGE: 4.06

23 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Questionnaire – Exercises Exercises were good prepared Exercises were good prepared 12345 004822AVERAGE: 4.53 Teaching style of assistant is good Teaching style of assistant is good 12345 013822AVERAGE: 4.50 Assistant was willing to give additional answers Assistant was willing to give additional answers 12345 000529AVERAGE: 4.85 I have learned enough during exercises I have learned enough during exercises 12345 0091312AVERAGE: 4.09 The speed of presentation was adequate The speed of presentation was adequate 12345 0051415AVERAGE: 4.29 The difficulty of tasks was adequate The difficulty of tasks was adequate 12345 01101111AVERAGE: 3.97 Generally, I am satisfied with the exercises Generally, I am satisfied with the exercises 12345 0041119AVERAGE: 4.44

24 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Questionnaire - Effort How many times did you miss lectures? How many times did you miss lectures? 7 7 2491 How many times did you miss exercises? How many times did you miss exercises? 7 7 23101 Did you need additional consultations? Did you need additional consultations? YESNO 727 By your own opinion, how many hours per week should be spent preparing for this course? By your own opinion, how many hours per week should be spent preparing for this course? AVERAGE: 5.66 How many hours per week did you spent preparing for this course? How many hours per week did you spent preparing for this course? AVERAGE: 4.05

25 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Exam results 52 students, 41 passed the exam 52 students, 41 passed the exam 38 in January 38 in January 1 in April 1 in April 2 in June 2 in June Grade distribution (6-10) Grade distribution (6-10) 6 – 7 students 6 – 7 students 7 – 14 students 7 – 14 students 8 – 16 students 8 – 16 students 9 – 2 students (+oral exam) 9 – 2 students (+oral exam) 10 – 1 student (+oral exam) 10 – 1 student (+oral exam)

26 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Agenda Previous CC Course Previous CC Course Current CC Course Current CC Course Assessment by students in Novi Sad Assessment by students in Novi Sad Questionnaire and Exam results Questionnaire and Exam results JCCC – Material JCCC – Material Conclusion Conclusion

27 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad JCCC - Material Novi Sad Novi Sad CC1 obligatory, CC2 elective CC1 obligatory, CC2 elective CC1 – use Teaching material of prof. Mössenböck, Linz CC1 – use Teaching material of prof. Mössenböck, Linz CC2 CC2 More theoretical, Automata theory, Formal languages theory More theoretical, Automata theory, Formal languages theory Other parsing methods (LR, LALR) Other parsing methods (LR, LALR) Detailed presentation of code generation Detailed presentation of code generation Different techniques of code optimization Different techniques of code optimization Exercises and practical work – Real-world (more serious project) Exercises and practical work – Real-world (more serious project)

28 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad JCCC - Material Belgrad Belgrad CC1 obligatory, CC2 elective CC1 obligatory, CC2 elective CC1 CC1 Partially use teaching material of prof. Mössenböck, Linz, Partially use teaching material of prof. Mössenböck, Linz, + more theory, + more theory, extended version of microJava with object inheritance extended version of microJava with object inheritance CC2 CC2 Similar to Novi Sad Similar to Novi Sad.doc file.doc file

29 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad JCCC - Material Possibilities to prepare common material Possibilities to prepare common material Belgrad is more ambitious then Novi Sad Belgrad is more ambitious then Novi Sad Dragan want to prepare his own material and slides Dragan want to prepare his own material and slides But he has not time and appropriate motivation for that But he has not time and appropriate motivation for that Novi Sad Novi Sad Will use Linz material, completely for CC1 Will use Linz material, completely for CC1 We are willing to prepare presentations for CC2 topics We are willing to prepare presentations for CC2 topics But also seems that we have not appropriate motivation But also seems that we have not appropriate motivation Open Question: Writing book Open Question: Writing book We have a lot of draft materials We have a lot of draft materials Motivation? – project, publishing, … Motivation? – project, publishing, … Problem: CC2 is elective, we do not expect students Problem: CC2 is elective, we do not expect students

30 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Agenda Previous CC Course Previous CC Course Current CC Course Current CC Course Assessment by students in Novi Sad Assessment by students in Novi Sad Questionnaire and Exam results Questionnaire and Exam results JCCC – Material JCCC – Material Conclusion Conclusion

31 V. Kurbalija, M. Ivanović Organization of the New Course on CC in Novi Sad Conclusion – Novi Sad Approach Advantages of new course: Advantages of new course: Concepts of compiler construction are shown on formal way Concepts of compiler construction are shown on formal way Modern and object-oriented language is used (Java and Java byte code) Modern and object-oriented language is used (Java and Java byte code) Most of students autonomously write important parts of compiler Most of students autonomously write important parts of compiler Better students are able to write (almost) whole compiler Better students are able to write (almost) whole compiler The exam can be passed during the semester – continual assessment The exam can be passed during the semester – continual assessment Some students complain that there is not enough literature on Serbian (enough motivation for book?) Some students complain that there is not enough literature on Serbian (enough motivation for book?)

32 Thank you for your attention


Download ppt "Organization of the New Course on Complier Construction in Novi Sad Vladimir Kurbalija, Mirjana Ivanović Department of Mathematics and Informatics University."

Similar presentations


Ads by Google