This commit is contained in:
Kartik K. Agaram 2021-02-28 13:06:11 -08:00
parent 1211a47e0b
commit b89c158e3e
1 changed files with 10 additions and 6 deletions

View File

@ -4,15 +4,19 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace
rewind-stream tokens
var curr-token-storage: cell
var curr-token/ecx: (addr cell) <- address curr-token-storage
var empty?/eax: boolean <- stream-empty? tokens
compare empty?, 0/false
{
var done?/eax: boolean <- stream-empty? tokens
compare done?, 0/false
break-if-!=
read-from-stream tokens, curr-token
parse-atom curr-token, _out, trace
break-if-=
error trace, "nothing to parse"
return
}
abort "unexpected tokens at end; only type in a single expression at a time"
read-from-stream tokens, curr-token
parse-atom curr-token, _out, trace
var empty?/eax: boolean <- stream-empty? tokens
compare empty?, 0/false
break-if-!=
error trace, "unexpected tokens at end; only type in a single expression at a time"
}
fn parse-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr trace) {