shell: start implementing macros

This commit is contained in:
Kartik K. Agaram 2021-05-04 19:49:11 -07:00
parent 7465fbb19f
commit 9156823c5d
2 changed files with 7 additions and 1 deletions

3
shell/macroexpand.mu Normal file
View File

@ -0,0 +1,3 @@
fn macroexpand _in-ah: (addr handle cell), _out-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) {
copy-object _in-ah, _out-ah
}

View File

@ -609,13 +609,16 @@ fn run _in-ah: (addr handle gap-buffer), out: (addr stream byte), globals: (addr
break-if-=
return
}
var macroexpand-result-h: (handle cell)
var macroexpand-result-ah/edx: (addr handle cell) <- address macroexpand-result-h
macroexpand read-result-ah, macroexpand-result-ah, globals, trace
var nil-h: (handle cell)
var nil-ah/eax: (addr handle cell) <- address nil-h
allocate-pair nil-ah
var eval-result-h: (handle cell)
var eval-result-ah/edi: (addr handle cell) <- address eval-result-h
debug-print "^", 4/fg, 0xc5/bg=blue-bg
evaluate read-result-ah, eval-result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, 1/call-number
evaluate macroexpand-result-ah, eval-result-ah, *nil-ah, globals, trace, screen-cell, keyboard-cell, 1/call-number
debug-print "$", 4/fg, 0xc5/bg=blue-bg
var error?/eax: boolean <- has-errors? trace
{