1 / 17

About the structure of a compiler construction course

About the structure of a compiler construction course. Dragan Boji ć ETF Belgrade With credits to Zoran Budimac. Summary of Answers to the Questionnaire – Ber , NS , Bg. Relation to the corresponding course: 2 : Already teach the corresponding course

andred
Download Presentation

About the structure of a compiler construction course

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. About the structure of a compiler construction course Dragan Bojić ETF Belgrade With credits to Zoran Budimac 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  2. Summary of Answers to the Questionnaire – Ber, NS, Bg • Relation to the corresponding course: 2: Already teach the corresponding course 1: Do not teach, but willing to participate in creation of joint course materials 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  3. Summary of Answers... Lecturer’s availability and willingness: • to CREATE joint teaching materials • 2 very good • 1 fair • to USE joint teaching materials • 3 very good 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  4. Summary of Answers... • Place of the course in the curriculum BER: 3rd semester, 60 + 30 hours, ~150 students NS: 7&8 semester, 60 + ? Hours BG: 7&8 semester, 70 + 56 hours, ~90 students 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  5. Summary of Answers... • Methodology, exams, and grade BER: students required to finish a practical project NS: before: written & oral exam now: pass if regular practical work, otherwise oral exam BG: obligatory practical homework (one time) + written & oral exam 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  6. Summary…Teaching Materials Sources of the course contents and materials 1 - almost completely my own 1 - partly my own and partly taken from several sources 1 - almost completely rely on the specific literature Availability of teaching materials 3 – electronic form (in German or in Serbian) 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  7. Summary…Topics Note: NS and BER have basically the same curriculum and are using the case study to drive the course. Other topics (independent of the case study) are also covered (other methods of Syntax analysis, for example). On the other hand, Bg curriculum is mostly theoretical and covers more concepts. 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  8. Summary…Topics NS and B • Overview: Fundamentals, subtasks of a compiler, pass structures • Elements of automata theory and formal language theory, incl. grammars • Introduction to the prog. language used in case study • Lexical analysis • Syntax analysis: LL(1), Recursive descent, LL(K), LR(K) • Semantic analysis (and symbol tables) • Definition of the target language (virtual machine) and code interpretation • Code generation • Elements of code optimization 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  9. Summary…Topics Belgrade • Lexical analysis • Finite state automata. • Regular expressions. • Deterministic and non-deterministic automata. • Minimization of automata. • Automata implementation techniques. • Keyword recognition techniques. • Lexical analyzer generators. • Context free grammars. • Formal languages and grammars. • Grammar transformations. • Ambiguous grammars. • Regular and right-linear grammars. • Pushdown automata. • Translation. • Cycling. 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  10. Summary…Topics Belgrade (…) • Syntax directed translation. • attributive-translation grammars. • Top-down analysis. • Parser construction for S, Q and LL(1) grammars. • Error recovery. • Recursive descent method. • Parser construction for L attributive translation grammars. • Bottom-up analysis. • Shift-identify parsers. • Shift-reduce parsers. • Error recovery. • LR i SLR grammars. • Processing of S attributive translation grammars. 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  11. Summary…Topics Belgrade (…) • Run time environment. • Memory allocation strategies. • Activation records. • Static scope with and without procedure nesting. • Access links and Displays. • Dynamic scope. • Parameter passing mechanisms. • Construction of symbol tables. • Equivalence trees. • Code generation. • Selection of instructions • Register allocation. • Basic blocks and flow graphs. • Basic block transformations. • Simple code generator. 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  12. Summary…Case Studies BER: Pascal to P Code Compiler written in C (2500 LOC). There is also Java implementation with visual components. NS: Pascal compiler written in Modula 2 (translation of the original Pascal implementation from [Hansen]) BG: Small parts of Ada/CS compiler written in ADA from [LeBlanc]. Small parts of sampleC compiler written in C from [Schreiner et al]. Small parts of Basic Interpreter from [Lewis et al]. 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  13. Summary…Recommended Literature BER: ? NS: 1. B. Hansen: “On Pascal Compilers”, Prentice-Hall, 1985. 2. J.P.Tremblay, P.G.Sorenson: “ The Theory and Practice of Compiler Writing”, John Wiley & Sons, 1985. BG: 1. P.M. Lewis, D. J. Rosenkrantz, R.E. Stearns, Compiler Design Theory, Addison-Wesley, 1976. 2. A. R. Sethi, J.D. Ullman, Compilers/Principles, Techniques and Tools, Addison-Wesley, 1986 • C. Fischer, R. LeBlanc, Crafting a Compiler, Benjaming-Cummings 1988 • A. Schreiner, H.G. Friedman, Introduction to Compiler Construction with UNIX, Prentice-Hall, 1985 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  14. Summary…Improvements BER: • New topics: translation of OO constructs, optimizations • New case study (input language should not be Pascal) NS: • To add more theory • New case study (Java as an implementation language) • To make course more interesting to students BG: • To add a complete case study • To omit some topics, to add new about OO constructs • To make course more interesting to students (“pure theoretical” approach not very attractive) 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  15. Possible path to the Joint Course • JCCC should be based on particular compiler as case study (% of lectures) and other theoretical parts not related to the case study • Transition path for BER and NS to JCCC: • Change of case study • Introduction of some new theoretical topics • Transition path for BG to JCCC: • Introduction of complete case study • Less theory, more practical approach 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  16. Candidates for a new Case Study • + = desirable • Real life input languages and educational languages (+) • Object-orientation in the input language (+), and/or OO in compiler implementation • Contemporary implementation language (+) 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

  17. Candidates for a new Case Study • KJC/Kopi and IBM Jikes: open source full (-) java compilers and VM written in java/C++ • Tiger – edu, nonOO (-)target language, impl in Java, good book(+), funct. Style (-) • Microsoft Rotor – ‘edu” C# compiler and .NET runtime written in C# (complex -) • microJava: prof. Mössenböck, Univ. of Linz, subset of java, VM, written in java – very interesting alternative, no(?) book, but there is 20page specification of language syntax and VM. 4th Workshop “Software Engineering Education and Reverse Engineering” Zagreb 5 – 12 September 2004

More Related