diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-02-27 13:23:23 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-02-27 13:24:22 -0800 |
commit | 31a31570b6c62c067017fda84bca86c2f74f173e (patch) | |
tree | 7a473eaf0239c8c2875788a62c2df23e01938b5d /baremetal | |
parent | da164c51547b65327c4bfef51620307852d7d255 (diff) | |
download | mu-31a31570b6c62c067017fda84bca86c2f74f173e.tar.gz |
7821 - baremetal/shell: parse numbers
Diffstat (limited to 'baremetal')
-rw-r--r-- | baremetal/shell/parse.mu | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/baremetal/shell/parse.mu b/baremetal/shell/parse.mu index dd87ae0e..35c8c053 100644 --- a/baremetal/shell/parse.mu +++ b/baremetal/shell/parse.mu @@ -37,13 +37,25 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace } return } - # Temporary default: just convert first token to symbol and return it. + # list + { + } + # default: symbol + # just copy token data + new-symbol _out var out/eax: (addr handle cell) <- copy _out - allocate out var out-addr/eax: (addr cell) <- lookup *out - copy-object curr-token, out-addr - var type/ecx: (addr int) <- get out-addr, type - copy-to *type, 2/symbol + var curr-token-data-ah/ecx: (addr handle stream byte) <- get curr-token, text-data + var dest-ah/edx: (addr handle stream byte) <- get out-addr, text-data + copy-object curr-token-data-ah, dest-ah + { + var stream-storage: (stream byte 0x40) + var stream/ecx: (addr stream byte) <- address stream-storage + trace-higher trace + write stream, "=> symbol " + print-symbol out-addr, stream, 0/no-trace + trace trace, "read", stream + } return } abort "unexpected tokens at end; only type in a single expression at a time" |