diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-04-15 17:38:14 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-04-15 17:38:14 -0700 |
commit | 60ef3caa4dc2610028e32b9c2a37ef560d4d1a5a (patch) | |
tree | 45cbd62f1572a6ca0b327fdfb0f1c2bc5feacf4a | |
parent | d0578257cda0ff0719aa54f6476b1e72ebc65bed (diff) | |
download | mu-60ef3caa4dc2610028e32b9c2a37ef560d4d1a5a.tar.gz |
shell: starting to parse dotted lists
-rw-r--r-- | shell/parse.mu | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/shell/parse.mu b/shell/parse.mu index 9fd555b3..dde7da4d 100644 --- a/shell/parse.mu +++ b/shell/parse.mu @@ -65,18 +65,28 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace { break-if-= var curr/esi: (addr handle cell) <- copy _out - $parse-sexpression:list-loop: { - allocate-pair curr + allocate-pair curr + var curr-addr/eax: (addr cell) <- lookup *curr + var left/ecx: (addr handle cell) <- get curr-addr, left + { + var close-paren?/eax: boolean <- parse-sexpression tokens, left, trace + compare close-paren?, 0/false + break-if-!= var curr-addr/eax: (addr cell) <- lookup *curr - var left/ecx: (addr handle cell) <- get curr-addr, left - { - var close-paren?/eax: boolean <- parse-sexpression tokens, left, trace - compare close-paren?, 0/false - break-if-!= $parse-sexpression:list-loop - } - # curr <- get curr-addr, right - loop + $parse-sexpression:list-loop: { + allocate-pair curr + var curr-addr/eax: (addr cell) <- lookup *curr + var left/ecx: (addr handle cell) <- get curr-addr, left + { + var close-paren?/eax: boolean <- parse-sexpression tokens, left, trace + compare close-paren?, 0/false + break-if-!= $parse-sexpression:list-loop + } + # + curr <- get curr-addr, right + loop + } } break $parse-sexpression:type-check } |