-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: reworking literals a la #114 through Hustle.
- Loading branch information
Showing
45 changed files
with
122 additions
and
157 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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#lang racket | ||
(provide Int) | ||
(provide Lit) | ||
|
||
;; type Expr = (Int Integer) | ||
(struct Int (i) #:prefab) | ||
;; type Expr = (Lit Integer) | ||
(struct Lit (i) #: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 |
---|---|---|
|
@@ -12,4 +12,4 @@ | |
;; Expr -> Asm | ||
(define (compile-e e) | ||
(match e | ||
[(Int i) (seq (Mov 'rax i))])) | ||
[(Lit i) (seq (Mov 'rax i))])) |
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ | |
;; Interpret given expression | ||
(define (interp e) | ||
(match e | ||
[(Int i) i])) | ||
[(Lit i) i])) |
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
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
#lang racket | ||
(provide Int Prim1) | ||
(provide Lit Prim1) | ||
|
||
;; type Expr = | ||
;; | (Int Integer) | ||
;; | (Lit Integer) | ||
;; | (Prim1 Op Expr) | ||
;; type Op = 'add1 | 'sub1 | ||
(struct Int (i) #:prefab) | ||
(struct Lit (i) #:prefab) | ||
(struct Prim1 (p 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
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
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
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#lang racket | ||
(provide Int Prim1 IfZero) | ||
(provide Lit Prim1 IfZero) | ||
|
||
;; type Expr = | ||
;; | (Int Integer) | ||
;; | (Lit Integer) | ||
;; | (Prim1 Op Expr) | ||
;; | (IfZero Expr Expr Expr) | ||
;; type Op = 'add1 | 'sub1 | ||
(struct Int (i) #:prefab) | ||
(struct Lit (i) #:prefab) | ||
(struct Prim1 (p e) #:prefab) | ||
(struct IfZero (e1 e2 e3) #: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
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
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
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 |
---|---|---|
@@ -1,16 +1,14 @@ | ||
#lang racket | ||
(provide Int Bool Char Prim1 If) | ||
(provide Lit Prim1 If) | ||
|
||
;; type Expr = | ||
;; | (Int Integer) | ||
;; | (Bool Boolean) | ||
;; | (Char Character) | ||
;; | (Lit Datum) | ||
;; | (Prim1 Op Expr) | ||
;; | (If Expr Expr Expr) | ||
;; type Datum = Boolean | Integer | Char | ||
;; type Op = 'add1 | 'sub1 | 'zero? | ||
;; | 'char? | 'integer->char | 'char->integer | ||
(struct Int (i) #:prefab) | ||
(struct Bool (b) #:prefab) | ||
(struct Char (c) #:prefab) | ||
|
||
(struct Lit (d) #:prefab) | ||
(struct Prim1 (p e) #:prefab) | ||
(struct If (e1 e2 e3) #: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
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
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
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
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#lang racket | ||
(provide Int Bool Prim1 If) | ||
(provide Lit Prim1 If) | ||
|
||
;; type Expr = | ||
;; | (Int Integer) | ||
;; | (Bool Boolean) | ||
;; | (Lit Datum) | ||
;; | (Prim1 Op Expr) | ||
;; | (If Expr Expr Expr) | ||
;; type Datum = Boolean | Integer | ||
;; type Op = 'add1 | 'sub1 | 'zero? | ||
(struct Int (i) #:prefab) | ||
(struct Bool (b) #:prefab) | ||
|
||
(struct Lit (d) #:prefab) | ||
(struct Prim1 (p e) #:prefab) | ||
(struct If (e1 e2 e3) #: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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.