|
| 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 | +;; | (Quote Datum) |
| 12 | +;; | (Prim Op (Listof Expr)) |
| 13 | +;; | (If Expr Expr Expr) |
| 14 | +;; | (Begin Expr Expr) |
| 15 | +;; | (Let Id Expr Expr) |
| 16 | +;; | (Var Id) |
| 17 | +;; | (Match Expr (Listof Pat) (Listof Expr)) |
| 18 | +;; | (App Expr (Listof Expr)) |
| 19 | +;; | (Lam Id (Listof Id) Expr) |
| 20 | +;; type Datum = Integer |
| 21 | +;; | Char |
| 22 | +;; | Boolean |
| 23 | +;; | String |
| 24 | +;; | Symbol |
| 25 | +;; | (Boxof Datum) |
| 26 | +;; | (Listof Datum) |
| 27 | +;; | (Vectorof Datum) |
| 28 | +;; type Id = Symbol |
| 29 | +;; type Op = Op0 | Op1 | Op2 | Op3 |
| 30 | +;; type Op0 = 'read-byte |
| 31 | +;; type Op1 = 'add1 | 'sub1 | 'zero? |
| 32 | +;; | 'char? | 'integer->char | 'char->integer |
| 33 | +;; | 'write-byte | 'eof-object? |
| 34 | +;; | 'box | 'car | 'cdr | 'unbox |
| 35 | +;; | 'empty? | 'cons? | 'box? |
| 36 | +;; | 'vector? | 'vector-length |
| 37 | +;; | 'string? | 'string-length |
| 38 | +;; | 'symbol? | 'symbol->string |
| 39 | +;; | 'string->symbol | 'string->uninterned-symbol |
| 40 | +;; type Op2 = '+ | '- | '< | '= |
| 41 | +;; | 'cons |
| 42 | +;; | 'make-vector | 'vector-ref |
| 43 | +;; | 'make-string | 'string-ref |
| 44 | +;; | 'struct? |
| 45 | +;; type Op3 = 'vector-set! | 'struct-ref |
| 46 | +;; type OpN = 'make-struct |
| 47 | +;; type Pat = (PVar Id) |
| 48 | +;; | (PWild) |
| 49 | +;; | (PLit Lit) |
| 50 | +;; | (PBox Pat) |
| 51 | +;; | (PCons Pat Pat) |
| 52 | +;; | (PAnd Pat Pat) |
| 53 | +;; | (PSymb Symbol) |
| 54 | +;; | (PStr String) |
| 55 | +;; | (PStruct Id (Listof Pat)) |
| 56 | +;; type Lit = Boolean |
| 57 | +;; | Character |
| 58 | +;; | Integer |
| 59 | +;; | '() |
| 60 | + |
| 61 | +(struct Eof () #:prefab) |
| 62 | +(struct Prim (p es) #:prefab) |
| 63 | +(struct If (e1 e2 e3) #:prefab) |
| 64 | +(struct Begin (e1 e2) #:prefab) |
| 65 | +(struct Let (x e1 e2) #:prefab) |
| 66 | +(struct Var (x) #:prefab) |
| 67 | +(struct App (e es) #:prefab) |
| 68 | +(struct Lam (f xs e) #:prefab) |
| 69 | +(struct Quote (d) #:prefab) |
| 70 | +(struct Match (e ps es) #:prefab) |
| 71 | + |
| 72 | +(struct PVar (x) #:prefab) |
| 73 | +(struct PWild () #:prefab) |
| 74 | +(struct PLit (x) #:prefab) |
| 75 | +(struct PBox (p) #:prefab) |
| 76 | +(struct PCons (p1 p2) #:prefab) |
| 77 | +(struct PAnd (p1 p2) #:prefab) |
| 78 | +(struct PSymb (s) #:prefab) |
| 79 | +(struct PStr (s) #:prefab) |
| 80 | +(struct PStruct (n ps) #:prefab) |
0 commit comments