-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacro.lisp
31 lines (23 loc) · 913 Bytes
/
macro.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;;;; macro.lisp
;;;; req. COMBINE, EVAL
(in-package #:mother)
(defclass macro (operative)
((underlying :accessor macro-underlying :initarg :op)))
(defun macrotize (op) (make-instance 'macro :op op)) ; generic?
(defun expand-macro-combination (macro operands env) ; generic?
(combine (macro-underlying macro) operands env))
(defmethod combine ((operator macro) operands env)
(eval (expand-macro-combination operator operands env) env))
(defprim macrotize (wrap (primitive %macrotize (#(op combiner)) nil (macrotize op))))
#+(and (or) kernel)
($define! $let-redirect
($vau (exp bindings . body) env
(eval (list* (eval (list* $lambda (map car bindings) body)
(eval exp
env))
(map cadr bindings))
env)))
#+(and (or) kernel)
($define! $let-redirect
($macro (exp bindings . body) env
(list* (list eval (list* $lambda (map car bindings) body) exp) (map cadr bindings))))