diff options
Diffstat (limited to 'shell/macroexpand.mu')
-rw-r--r-- | shell/macroexpand.mu | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/shell/macroexpand.mu b/shell/macroexpand.mu index 018fa200..047d4dfd 100644 --- a/shell/macroexpand.mu +++ b/shell/macroexpand.mu @@ -1,3 +1,20 @@ fn macroexpand _in-ah: (addr handle cell), _out-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) { + var in-ah/esi: (addr handle cell) <- copy _in-ah + var out-ah/edi: (addr handle cell) <- copy _out-ah + # loop until convergence + { + macroexpand-iter in-ah, out-ah, globals, trace + var _in/eax: (addr cell) <- lookup *in-ah + var in/ecx: (addr cell) <- copy _in + var out/eax: (addr cell) <- lookup *out-ah + var done?/eax: boolean <- cell-isomorphic? in, out, trace + compare done?, 0/false + break-if-!= + copy-object out-ah, in-ah + loop + } +} + +fn macroexpand-iter _in-ah: (addr handle cell), _out-ah: (addr handle cell), globals: (addr global-table), trace: (addr trace) { copy-object _in-ah, _out-ah } |