Course web page for Fall 2021.
Examples:
Racket version:
exp ::= int | (read) | (- exp) | (+ exp exp)
| var | (let ([var exp]) exp)
L_Var ::= exp
Python version:
exp ::= int | input_int() | - exp | exp + exp | var
stmt ::= print(exp) | exp | var = exp
L_Var ::= stmt*
Racket examples:
(let ([x (+ 12 20)])
(+ 10 x))
(let ([x 32])
(+ (let ([x 10]) x)
x))
Python examples:
x = 12 + 20
print(10 + x)
x = 33
x = 10
print(x + x)
Racket Interpreter for L_Var: interp-Rvar.rkt
Python Interpreter for L_Var: interp_Pvar.rkt
reg ::= rsp | rbp | rsi | rdi | rax | .. | rdx | r8 | ... | r15
arg ::= $int | %reg | int(%reg)
instr ::= addq arg, arg |
subq arg, arg |
negq arg |
movq arg, arg |
callq label |
pushq arg |
popq arg |
retq
prog ::= .globl main
main: instr^{+}
Intel Machine: * program counter * registers * memory (stack and heap)