Cleanup, removed dead code

This commit is contained in:
Justin Ethier 2017-12-17 18:44:37 -05:00
parent 274bf0acfa
commit 7d7ae2e89e

View file

@ -470,26 +470,24 @@
(define (analyze-letrec-syntax exp a-env) (define (analyze-letrec-syntax exp a-env)
(let* ((rename-env (env:extend-environment '() '() '())) (let* ((rename-env (env:extend-environment '() '() '()))
;; Build up a macro env
(vars (foldl (lambda (lis acc) (append acc (car lis))) '() a-env)) (vars (foldl (lambda (lis acc) (append acc (car lis))) '() a-env))
(vals (foldl (lambda (lis acc) (append acc (cdr lis))) '() a-env)) (vals (foldl (lambda (lis acc) (append acc (cdr lis))) '() a-env))
(zipped (apply map list vars (list vals))) (zipped (apply map list vars (list vals)))
(defined-macros (defined-macros
(filter (filter
(lambda (v) (lambda (v)
(Cyc-macro? (Cyc-get-cvar (cadr v)))) (Cyc-macro? (Cyc-get-cvar (cadr v))))
zipped)) zipped))
(macro-env (macro-env
(env:extend-environment (env:extend-environment
(map car defined-macros) (map car defined-macros)
(map (lambda (v) (map (lambda (v)
(list 'macro (cadr v))) (list 'macro (cadr v)))
defined-macros) defined-macros)
a-env)) a-env)) ;(create-environment '() '())))
;(create-environment '() '()))) ;; Proceed with macro env
(expanded (expand exp macro-env rename-env)) (expanded (expand exp macro-env rename-env))
;(expanded (expand exp a-env rename-env))
(cleaned (macro:cleanup expanded rename-env)) (cleaned (macro:cleanup expanded rename-env))
) )
(analyze cleaned a-env))) (analyze cleaned a-env)))
@ -854,18 +852,12 @@
(clean expr '())) (clean expr '()))
; TODO: get macro name, transformer ; TODO: get macro name, transformer
; TODO: let-syntax forms
;; Macro expansion ;; Macro expansion
;TODO: modify this whole section to use macros:get-env instead of *defined-macros*. macro:get-env becomes the mac-env. any new scopes need to extend that env, and an env parameter needs to be added to (expand). any macros defined with define-syntax use that env as their mac-env (how to store that)? ;TODO: modify this whole section to use macros:get-env instead of *defined-macros*. macro:get-env becomes the mac-env. any new scopes need to extend that env, and an env parameter needs to be added to (expand). any macros defined with define-syntax use that env as their mac-env (how to store that)?
; expand : exp -> exp ; expand : exp -> exp
;; TODO: need a local version of each expand that receives a local env built by
;; let-syntax forms
;;(define (expand exp env rename-env local-env)
;;(define (_expand exp env rename-env)
(define (expand exp env rename-env) (define (expand exp env rename-env)
(_expand exp env rename-env '())) (_expand exp env rename-env '()))