From 31a31570b6c62c067017fda84bca86c2f74f173e Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 27 Feb 2021 13:23:23 -0800 Subject: 7821 - baremetal/shell: parse numbers --- baremetal/shell/parse.mu | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'baremetal') 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" -- cgit 1.4.1-2-gfad0