about summary refs log tree commit diff stats
path: root/baremetal/shell/parse.mu
diff options
context:
space:
mode:
Diffstat (limited to 'baremetal/shell/parse.mu')
-rw-r--r--baremetal/shell/parse.mu14
1 files changed, 14 insertions, 0 deletions
diff --git a/baremetal/shell/parse.mu b/baremetal/shell/parse.mu
new file mode 100644
index 00000000..b9eeccab
--- /dev/null
+++ b/baremetal/shell/parse.mu
@@ -0,0 +1,14 @@
+fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace: (addr trace) {
+  # For now we just convert first token into a symbol and return it. TODO
+  var empty?/eax: boolean <- stream-empty? tokens
+  compare empty?, 0/false
+  {
+    break-if-!=
+    var out/eax: (addr handle cell) <- copy _out
+    allocate out
+    var out-addr/eax: (addr cell) <- lookup *out
+    read-from-stream tokens, out-addr
+    var type/ecx: (addr int) <- get out-addr, type
+    copy-to *type, 2/symbol
+  }
+}