Organization of the New Course on Complier Construction in Novi Sad - PowerPoint PPT Presentation

About This Presentation
Title:

Organization of the New Course on Complier Construction in Novi Sad

Description:

Compiler generator Coco/R. Tasks: ... the concepts of scanning, parsing, name management in nested scopes, and ... The occurrence of an invalid character (e.g. ... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 33
Provided by: Bim90
Category:

less

Transcript and Presenter's Notes

Title: Organization of the New Course on Complier Construction in Novi Sad


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

2
Agenda
  • Previous CC Course
  • Current CC Course
  • Assessment by students in Novi Sad
  • Questionnaire and Exam results
  • JCCC Material
  • Conclusion

3
CC Course in Novi Sad
  • One of core software courses at Computer Science
    directions
  • 7th semester CC1 (obligatory), 8th semester CC2
    (elective), for students of
  • Computer Science,
  • Business Computer Science,
  • Teaching of Computer Science

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

5
Previous CC Course - Exercises
  • Students repeat and train practical skills gained
    during lectures
  • Several independent tasks small grammars
  • Implementation language is Modula-2
  • Compiler generator Coco/R
  • Tasks
  • Lexical and syntax analysis and some parts of
    semantic analysis using Coco/R
  • Hand written parsers (LA SA)
  • 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)

6
Agenda
  • Previous CC Course
  • Current CC Course
  • Assessment by students in Novi Sad
  • Questionnaire and Exam results
  • JCCC Material
  • Conclusion

7
Current CC Course
  • More theoretical approach on lectures
  • Course goes through all phases of a compiler
    writing
  • 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
  • Goals of the course
  • 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.
  • learn to transfer the skills also to general
    software engineering tasks

8
Current CC Course
  • Structure of Lectures
  • Overview (1 week)
  • Lexical Analysis (1 week)
  • Syntax Analysis (2 weeks) --- TEST
  • Attribute Grammars (1 week)
  • Symbol Table (2 weeks)
  • Code Generation (3 weeks) --- TEST
  • BU Parsing (2 weeks)
  • Compiler Generators (1 week) --- TEST

9
Current CC Course Exercises
  • Students should acquire practical skills in
    compiler writing
  • One (big) project divided in smaller subtasks
  • Students should write a small compiler for a
    Java-like language - MicroJava
  • The implementation language is also Java

10
Current CC Course Exercises
  • Study material
  • Teaching material (slides)
  • Description of the project
  • 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 object file format

11
Current CC Course Exercises
  • The project consists of three levels
  • 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 3 - deals with code generation for the
    MicroJava 1 TASK

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

13
Current CC Course Exercises
  • Level 1 Task 2
  • Syntax analysis
  • Implementation of a recursive descent parser for
    MicroJava
  • Without error handling stop on first error
  • The algorithm for recursive descent parser is
    explained
  • Given material
  • A complete grammar of MicroJava
  • A framework of Parser.java class
  • Test examples Programs in MicroJava

14
Current CC Course Exercises
  • Level 1 Task 3
  • Error handling
  • Modification of the parser and error() method
  • 2 kinds of algorithms
  • method with special anchors
  • method with general anchors
  • These 2 algorithms are explained in detail
  • Given material
  • Set of anchors

15
Current CC Course Exercises
  • Level 2
  • Semantic analysis
  • Symbol table handling and type checking
  • Semantic analyzer should check
  • Type compatibility
  • Predeclared names
  • Scope
  • Students should implement Obj.java, Struct.java,
    Scope.java and Tab.java classes and modify parser
  • The functionality of these classes is explained
  • Given material
  • Frameworks of Obj.java, Struct.java, Scope.java
    and Tab.java classes
  • Context conditions in the grammar
  • Test examples

16
Current CC Course Exercises
  • Level 3
  • Code generation
  • Generate code for the MicroJava Virtual Machine
    (stack machine)
  • 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
  • Given material
  • Full implementation of MicroJava VM
  • Decoder.java class for viewing generated code
  • Frameworks of Code.java, Item.java and Label.java
    classes
  • Test examples

17
Agenda
  • Previous CC Course
  • Current CC Course
  • Assessment by students in Novi Sad
  • Questionnaire and Exam results
  • JCCC Material
  • Conclusion

18
Assessment by students in Novi Sad
  • Questionnaire - students opinion
  • 52 students, 34 filled questionnaire
  • 26 questions
  • For every question grade 1 to 5
  • Meaning of answers
  • 1 I do not agree at all
  • 5 I agree completely

19
Agenda
  • Previous CC Course
  • Current CC Course
  • Assessment by students in Novi Sad
  • Questionnaire and Exam results
  • JCCC Material
  • Conclusion

20
Questionnaire - General
  • The organization of the course was good
  • 1 2 3 4 5
  • 1 1 2 14 16 AVERAGE 4.26
  • The possibility of passing the exam using
    colloquiums and tests is useful
  • 1 2 3 4 5
  • 2 2 2 9 19 AVERAGE 4.21
  • Type and difficulty of tasks are correct
  • 1 2 3 4 5
  • 1 2 14 12 5 AVERAGE 3.53
  • The amount of material is good
  • 1 2 3 4 5
  • 0 0 7 12 15 AVERAGE 4.24

21
Questionnaire - General
  • Lectures and exercises were good synchronized
  • 1 2 3 4 5
  • 0 0 8 9 17 AVERAGE 4.26
  • Teaching material is good
  • 1 2 3 4 5
  • 1 4 15 9 5 AVERAGE 3.38
  • The quality of course is good
  • 1 2 3 4 5
  • 0 0 8 18 8 AVERAGE 4.00
  • Course is useful
  • 1 2 3 4 5
  • 0 2 7 13 12 AVERAGE 4.03

22
Questionnaire - Lectures
  • Lectures were good prepared
  • 1 2 3 4 5
  • 0 1 2 12 19 AVERAGE 4.44
  • Teaching style is good
  • 1 2 3 4 5
  • 1 0 4 14 15 AVERAGE 4.24
  • I have learned enough during lectures
  • 1 2 3 4 5
  • 1 2 19 10 2 AVERAGE 3.29
  • Lecturer was willing to give additional answers
  • 1 2 3 4 5
  • 0 0 3 9 21 AVERAGE 4.55
  • The speed of presentation was adequate
  • 1 2 3 4 5
  • 0 3 9 12 10 AVERAGE 3.85
  • Generally, I am satisfied with the lectures
  • 1 2 3 4 5
  • 0 1 6 16 10 AVERAGE 4.06

23
Questionnaire Exercises
  • Exercises were good prepared
  • 1 2 3 4 5
  • 0 0 4 8 22 AVERAGE 4.53
  • Teaching style of assistant is good
  • 1 2 3 4 5
  • 0 1 3 8 22 AVERAGE 4.50
  • Assistant was willing to give additional answers
  • 1 2 3 4 5
  • 0 0 0 5 29 AVERAGE 4.85
  • I have learned enough during exercises
  • 1 2 3 4 5
  • 0 0 9 13 12 AVERAGE 4.09
  • The speed of presentation was adequate
  • 1 2 3 4 5
  • 0 0 5 14 15 AVERAGE 4.29
  • The difficulty of tasks was adequate
  • 1 2 3 4 5
  • 0 1 10 11 11 AVERAGE 3.97
  • Generally, I am satisfied with the exercises

24
Questionnaire - Effort
  • How many times did you miss lectures?
  • lt3 3-7 gt7
  • 24 9 1
  • How many times did you miss exercises?
  • lt3 3-7 gt7
  • 23 10 1
  • Did you need additional consultations?
  • YES NO
  • 7 27
  • 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?
  • AVERAGE 4.05

25
Exam results
  • 52 students, 41 passed the exam
  • 38 in January
  • 1 in April
  • 2 in June
  • Grade distribution (6-10)
  • 6 7 students
  • 7 14 students
  • 8 16 students
  • 9 2 students (oral exam)
  • 10 1 student (oral exam)

26
Agenda
  • Previous CC Course
  • Current CC Course
  • Assessment by students in Novi Sad
  • Questionnaire and Exam results
  • JCCC Material
  • Conclusion

27
JCCC - Material
  • Novi Sad
  • CC1 obligatory, CC2 elective
  • CC1 use Teaching material of prof. Mössenböck,
    Linz
  • CC2
  • More theoretical, Automata theory, Formal
    languages theory
  • Other parsing methods (LR, LALR)
  • Detailed presentation of code generation
  • Different techniques of code optimization
  • Exercises and practical work Real-world (more
    serious project)

28
JCCC - Material
  • Belgrad
  • CC1 obligatory, CC2 elective
  • CC1
  • Partially use teaching material of prof.
    Mössenböck, Linz,
  • more theory,
  • extended version of microJava with object
    inheritance
  • CC2
  • Similar to Novi Sad
  • .doc file

29
JCCC - Material
  • Possibilities to prepare common material
  • Belgrad is more ambitious then Novi Sad
  • Dragan want to prepare his own material and
    slides
  • But he has not time and appropriate motivation
    for that
  • Novi Sad
  • Will use Linz material, completely for CC1
  • We are willing to prepare presentations for CC2
    topics
  • But also seems that we have not appropriate
    motivation
  • Open Question Writing book
  • We have a lot of draft materials
  • Motivation? project, publishing,
  • Problem CC2 is elective, we do not expect
    students

30
Agenda
  • Previous CC Course
  • Current CC Course
  • Assessment by students in Novi Sad
  • Questionnaire and Exam results
  • JCCC Material
  • Conclusion

31
Conclusion Novi Sad Approach
  • Advantages of new course
  • Concepts of compiler construction are shown on
    formal way
  • Modern and object-oriented language is used (Java
    and Java byte code)
  • Most of students autonomously write important
    parts of compiler
  • Better students are able to write (almost) whole
    compiler
  • 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?)

32
Thank you for your attention
Write a Comment
User Comments (0)
About PowerShow.com