mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-05 12:16:35 +02:00
Removed dead code
This commit is contained in:
parent
8a31c2ed0f
commit
2c9cf5009a
1 changed files with 0 additions and 70 deletions
|
@ -730,76 +730,6 @@
|
||||||
(cadr exp))
|
(cadr exp))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
;; Syntax manipulation.
|
|
||||||
|
|
||||||
;; ; substitute-var : alist[var,exp] ref-exp -> exp
|
|
||||||
;; (define (substitute-var env var)
|
|
||||||
;; (let ((sub (assq var env)))
|
|
||||||
;; (if sub
|
|
||||||
;; (cadr sub)
|
|
||||||
;; var)))
|
|
||||||
;;
|
|
||||||
;; ; substitute : alist[var,exp] exp -> exp
|
|
||||||
;; (define (substitute env exp)
|
|
||||||
;;
|
|
||||||
;; (define (substitute-with env)
|
|
||||||
;; (lambda (exp)
|
|
||||||
;; (substitute env exp)))
|
|
||||||
;;
|
|
||||||
;; (cond
|
|
||||||
;; ; Core forms:
|
|
||||||
;; ((null? env) exp)
|
|
||||||
;; ((const? exp) exp)
|
|
||||||
;; ((prim? exp) exp)
|
|
||||||
;; ((ref? exp) (substitute-var env exp))
|
|
||||||
;; ((lambda? exp) `(lambda ,(lambda->formals exp)
|
|
||||||
;; ,@(map (lambda (body-exp)
|
|
||||||
;; ;; TODO: could be more efficient
|
|
||||||
;; (substitute
|
|
||||||
;; (assq-remove-keys env (lambda->formals exp))
|
|
||||||
;; body-exp))
|
|
||||||
;; (lambda->exp exp))))
|
|
||||||
;; ((set!? exp) `(set! ,(substitute-var env (set!->var exp))
|
|
||||||
;; ,(substitute env (set!->exp exp))))
|
|
||||||
;; ((if? exp) `(if ,(substitute env (if->condition exp))
|
|
||||||
;; ,(substitute env (if->then exp))
|
|
||||||
;; ,(substitute env (if->else exp))))
|
|
||||||
;;
|
|
||||||
;; ; Sugar:
|
|
||||||
;; ((let? exp) `(let ,(azip (let->bound-vars exp)
|
|
||||||
;; (map (substitute-with env) (let->args exp)))
|
|
||||||
;; ,(substitute (assq-remove-keys env (let->bound-vars exp))
|
|
||||||
;; (car (let->exp exp)))))
|
|
||||||
;; ((letrec? exp) (let ((new-env (assq-remove-keys env (letrec->bound-vars exp))))
|
|
||||||
;; `(letrec ,(azip (letrec->bound-vars exp)
|
|
||||||
;; (map (substitute-with new-env)
|
|
||||||
;; (letrec->args exp)))
|
|
||||||
;; ,(substitute new-env (car (letrec->exp exp))))))
|
|
||||||
;; ((begin? exp) (cons 'begin (map (substitute-with env) (begin->exps exp))))
|
|
||||||
;;
|
|
||||||
;; ; IR (1):
|
|
||||||
;; ((cell? exp) `(cell ,(substitute env (cell->value exp))))
|
|
||||||
;; ((cell-get? exp) `(cell-get ,(substitute env (cell-get->cell exp))))
|
|
||||||
;; ((set-cell!? exp) `(set-cell! ,(substitute env (set-cell!->cell exp))
|
|
||||||
;; ,(substitute env (set-cell!->value exp))))
|
|
||||||
;;
|
|
||||||
;; ; IR (2):
|
|
||||||
;; ((closure? exp) `(closure ,(substitute env (closure->lam exp))
|
|
||||||
;; ,(substitute env (closure->env exp))))
|
|
||||||
;; ((env-make? exp) `(env-make ,(env-make->id exp)
|
|
||||||
;; ,@(azip (env-make->fields exp)
|
|
||||||
;; (map (substitute-with env)
|
|
||||||
;; (env-make->values exp)))))
|
|
||||||
;; ((env-get? exp) `(env-get ,(env-get->id exp)
|
|
||||||
;; ,(env-get->field exp)
|
|
||||||
;; ,(substitute env (env-get->env exp))))
|
|
||||||
;;
|
|
||||||
;; ; Application:
|
|
||||||
;; ((app? exp) (map (substitute-with env) exp))
|
|
||||||
;; (else (error "unhandled expression type in substitution: " exp))))
|
|
||||||
;;
|
|
||||||
|
|
||||||
;; Macro expansion
|
;; Macro expansion
|
||||||
|
|
||||||
; expand : exp -> exp
|
; expand : exp -> exp
|
||||||
|
|
Loading…
Add table
Reference in a new issue