From da3d53340bfbf4b7a05b8d3ccbe235ab16bf6793 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Thu, 13 Aug 2015 00:48:27 -0400 Subject: [PATCH] Added comments --- Makefile | 6 ++++++ scheme/eval.sld | 12 +++++++----- test2.scm | 3 ++- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index de912e1b..9b88012e 100644 --- a/Makefile +++ b/Makefile @@ -140,6 +140,12 @@ uninstall: $(RMDIR) $(DESTDIR)$(DATADIR)/scheme $(RMDIR) $(DESTDIR)$(DATADIR) +# This is an example of how to build/test changes to the compiler. +# With the way everything is setup now, you need to rebuild the module(s), +# install them, and then rebuild the compiler executable to run them. +# +# It may be possible to use dynamic linking to reduce some of this overhead +# in the future (should really look into that!) trans: cyclone scheme/cyclone/transforms.sld && sudo cp scheme/cyclone/transforms.* /usr/local/share/cyclone/scheme/cyclone/ && cyclone cyclone.scm && sudo cp cyc lone /usr/local/bin # cyclone scheme/cyclone/transforms.sld diff --git a/scheme/eval.sld b/scheme/eval.sld index 9b2dc39b..201405d4 100644 --- a/scheme/eval.sld +++ b/scheme/eval.sld @@ -383,11 +383,13 @@ ((if? exp) (analyze-if exp)) ((lambda? exp) (analyze-lambda exp)) ;; Expand macros -;; TODO: does not work below because car is a symbol ('or) and -;; not the actual macro. so how to look it up??? - ((and (pair? exp) (macro? (car exp))) -;(write (list 'debug 'macro exp)) - (analyze (apply (car exp) (cdr exp)))) +; ((and (pair? exp) (symbol? (car exp))) +;;; TODO: look up symbol in env, and expand if it is a macro +; will need to pass env to analyze (ideally), and use same lookup +; code as for analyze-variable. obviously this will introduce +; some extra overhead into eval, which is not ideal. may need to +; reduce that overhead later... +; (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))) diff --git a/test2.scm b/test2.scm index ab035a47..a794b886 100644 --- a/test2.scm +++ b/test2.scm @@ -47,4 +47,5 @@ (define x 1) (write x) (write - (eval '(or 1 2 x))) + (eval 'or)) + ;(eval '(or 1 2 x)))