mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-24 20:45:06 +02:00
WIP
This commit is contained in:
parent
42a7790a29
commit
3608c2aeda
2 changed files with 27 additions and 26 deletions
|
@ -143,7 +143,7 @@
|
||||||
(car vals))))
|
(car vals))))
|
||||||
(else (scan (cdr vars) (cdr vals)))))
|
(else (scan (cdr vars) (cdr vals)))))
|
||||||
(if (eq? env the-empty-environment)
|
(if (eq? env the-empty-environment)
|
||||||
(error "Unbound variable" var)
|
(not-found)
|
||||||
(let ((frame (first-frame env)))
|
(let ((frame (first-frame env)))
|
||||||
(scan (frame-variables frame)
|
(scan (frame-variables frame)
|
||||||
(frame-values frame)))))
|
(frame-values frame)))))
|
||||||
|
@ -466,30 +466,30 @@
|
||||||
(loop (car procs) (cdr procs))))
|
(loop (car procs) (cdr procs))))
|
||||||
|
|
||||||
(define (pre-analyze-application exp a-env)
|
(define (pre-analyze-application exp a-env)
|
||||||
; (let* ((op (operator exp))
|
(let* ((op (operator exp))
|
||||||
; (var (if (symbol? op)
|
(var (if (symbol? op)
|
||||||
; (_lookup-variable-value op a-env
|
(_lookup-variable-value op a-env
|
||||||
; (lambda () #f)) ; Not found
|
(lambda () #f)) ; Not found
|
||||||
; #f)))
|
#f)))
|
||||||
; (cond
|
(cond
|
||||||
; ((macro? var)
|
((macro? var)
|
||||||
;; look up symbol in env, and expand if it is a macro
|
; look up symbol in env, and expand if it is a macro
|
||||||
;; Adds some extra overhead into eval, which is not ideal. may need to
|
; Adds some extra overhead into eval, which is not ideal. may need to
|
||||||
;; reduce that overhead later...
|
; reduce that overhead later...
|
||||||
;(write (list 'JAE-DEBUG 'expanding exp)) ;; DEBUG-only
|
(write (list 'JAE-DEBUG 'expanding exp)) ;; DEBUG-only
|
||||||
; ;; TODO: need to use common rename/compare functions
|
;; TODO: need to use common rename/compare functions
|
||||||
; ;; instead of fudging them here. maybe keep common
|
;; instead of fudging them here. maybe keep common
|
||||||
; ;; functions in the macros module and hook into them???
|
;; functions in the macros module and hook into them???
|
||||||
;
|
|
||||||
; ;; see macro-expand in that module. believe these are the only
|
;; see macro-expand in that module. believe these are the only
|
||||||
; ;; two places so far that introduce instances of rename/compare?
|
;; two places so far that introduce instances of rename/compare?
|
||||||
; (analyze (apply op
|
(analyze (apply var
|
||||||
; (list (cons op (operands exp))
|
(list (cons var (operands exp))
|
||||||
; (lambda (sym) sym)
|
(lambda (sym) sym)
|
||||||
; (lambda (a b) (eq? a b))))
|
(lambda (a b) (eq? a b))))
|
||||||
; a-env))
|
a-env))
|
||||||
; (else
|
(else
|
||||||
(analyze-application exp a-env)) ;)))
|
(analyze-application exp a-env)))))
|
||||||
|
|
||||||
(define (analyze-application exp a-env)
|
(define (analyze-application exp a-env)
|
||||||
(let ((fproc (analyze (operator exp) a-env))
|
(let ((fproc (analyze (operator exp) a-env))
|
||||||
|
|
|
@ -48,4 +48,5 @@
|
||||||
(write x)
|
(write x)
|
||||||
(write
|
(write
|
||||||
(eval 'or))
|
(eval 'or))
|
||||||
;(eval '(or 1 2 x)))
|
(write
|
||||||
|
(eval '(or 1 2 x)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue