-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
38 changed files
with
3,510 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#lang racket | ||
(provide Lit Prim0 Prim1 Prim2 Prim3 If Eof Begin | ||
Let Var Prog Defn App | ||
Match Box Cons Conj) | ||
|
||
;; type Prog = (Prog (Listof Defn) Expr) | ||
(struct Prog (ds e) #:prefab) | ||
|
||
;; type Defn = (Defn Id (Listof Id) Expr) | ||
(struct Defn (f xs e) #:prefab) | ||
;; type Expr = (Lit Datum) | ||
;; | (Eof) | ||
;; | (Prim0 Op0) | ||
;; | (Prim1 Op1 Expr) | ||
;; | (Prim2 Op2 Expr Expr) | ||
;; | (Prim3 Op3 Expr Expr Expr) | ||
;; | (If Expr Expr Expr) | ||
;; | (Begin Expr Expr) | ||
;; | (Let Id Expr Expr) | ||
;; | (Var Id) | ||
;; | (App Id (Listof Expr)) | ||
;; | (Match Expr (Listof Pat) (Listof Expr)) | ||
|
||
;; 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! | ||
;; type Pat = (Var Id) | ||
;; | (Lit Datum) | ||
;; | (Box Pat) | ||
;; | (Cons Pat Pat) | ||
;; | (Conj Pat Pat) | ||
|
||
(struct Eof () #: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) | ||
(struct App (f es) #:prefab) | ||
(struct Match (e ps es) #:prefab) | ||
|
||
(struct Box (p) #:prefab) | ||
(struct Cons (p1 p2) #:prefab) | ||
(struct Conj (p1 p2) #:prefab) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#lang racket | ||
(provide runtime-path) | ||
|
||
(require racket/runtime-path) | ||
(define-runtime-path here ".") | ||
|
||
(unless (system (string-append "make -C '" | ||
(path->string (normalize-path here)) | ||
"' -s runtime.o")) | ||
(error 'build-runtime "could not build runtime")) | ||
|
||
(define runtime-path | ||
(normalize-path (build-path here "runtime.o"))) | ||
|
Oops, something went wrong.