Exams Flashcards
(59 cards)






Write type checking rules for the following statements
- SDecl
- SExp
- SWhile
- SBlock


Write compilation schemes for the following expressions
- EVar
- EInt
- EAss
- EPreIncr
- EGEq


- idc a
- iload x
- istore x
- pop
- iadd
- if_cmpge L


- idc a
- iload x
- istore x
- pop
- dup
- iadd
- if_cmpge L




- SDecl
- SExp
- SWhile
- SBlock
- SNil
- SCons


Write syntax directed interpretation rules for the expression forms above. The environment must be made explicit, as well as all possible side effects.
- EId
- EInt
- EPostIncr
- ELeq
- EAss

Write compilation schmes in pseudo code for each of the expression constructions above generating JVM (i. asmin assembler). It is not necessary to remember exactly the names of the instructions - only what arguments they take and how they work.
- EId
- EInt
- EPostIncr
- ELeq
- EAss











Write syntax-directed type checking rules for the expressions below. The typing enviroment must be made explicit
- ESub
- EMul
- EPreIncr
- ECall
- EPar

Write syntax directed interpretation rules for the statements forms and lists below. The environment must be made explicit, as well as all possible side effects. You can assume an interpreter for expressions
- SBlock
- SInit
- SReturn

Write compilation schemes in pseudo-code for each of the grammer constructions in. The compiler shoul output symbolic JVM instructions (i.e Jasmin assembler). It is not necessary to remember exactly the ames of the instructions - only what arguments they take and how they work.
- Statements
- SBlock
- SInit
- SReturn
- Types
- Int
- Expressions
- EInt
- ESub
- EMul
- EPreIncr
- ECall
- EPar

JVM instructions
- Idc a
- iload x
- istore x
- isub
- imul
- invokestatic f
- ireturn



(a) not valid (f is unbound)
(b) valid
(c) valid
(d) not valid (g does not have a function type)
(e) not valid (self application x x is not typable)






















































