Skip to content

Commit 6f7fd62

Browse files
committed
crook
1 parent 95ed25b commit 6f7fd62

File tree

15 files changed

+1626
-3
lines changed

15 files changed

+1626
-3
lines changed

iniquity-plus/ast.rkt

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#lang racket
2+
(provide Lit Prim0 Prim1 Prim2 Prim3 If Eof Begin
3+
Let Var Prog Defn App
4+
Apply FunPlain FunRest FunCase)
5+
6+
;; type Prog = (Prog (Listof Defn) Expr)
7+
(struct Prog (ds e) #:prefab)
8+
9+
;; type Defn = (Defn Id Fun)
10+
(struct Defn (f fun) #:prefab)
11+
12+
;; type Fun = (FunPlain [Listof Id] Expr)
13+
;; | (FunRest [Listof Id] Id Expr)
14+
;; | (FunCase [Listof FunCaseClause])
15+
;; type FunCaseClause = (FunPlain [Listof Id] Expr)
16+
;; | (FunRest [Listof Id] Id Expr)
17+
(struct FunPlain (xs e) #:prefab)
18+
(struct FunRest (xs x e) #:prefab)
19+
(struct FunCase (cs) #:prefab)
20+
;; type Expr = (Lit Datum)
21+
;; | (Eof)
22+
;; | (Prim0 Op0)
23+
;; | (Prim1 Op1 Expr)
24+
;; | (Prim2 Op2 Expr Expr)
25+
;; | (Prim3 Op3 Expr Expr Expr)
26+
;; | (If Expr Expr Expr)
27+
;; | (Begin Expr Expr)
28+
;; | (Let Id Expr Expr)
29+
;; | (Var Id)
30+
;; | (App Id (Listof Expr))
31+
;; | (Apply Id (Listof Expr) Expr)
32+
33+
;; type Id = Symbol
34+
;; type Datum = Integer
35+
;; | Boolean
36+
;; | Character
37+
;; | String
38+
;; type Op0 = 'read-byte | 'peek-byte | 'void
39+
;; type Op1 = 'add1 | 'sub1
40+
;; | 'zero?
41+
;; | 'char? | 'integer->char | 'char->integer
42+
;; | 'write-byte | 'eof-object?
43+
;; | 'box | 'car | 'cdr | 'unbox
44+
;; | 'empty? | 'cons? | 'box?
45+
;; | 'vector? | 'vector-length
46+
;; | 'string? | 'string-length
47+
;; type Op2 = '+ | '- | '< | '=
48+
;; | 'eq? | 'cons
49+
;; | 'make-vector | 'vector-ref
50+
;; | 'make-string | 'string-ref
51+
;; type Op3 = 'vector-set!
52+
53+
(struct Eof () #:prefab)
54+
(struct Lit (d) #:prefab)
55+
(struct Prim0 (p) #:prefab)
56+
(struct Prim1 (p e) #:prefab)
57+
(struct Prim2 (p e1 e2) #:prefab)
58+
(struct Prim3 (p e1 e2 e3) #:prefab)
59+
(struct If (e1 e2 e3) #:prefab)
60+
(struct Begin (e1 e2) #:prefab)
61+
(struct Let (x e1 e2) #:prefab)
62+
(struct Var (x) #:prefab)
63+
(struct App (f es) #:prefab)
64+
(struct Apply (f es e) #:prefab)
65+

iniquity-plus/build-runtime.rkt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#lang racket
2+
(provide runtime-path)
3+
4+
(require racket/runtime-path)
5+
(define-runtime-path here ".")
6+
7+
(unless (system (string-append "make -C '"
8+
(path->string (normalize-path here))
9+
"' -s runtime.o"))
10+
(error 'build-runtime "could not build runtime"))
11+
12+
(define runtime-path
13+
(normalize-path (build-path here "runtime.o")))
14+

0 commit comments

Comments
 (0)