From f1bd626bdb02170b189891d8f8f3f3cc6b592209 Mon Sep 17 00:00:00 2001 From: Tim Vaughan Date: Mon, 12 Jun 2017 23:40:12 +1200 Subject: [PATCH] Added expression sequences to macro expander. --- src/scheme.4th | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) 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 -- 2.20.1