From: Tim Vaughan Date: Mon, 12 Jun 2017 11:40:12 +0000 (+1200) Subject: Added expression sequences to macro expander. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=f1bd626bdb02170b189891d8f8f3f3cc6b592209;p=scheme.forth.jl.git Added expression sequences to macro expander. --- diff --git a/src/scheme.4th b/src/scheme.4th index 67b656c..0722208 100644 --- a/src/scheme.4th +++ b/src/scheme.4th @@ -1757,12 +1757,9 @@ hide env defer expand : expand-quasiquote ; -: expand-definition ; -: expand-assignment ; : expand-define-macro ; : expand-if ; : expand-lambda ; -: expand-begin ; : expand-application ; : expand-macro ( exp -- result ) @@ -1801,6 +1798,27 @@ defer expand cons cons cons ; +: expand-sequence ( exp -- res ) + nil? if exit then + + 2dup car expand + 2swap cdr recurse + + cons ; + +: expand-begin ( exp -- res ) + begin-symbol 2swap + begin-actions expand-sequence + + cons ; + +: expand-lambda ( exp -- res ) + lambda-symbol 2swap + 2dup lambda-parameters + 2swap lambda-body expand-sequence + + cons cons ; + :noname ( exp -- result ) expand-macro