Tutorial 2026-01-28
Faux Racket
Code ------------------------> making code.
(program )
In Onenote
Faux Racket
Integer, +, -, *
expr = int list (expr expr )1, (+ 1 2 )
( + 1 ( * 2 3 ) )
data Expr = Lit Integer
Bin Op Expr : Expr
data Op = Add | Mult
With the AST we can
Evaluate it to an integer result ( interpreting )
Write a machine language program ( compiling )
interp Expr -> Integer
Alt:
with this we can make interpreter.
Alt: we can write in one.
New Faux Racket Grammar
Valid Expressions include, id, int, or (op expr expr)
Use substitution model for normal racket to simplify.
What does this produce? It's pretty ambiguous rn for our language, but we see that:
Always bind variables to the innermost scope.
e.g.
App for Application
Now we write our last function, subst :
Last updated