Bot releases are hidden (Show)
You will have your extremely first experience about compilation, the language we supported here is:
x ; variable
i ; integer
e ::=
| x
| i
| (+ e1 e2)
| (- e1 e2)
| (let ((x e1)) e2)
There have 8 passes.
To run example, use the following command:
dune exec minic -- ./example/hello.ss
There have three examples in this stage.
This implementation can only take (+ e1 e2)
and (- e1 e2)
, but in Racket(another scheme variant) we can have
(+)
which produces 0
(+ e1 e2 e3 ...)
which sums all(- e1 e2 e3 ...)
which recursively subtract (- e1 e2)
then put result as head of subtraction then again, e.g. (- 6 3 2)
is 1
, not 5
Can you implement them?
Note
For subtract, this bonus disallow(- e)
, which is valid in Racket.
Remove the instruction like mov a, a
, this is completely useless but can occur after register allocation.