diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-02-21 21:27:42 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-02-21 21:27:42 -0800 |
commit | 61c47f6db690b4e2ab0045b44db8017d59334488 (patch) | |
tree | 06f569b157913512dc772f63feb722f8a5a3993a /baremetal | |
parent | 8b8d0fc77130c6f39aae42319aee1f449fd4db70 (diff) | |
download | mu-61c47f6db690b4e2ab0045b44db8017d59334488.tar.gz |
7773
Diffstat (limited to 'baremetal')
-rw-r--r-- | baremetal/shell/main.mu | 10 | ||||
-rw-r--r-- | baremetal/shell/sandbox.mu | 4 |
2 files changed, 4 insertions, 10 deletions
diff --git a/baremetal/shell/main.mu b/baremetal/shell/main.mu index e54515ed..436d6104 100644 --- a/baremetal/shell/main.mu +++ b/baremetal/shell/main.mu @@ -2,9 +2,6 @@ # A Lisp with indent-sensitivity and infix, no macros. Commas are ignored. fn main { - var interpreter-storage: interpreter - var interpreter/edi: (addr interpreter) <- address interpreter-storage -#? initialize-interpreter interpreter var sandbox-storage: sandbox var sandbox/esi: (addr sandbox) <- address sandbox-storage initialize-sandbox sandbox @@ -15,21 +12,18 @@ fn main { compare key, 0 loop-if-= # no way to quit right now; just reboot - edit-sandbox sandbox, key, interpreter + edit-sandbox sandbox, key } loop } } -type interpreter { +fn run in: (addr stream byte), out: (addr stream byte) { # tokenize # insert parens # transform infix # token tree # syntax tree -} - -fn run _self: (addr interpreter), in: (addr stream byte), out: (addr stream byte) { clear-stream out { var done?/eax: boolean <- stream-empty? in diff --git a/baremetal/shell/sandbox.mu b/baremetal/shell/sandbox.mu index b002ce0a..3b489fdd 100644 --- a/baremetal/shell/sandbox.mu +++ b/baremetal/shell/sandbox.mu @@ -59,7 +59,7 @@ fn render-sandbox screen: (addr screen), _self: (addr sandbox), _x: int, _y: int var dummy/eax: int <- draw-stream-rightward screen, value, _x, 0x30/xmax, y, 7/fg=grey, 0/bg } -fn edit-sandbox _self: (addr sandbox), key: byte, interpreter: (addr interpreter) { +fn edit-sandbox _self: (addr sandbox), key: byte { var self/esi: (addr sandbox) <- copy _self var g/edx: grapheme <- copy key { @@ -87,7 +87,7 @@ fn edit-sandbox _self: (addr sandbox), key: byte, interpreter: (addr interpreter emit-gap-buffer data, buffer var value-ah/eax: (addr handle stream byte) <- get self, value var value/eax: (addr stream byte) <- lookup *value-ah - run interpreter, buffer, value + run buffer, value return } add-grapheme-to-sandbox self, g |