-
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
15 changed files
with
1,626 additions
and
3 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 | ||
Apply FunPlain FunRest FunCase) | ||
|
||
;; type Prog = (Prog (Listof Defn) Expr) | ||
(struct Prog (ds e) #:prefab) | ||
|
||
;; type Defn = (Defn Id Fun) | ||
(struct Defn (f fun) #:prefab) | ||
|
||
;; type Fun = (FunPlain [Listof Id] Expr) | ||
;; | (FunRest [Listof Id] Id Expr) | ||
;; | (FunCase [Listof FunCaseClause]) | ||
;; type FunCaseClause = (FunPlain [Listof Id] Expr) | ||
;; | (FunRest [Listof Id] Id Expr) | ||
(struct FunPlain (xs e) #:prefab) | ||
(struct FunRest (xs x e) #:prefab) | ||
(struct FunCase (cs) #: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)) | ||
;; | (Apply Id (Listof Expr) 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! | ||
|
||
(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 Apply (f es e) #: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.