Teaching Staff Page for Compiler Construction
Grading: Friday Thursday mornings
Groups
- Burgener, Raphaël & Favre, Ludovic (#01)
- Chappuis, Daniel & Testuz, Stéphane (#02)
- Köksal, Ali Sinan & Kneuss, Etienne (#03)
- Kviatkevitch, Ivan & Bindschaedler, Laurent (#04)
- Blatter, Jérémy & Joneja, Vishal (#05)
- Barras, Florian & Zbinden, Eric (#06)
- Girard, Thomas & Schaller, Julien (#07, aka. FredFred)
- Lindmark, Jonas & Morales García, Antonio (#08)
- Pache, Christophe & Perrin, Alexandre (#09)
- Duc, Alexandre & Blanc, Régis (#10)
- Ly, Papa Alione & Kesici, Omer (#11)
- Delort, Vincent & Jutzeler, Arnaud (#12)
- Beuret, Thibaut & Laquerre, Pierre-François (#13)
Things we can ask at the oral defense
- Easy:
- give an overview of all phases: what they take as an input and what they do
- how did you implement code generation for conditional constructs?
- which are the identifiers which do not get associated to a symbol during name analysis?
- how did you solve the good old dangling else problem?
- is * commutative? what about +?
- show us in the code where…
- Medium:
- how do you keep track of the position in the lexer?
- what is the “other way” to generate code for conditional constructs? (ie. the one you did not implement)
- why can't you assign symbols to methods at the name analysis phase?
- what happens if you compile a class where a method has locals which are not initialized? why?
- in how many sub-phases did you break name analysis? why?
- Hard:
- what type of parser did you write (it's supposed to be LL(2)), and why?
- what invalid Java program would your compiler still accept? and if we omit the definite assignment rule?
- in the current MiniJava+, assignments to array cells can only be done if the array is given a name. How would you change the compiler to allow assignements to array cells where the array can be recovered in the assignment? (ex: this.getArray()[0] = this.getArray()[1]).
Things we can ask in an exam
Todo:
- write in English
- solve it
- translate to French (with disclaimer)
Little subset of a functional language:
- from regular expressions for identifiers, digits, draw automaton with accepting state for different tokens
- compute first,follow sets, show it is not LL(1), rewrite it to be LL(1)
- separate scopes for type and variable idents, typedef
- show LR(0) automaton for simple grammar
- language with int, float, overloaded + (rules 1+2.0 is a float), =, ⇐
- give JVM code generation rules for subset (we give one example, students do the rest)
- translate manually an expression with && ((x > 0) && (2.0/x < 10)) using those rules
- octagons paper, take some little thing
- take this CFG, run this analysis on it
- suppose we wanted to add unary minus to MiniJava+:
- describe how to do this very simply (ie: minimal number of phases to change), without caring about the generated code
- how to do it in a clean way: all changes to be made to each phase.