Tutorial 2026-01-28

Faux Racket

Code ------------------------> making code.

(program )

  • In Onenote

  • Faux Racket

    • Integer, +, -, *

expr = int list (expr expr )

1, (+ 1 2 )

Drawing

( + 1 ( * 2 3 ) )

Drawing

data Expr = Lit Integer

  • Bin Op Expr : Expr

data Op = Add | Mult

With the AST we can

  1. Evaluate it to an integer result ( interpreting )

  2. Write a machine language program ( compiling )

interp Expr -> Integer

Alt:

circle-info

with this we can make interpreter.

Alt: we can write in one.

New Faux Racket Grammar

circle-info

Valid Expressions include, id, int, or (op expr expr)

circle-info

Use substitution model for normal racket to simplify.

circle-exclamation
circle-info

Always bind variables to the innermost scope.

e.g.

circle-info

App for Application

Now we write our last function, subst :

Last updated