


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



lexer & parser
semantic analysis
Tiger source program intermediate codegen
backend compiler
report all lexical and syntactic errors
report all semantic errors
iterm. code
absyn correct
structure Tree : TREE = struct … datatype stm = SEQ of stm * stm | ...... and exp = BINOP of binop * exp * exp | ...... and binop = FPLUS | FMINUS | FDIV | FMUL | PLUS | MINUS | MUL | DIV | AND | OR | LSHIFT | RSHIFT | ARSHIFT | XOR and relop = EQ | NE | LT | GT | LE | GE ...... end
datatype stm = SEQ of stm * stm | LABEL of label | JUMP of exp * label list | CJUMP of relop * exp * exp * label * label | MOVE of exp * exp | EXP of exp and exp = BINOP of binop * exp * exp | MEM of exp | TEMP of Temp.temp | ESEQ of stm * exp | NAME of label | CONST of int | CALL of exp * exp list
datatype frag = PROC of {name : Tree.label, function name body : Tree.stm, function body frame : Frame.frame} frame layout | DATA of string
MEM(BINOP(PLUS, TEMP fp, CONST k)) MEM(+(CONST kn,MEM(+(CONST kn-1,... MEM(+(CONST k1,TEMP fp))..))
Strip levels from lf , we use the static link offsets k1, k2, ... from these levels to construct the tree. When we reach lg, we stop. datatype level = LEVEL of {frame : frame, parent : level} * unit ref | TOP use “ unit ref ” to test if two levels are the same one.
(if l_value store, otherwise fetch)