RHODES UNIVERSITY


November Examinations - 2012


Computer Science 301 - Programming Language Translation

Examiners:                               Time: 4 hours
   Prof P.D. Terry                       Marks: 180
   Prof D.G. Kourie (Pretoria)           Venue: Hamilton Compass Laboratories

A copy of this document is available on the course web page. That copy will contain any last minute alterations, so make sure you study it closer to the time.


Rules and information


Section B - Practically oriented questions [80 / 180]

You will receive material relating to Section B at 08h00 on Sunday 25 November, the day before the examination. No details will be given until then, but it is safe to assume that Section B will contain a set of tasks that you could answer in a laboratory situation, similar in complexity and content to exercises you have done this year.

This year the format of the examination is again somewhat different from a few years ago, so as to counter what had happened become common practice: one solution was prepared by quite a large group and then passed around to many others, who had probably not contributed to it in any real way. This year you will receive a challenging problem at 08h00 and be encouraged to develop a solution. Later in the day you will receive further hints as to how this problem should be solved (by then you might have worked this out for yourselves, of course). You will be encouraged to study the problem and the hints in detail, because during the examination on Monday you will be set further questions relating to the system - for example, asked to extend the system in certain ways. It is my hope that if you have really understood the material on Sunday, these questions will have solutions that come readily to mind, but of course you will have to answer these on your own!

You might like to have a look at some old examinations on the Web Pages to see the sort of standard expected - but remember that old exam papers are "context sensitive", as they apply to a particular course at a particular time that covered material in slightly different ways to the course done this year.

The "24 hour" problems have all been designed so that everyone should have been able to produce at least the basic solution, with scope given for top students to demonstrate their understanding of the subtler points of parsing, scanning and compiling. Each year I have been astounded at the quality of some of the solutions received, and I trust that this year will be no exception.

Please note that there will be no obligation to produce a machine-readable solution in the examination (in fact doing so is quite a risky thing, if things go wrong for you, or if you cannot type quickly). The tools will be provided before the examination so that you can experiment in detail. If you feel confident, then you are free to produce a complete working solution to Section B during the examination. If you feel more confident writing out a neat detailed solution or extensive summary of the important parts of the solution, then that is quite acceptable. Many of the best solutions over the last few years have taken that form.


Examinable material

Please take note of the following summary of those sections of the textbook that are examinable. The complete (published) book has some sections that are not examinable.

   Chapter 1   -  All
   Chapter 2   -  All except 2.7 and 2.8
   Chapter 3   -  All
   Chapter 4   -  All except 4.11 and 4.12
   Chapter 5   -  5.1 ... 5.9
   Chapter 6   -  All
   Chapter 7   -  All
   Chapter 8   -  8.1 ... 8.8.  Sections 8.7 and 8.8 need not be known in detail, only the material that was
                   covered in practicals.
   Chapter 9   -  All
   Chapter 10  -  All, but only in the sense that there might be "practical" type questions that would require you
                   to develop or annotate a Cocol grammar, which by now you should be able to do, I hope.
   Chapter 11  -  11.5 describes the implementation of the Label class used in chapters 13 and 14.
   Chapter 12  -  All
   Chapter 13  -  13.1 ... 13.5
   Chapter 14  -  14.1 ... 14.5
   Chapter 15, 16  None


Cessation of Hostilities Party

It has become a long-standing tradition (now going back far longer than most of you have been alive) for the Terrys to host a party for those who manage to survive Professor Pat's Perilous Programming courses. We propose to hold this on the evening of Monday 26 November, by which stage you will have written both papers.


Definitions and Terminology

There are many terms that you should make sure you understand and can define succinctly.

To help you search for terms you don't know, I have temporarily put a PDF file of "the Book" at

http://www.scifac.ru.ac.za/csc301compilers.pdf

Please do not redistribute this copy further, as it actually infringing copyright to do so.


  Abstract syntax tree (AST)                Orthogonality
  Alphabet                                  Overflow
  Ambiguity                                 Phrase structure
  Analytic phase                            Portability
  Attribute                                 Postfix notation
  Back end                                  Pragma
  Backpatching                              Precedence
  Backtracking                              Produces directly
  BNF                                       Productions
  Character handler                         Program counter
  Closure                                   Pseudo-code
  Cocol                                     Range checks
  Code generation                           Regular expression
  Compile-time                              Regular grammar
  Constraint analysis                       Reverse Polish Notation
  Context condition                         Run-time
  Cycle-free grammar                        Scanner
  Dangling else                             Scope
  Decompiler                                Self-embedding
  Decorated tree                            Semantic action
  Defining occurrence                       Semantic attributes
  Dereferencing                             Semantically driven parser
  Dynamic semantics                         Semantic error detection
  EBNF                                      Semantic overtones
  Emulator                                  Semantics
  Environment                               Sentence
  Fetch-execute cycle                       Sentential form
  FIRST function and sets                   Source handling
  FOLLOW function and sets                  Source language
  Frame file                                Stack frame
  Front end                                 Stack pointer
  Goal symbol                               Start symbol
  Grammar                                   State diagram
  High-level translator                     State variable
  Host language                             Static semantics
  Instruction set                           Symbol
  Intermediate code                         Symbol table
  Interpreter                               Syntactic class
  Keywords                                  Syntax
  Kleene closure                            Syntax directed translation
  Language                                  Systems program
  Lexeme                                    T-diagram
  Lexical analyser                          Table-driven algorithm
  Lexicon                                   Target language
  LL(1) conflict resolution                 Terminal start sets
  LL(1) restrictions                        Terminal successors
  LL(k) parsing                             Token
  Macro assembler                           Top-down parsing
  Native code                               Type checking
  Non-terminal                              Vocabulary
  Null production                           Weak separator
  Nullable                                  Weak terminal
  Object language                           Zero address instruction
  Optimization


Home  © P.D. Terry