diff options
author | bd <bdunahu@operationnull.com> | 2025-01-18 01:25:47 -0700 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-01-18 01:25:47 -0700 |
commit | ddd448ae86e5730d5cd297f44ec89ee3fa3c0006 (patch) | |
tree | 9eaa2c75b9b397fcef0fe9467d10f21cc1e07a0c /src/modules/utils/assign-stack.scm | |
parent | 1c216bd45a7d4fb529288192ecff46453309c485 (diff) |
use a scheme procedures+eval to manage and transform AST
Removes records for a more-managable scheme-syntax approach. Modules+overriding allows for the IR itself to be represented and evaluated as scheme code during each transformation.
Diffstat (limited to 'src/modules/utils/assign-stack.scm')
-rw-r--r-- | src/modules/utils/assign-stack.scm | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/modules/utils/assign-stack.scm b/src/modules/utils/assign-stack.scm new file mode 100644 index 0000000..8037400 --- /dev/null +++ b/src/modules/utils/assign-stack.scm @@ -0,0 +1,15 @@ +(define-module (modules utils assign-stack) + #:export (make-location + get-frame-size)) + + +(define make-location) +(define get-frame-size) +(let ((dict (make-hash-table)) + (ptr 0)) + (set! make-location + (lambda (id) + (or (hash-ref dict id) + (begin (set! ptr (1+ ptr)) + (hash-set! dict id (get-frame-size)))))) + (set! get-frame-size (lambda () (* -4 ptr)))) |