diff options
author | Kartik Agaram <vc@akkartik.com> | 2020-10-10 01:43:12 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2020-10-10 01:43:12 -0700 |
commit | b25167a9aef8b8dd75aab8d356e1b6e0e389ed1f (patch) | |
tree | 86e15a27489f1e003f572b07825a98f726a63275 | |
parent | e8367b2bc2504b62a37ed6fd1bbc7ef2b6407eb2 (diff) | |
download | mu-b25167a9aef8b8dd75aab8d356e1b6e0e389ed1f.tar.gz |
6988
Oh, of course. I can't compare the word with the word at the cursor. Not even its interned pointer. We have to track the call path.
-rw-r--r-- | apps/tile/main.mu | 272 |
1 files changed, 242 insertions, 30 deletions
diff --git a/apps/tile/main.mu b/apps/tile/main.mu index 73c30025..2f559918 100644 --- a/apps/tile/main.mu +++ b/apps/tile/main.mu @@ -85,81 +85,293 @@ fn test { process env, g g <- copy 0xa # <enter> process env, g + g <- copy 0x20 # space + process env, g + g <- copy 0x32 # '2' + process env, g + g <- copy 0x2a # '*' + process env, g + g <- copy 0xa # <enter> + process env, g + # 12 arrows to return to end of first call + g <- copy 0x445b1b # left-arrow + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } + g <- copy 0x445b1b # left-arrow + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } + g <- copy 0x445b1b # left-arrow + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } + g <- copy 0x445b1b # left-arrow + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } + g <- copy 0x445b1b # left-arrow + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } + g <- copy 0x445b1b # left-arrow + process env, g + { + print-string-to-real-screen "==\n" + var functions/ecx: (addr handle function) <- get env, functions + var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes + var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah + var sandbox/edi: (addr sandbox) <- copy _sandbox + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + } g <- copy 0x445b1b # left-arrow process env, g { + print-string-to-real-screen "==\n" var functions/ecx: (addr handle function) <- get env, functions var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-word-storage: (handle word) - var cursor-word-ah/ebx: (addr handle word) <- address cursor-word-storage - get-cursor-word sandbox, functions, cursor-word-ah - var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - print-word 0, cursor-word + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar print-string-to-real-screen "\n" } g <- copy 0x445b1b # left-arrow - print-string-to-real-screen "==\n" process env, g { + print-string-to-real-screen "==\n" var functions/ecx: (addr handle function) <- get env, functions var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-word-storage: (handle word) - var cursor-word-ah/ebx: (addr handle word) <- address cursor-word-storage - get-cursor-word sandbox, functions, cursor-word-ah - var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - print-word 0, cursor-word + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar print-string-to-real-screen "\n" } g <- copy 0x445b1b # left-arrow - print-string-to-real-screen "==\n" process env, g { + print-string-to-real-screen "==\n" var functions/ecx: (addr handle function) <- get env, functions var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-word-storage: (handle word) - var cursor-word-ah/ebx: (addr handle word) <- address cursor-word-storage - get-cursor-word sandbox, functions, cursor-word-ah - var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - print-word 0, cursor-word + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar print-string-to-real-screen "\n" } g <- copy 0x445b1b # left-arrow - print-string-to-real-screen "==\n" process env, g { + print-string-to-real-screen "==\n" var functions/ecx: (addr handle function) <- get env, functions var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-word-storage: (handle word) - var cursor-word-ah/ebx: (addr handle word) <- address cursor-word-storage - get-cursor-word sandbox, functions, cursor-word-ah - var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - print-word 0, cursor-word + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar print-string-to-real-screen "\n" } g <- copy 0x445b1b # left-arrow - print-string-to-real-screen "==\n" process env, g { + print-string-to-real-screen "==\n" var functions/ecx: (addr handle function) <- get env, functions var sandbox-ah/eax: (addr handle sandbox) <- get env, sandboxes var _sandbox/eax: (addr sandbox) <- lookup *sandbox-ah var sandbox/edi: (addr sandbox) <- copy _sandbox - var cursor-word-storage: (handle word) - var cursor-word-ah/ebx: (addr handle word) <- address cursor-word-storage - get-cursor-word sandbox, functions, cursor-word-ah - var cursor-word/eax: (addr word) <- lookup *cursor-word-ah - print-word 0, cursor-word + var cursor-call-path/edi: (addr handle call-path-element) <- get sandbox, cursor-call-path + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar + print-string-to-real-screen "\n" + cursor-call-path <- get foo, next + var _foo/eax: (addr call-path-element) <- lookup *cursor-call-path + var foo/ecx: (addr call-path-element) <- copy _foo + compare foo, 0 + break-if-= + var bar/eax: (addr int) <- get foo, index-in-body + print-int32-hex 0, *bar print-string-to-real-screen "\n" } -#? render env + g <- copy 0x445b1b # left-arrow + process env, g + render env } fn repl { |