diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-05-02 22:31:19 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-05-02 22:31:19 -0700 |
commit | 71a04056a88104512d010e0947a85006812f5067 (patch) | |
tree | 17b26cb96ab6dec54d48658242504f02fc83d9fb | |
parent | 27691024c4ebfb1a98ede8e20187bb9115f77217 (diff) | |
download | mu-71a04056a88104512d010e0947a85006812f5067.tar.gz |
printing quoted expressions
-rw-r--r-- | shell/print.mu | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/shell/print.mu b/shell/print.mu index ca3225d5..b1d0e158 100644 --- a/shell/print.mu +++ b/shell/print.mu @@ -153,6 +153,20 @@ fn print-number _in: (addr cell), out: (addr stream byte), trace: (addr trace) { } fn print-pair _in: (addr cell), out: (addr stream byte), trace: (addr trace) { + # if in starts with a quote, print the quote outside the expression + var in/esi: (addr cell) <- copy _in + var left-ah/eax: (addr handle cell) <- get in, left + var left/eax: (addr cell) <- lookup *left-ah + var is-quote?/eax: boolean <- symbol-equal? left, "'" + compare is-quote?, 0/false + { + break-if-= + write out, "'" + var right-ah/eax: (addr handle cell) <- get in, right + print-cell right-ah, out, trace + return + } + # var curr/esi: (addr cell) <- copy _in write out, "(" $print-pair:loop: { |