diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..c5e9f040 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +langs/hoax/ast.rkt linguist-generated=true diff --git a/langs/hoax/ast.rkt b/langs/hoax/ast.rkt new file mode 100644 index 00000000..82ce7b6c --- /dev/null +++ b/langs/hoax/ast.rkt @@ -0,0 +1,47 @@ +#lang racket +(provide Lit Prim0 Prim1 Prim2 Prim3 If Eof Begin Let + Var Empty) +;; +;; type Expr = (Lit Datum) +;; | (Eof) +;; | (Empty) +;; | (Prim0 Op0) +;; | (Prim1 Op1 Expr) +;; | (Prim2 Op2 Expr Expr) +;; | (Prim3 Op3 Expr Expr Expr) +;; | (If Expr Expr Expr) +;; | (Let Id Expr Expr) +;; | (Var Id) + +;; type Id = Symbol +;; type Datum = Integer +;; | Boolean +;; | Character +;; | String +;; type Op0 = 'read-byte | 'peek-byte | 'void +;; type Op1 = 'add1 | 'sub1 +;; | 'zero? +;; | 'char? | 'integer->char | 'char->integer +;; | 'write-byte | 'eof-object? +;; | 'box | 'car | 'cdr | 'unbox +;; | 'empty? | 'cons? | 'box? +;; | 'vector? | vector-length +;; | 'string? | string-length +;; type Op2 = '+ | '- | '< | '= +;; | eq? | 'cons +;; | 'make-vector | 'vector-ref +;; | 'make-string | 'string-ref +;; type Op3 = 'vector-set! + +(struct Eof () #:prefab) +(struct Empty () #:prefab) +(struct Lit (d) #:prefab) +(struct Prim0 (p) #:prefab) +(struct Prim1 (p e) #:prefab) +(struct Prim2 (p e1 e2) #:prefab) +(struct Prim3 (p e1 e2 e3) #:prefab) +(struct If (e1 e2 e3) #:prefab) +(struct Begin (e1 e2) #:prefab) +(struct Let (x e1 e2) #:prefab) +(struct Var (x) #:prefab) +