From edd6bf81dadd39f1cb27c435615f2119d53e4ef0 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 12 Aug 2015 22:14:11 -0400 Subject: [PATCH] WIP - macros --- runtime.c | 2 ++ scheme/eval.sld | 18 +++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/runtime.c b/runtime.c index 14866b6e..24280c4b 100644 --- a/runtime.c +++ b/runtime.c @@ -420,6 +420,8 @@ object Cyc_display(object x, FILE *port) if (obj_is_char(x)) {fprintf(port, "%c", obj_obj2char(x)); return quote_void;} switch (type_of(x)) {case macro_tag: + fprintf(port, "",(void *)((closure) x)->fn); + break; case closure0_tag: case closure1_tag: case closure2_tag: diff --git a/scheme/eval.sld b/scheme/eval.sld index 8ac83d3c..4773bb6e 100644 --- a/scheme/eval.sld +++ b/scheme/eval.sld @@ -375,13 +375,17 @@ (define (analyze exp) (cond ((self-evaluating? exp) (analyze-self-evaluating exp)) - ((quoted? exp) (analyze-quoted exp)) - ((quasiquoted? exp) (analyze-quasiquoted exp)) - ((variable? exp) (analyze-variable exp)) - ((assignment? exp) (analyze-assignment exp)) - ((definition? exp) (analyze-definition exp)) - ((if? exp) (analyze-if exp)) - ((lambda? exp) (analyze-lambda exp)) + ((quoted? exp) (analyze-quoted exp)) + ((quasiquoted? exp) (analyze-quasiquoted exp)) + ((variable? exp) (analyze-variable exp)) + ((assignment? exp) (analyze-assignment exp)) + ((definition? exp) (analyze-definition exp)) + ((if? exp) (analyze-if exp)) + ((lambda? exp) (analyze-lambda exp)) + ;; Expand macros + ((and (pair? exp) (macro? (car exp))) +(write (list 'debug 'macro exp)) + (analyze (apply (car exp) (cdr exp)))) ;; TODO: ideally, macro system would handle these next three ((tagged-list? 'let exp) (let ((vars (map car (cadr exp))) ;(let->bindings exp)))