mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 07:17:37 +02:00
Removed dead code and added a NOTE
This commit is contained in:
parent
4b2b31dc4d
commit
18f687d2ef
1 changed files with 4 additions and 43 deletions
|
@ -833,6 +833,10 @@
|
||||||
(lambda (expr) (expand expr env))
|
(lambda (expr) (expand expr env))
|
||||||
exp))))
|
exp))))
|
||||||
(else
|
(else
|
||||||
|
;; TODO: note that map does not guarantee that expressions are
|
||||||
|
;; evaluated in order. For example, the list might be processed
|
||||||
|
;; in reverse order. Might be better to use a fold here and
|
||||||
|
;; elsewhere in (expand).
|
||||||
(map
|
(map
|
||||||
(lambda (expr) (expand expr env))
|
(lambda (expr) (expand expr env))
|
||||||
exp))))
|
exp))))
|
||||||
|
@ -844,42 +848,6 @@
|
||||||
(expand-body '() exp env))
|
(expand-body '() exp env))
|
||||||
|
|
||||||
;; Helper to expand a lambda body, so we can splice in any begin's
|
;; Helper to expand a lambda body, so we can splice in any begin's
|
||||||
;(define (expand-body result exp env)
|
|
||||||
; (cond
|
|
||||||
; ((null? exp) (reverse result))
|
|
||||||
; ;; Splice in begin contents and keep expanding body
|
|
||||||
; ((begin? (car exp))
|
|
||||||
; (let* ((expr (car exp))
|
|
||||||
; (begin-exprs (begin->exps expr)))
|
|
||||||
; (expand-body
|
|
||||||
; result
|
|
||||||
; (append begin-exprs (cdr exp))
|
|
||||||
; env)))
|
|
||||||
; (else
|
|
||||||
; (let ((macro #f))
|
|
||||||
; (when (and (app? (car exp))
|
|
||||||
; (symbol? (caar exp)))
|
|
||||||
; (set! macro (env:lookup (caar exp) env #f)))
|
|
||||||
; (if (tagged-list? 'macro macro)
|
|
||||||
; ;; Expand macro here so we can catch begins in the expanded code,
|
|
||||||
; ;; including nested begins
|
|
||||||
; (let ((expanded (macro:expand (car exp) macro env)))
|
|
||||||
; ;; Call with expanded macro in case we need to expand again
|
|
||||||
; (expand-body
|
|
||||||
; result
|
|
||||||
; (cons expanded (cdr exp))
|
|
||||||
; env))
|
|
||||||
; ;; No macro, use main expand function to process
|
|
||||||
; (expand-body
|
|
||||||
; (cons
|
|
||||||
; (expand (car exp) env)
|
|
||||||
; result)
|
|
||||||
; (cdr exp)
|
|
||||||
; env))))))
|
|
||||||
|
|
||||||
;; TODO: plan is, rewrite this to enhance it, test, commit, then figure
|
|
||||||
;; out why there is an infinite loop when we use this in cyclone.scm
|
|
||||||
;; for library compilation (in particular, for scheme base).
|
|
||||||
(define (expand-body result exp env)
|
(define (expand-body result exp env)
|
||||||
(define (log e)
|
(define (log e)
|
||||||
(display (list 'expand-body e 'env
|
(display (list 'expand-body e 'env
|
||||||
|
@ -933,13 +901,6 @@
|
||||||
((symbol? (caar exp))
|
((symbol? (caar exp))
|
||||||
;(log (car this-exp))
|
;(log (car this-exp))
|
||||||
(let ((val (env:lookup (caar exp) env #f)))
|
(let ((val (env:lookup (caar exp) env #f)))
|
||||||
;; This step is taking a long time on (scheme base) - possibly because
|
|
||||||
;; it is not using compiled macros???
|
|
||||||
;;
|
|
||||||
;; Note that with (expand) the top-level expressions are expanded in
|
|
||||||
;; reverse order due to the map, whereas they are expanded in-order
|
|
||||||
;; by expand-body due to the explicit recursion.
|
|
||||||
;;
|
|
||||||
;(log `(DONE WITH env:lookup ,(caar exp) ,val ,(tagged-list? 'macro val)))
|
;(log `(DONE WITH env:lookup ,(caar exp) ,val ,(tagged-list? 'macro val)))
|
||||||
(if (tagged-list? 'macro val)
|
(if (tagged-list? 'macro val)
|
||||||
;; Expand macro here so we can catch begins in the expanded code,
|
;; Expand macro here so we can catch begins in the expanded code,
|
||||||
|
|
Loading…
Add table
Reference in a new issue