-
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.
feat: implement FREE_STORAGE_POINTER()
and clean up some phases that don't need the `data` object Closes #3
- Loading branch information
Showing
5 changed files
with
34 additions
and
6 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,26 @@ | ||
#lang racket | ||
|
||
(require "../utils.rkt") | ||
|
||
;; very simple. we start a counter at 0, and for each call to FREE_STORAGE_POINTER, we return the counter value then inc | ||
;; values should be hex strings | ||
|
||
(define counter 0) | ||
|
||
(define (free-storage-pointer) | ||
(let ([result counter]) | ||
(set! counter (+ counter 1)) | ||
(list 'hex (number->hex result)))) | ||
|
||
(define (fsp-call? code) | ||
(eq? code "FREE_STORAGE_POINTER()")) | ||
|
||
(define (handle-fsp-call code) | ||
(if (fsp-call? code) | ||
(free-storage-pointer) | ||
code)) | ||
|
||
(define (insert-fsp code) | ||
(map handle-fsp-call code)) | ||
|
||
(provide insert-fsp fsp-call? free-storage-pointer) |
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