|
| 1 | +#lang racket |
| 2 | +(provide (all-defined-out)) |
| 3 | + |
| 4 | +;; type Prog = (Prog (Listof Defn) Expr) |
| 5 | +(struct Prog (ds e) #:prefab) |
| 6 | + |
| 7 | +;; type Defn = (Defn Id (Listof Id) Expr) |
| 8 | +(struct Defn (f xs e) #:prefab) |
| 9 | + |
| 10 | +;; type Expr = (Eof) |
| 11 | +;; | (Empty) |
| 12 | +;; | (Int Integer) |
| 13 | +;; | (Bool Boolean) |
| 14 | +;; | (Char Character) |
| 15 | +;; | (Str String) |
| 16 | +;; | (Prim0 Op0) |
| 17 | +;; | (Prim1 Op1 Expr) |
| 18 | +;; | (Prim2 Op2 Expr Expr) |
| 19 | +;; | (Prim3 Op3 Expr Expr Expr) |
| 20 | +;; | (If Expr Expr Expr) |
| 21 | +;; | (Begin Expr Expr) |
| 22 | +;; | (Let Id Expr Expr) |
| 23 | +;; | (Var Id) |
| 24 | +;; | (App Id (Listof Expr)) |
| 25 | +;; type Id = Symbol |
| 26 | +;; type Op0 = 'read-byte |
| 27 | +;; type Op1 = 'add1 | 'sub1 | 'zero? |
| 28 | +;; | 'char? | 'integer->char | 'char->integer |
| 29 | +;; | 'write-byte | 'eof-object? |
| 30 | +;; | 'box | 'car | 'cdr | 'unbox |
| 31 | +;; | 'empty? | 'cons? | 'box? |
| 32 | +;; | 'vector? | vector-length |
| 33 | +;; | 'string? | string-length |
| 34 | +;; type Op2 = '+ | '- | '< | '= |
| 35 | +;; | 'cons |
| 36 | +;; | 'make-vector | 'vector-ref |
| 37 | +;; | 'make-string | 'string-ref |
| 38 | +;; type Op3 = 'vector-set! |
| 39 | +(struct Eof () #:prefab) |
| 40 | +(struct Empty () #:prefab) |
| 41 | +(struct Int (i) #:prefab) |
| 42 | +(struct Bool (b) #:prefab) |
| 43 | +(struct Char (c) #:prefab) |
| 44 | +(struct Str (s) #:prefab) |
| 45 | +(struct Prim0 (p) #:prefab) |
| 46 | +(struct Prim1 (p e) #:prefab) |
| 47 | +(struct Prim2 (p e1 e2) #:prefab) |
| 48 | +(struct Prim3 (p e1 e2 e3) #:prefab) |
| 49 | +(struct If (e1 e2 e3) #:prefab) |
| 50 | +(struct Begin (e1 e2) #:prefab) |
| 51 | +(struct Let (x e1 e2) #:prefab) |
| 52 | +(struct Var (x) #:prefab) |
| 53 | +(struct App (f es) #:prefab) |
0 commit comments