mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 15:27:36 +02:00
WIP - macros
This commit is contained in:
parent
ba664fe93f
commit
edd6bf81da
2 changed files with 13 additions and 7 deletions
|
@ -420,6 +420,8 @@ object Cyc_display(object x, FILE *port)
|
|||
if (obj_is_char(x)) {fprintf(port, "%c", obj_obj2char(x)); return quote_void;}
|
||||
switch (type_of(x))
|
||||
{case macro_tag:
|
||||
fprintf(port, "<macro %p>",(void *)((closure) x)->fn);
|
||||
break;
|
||||
case closure0_tag:
|
||||
case closure1_tag:
|
||||
case closure2_tag:
|
||||
|
|
|
@ -375,13 +375,17 @@
|
|||
(define (analyze exp)
|
||||
(cond ((self-evaluating? exp)
|
||||
(analyze-self-evaluating exp))
|
||||
((quoted? exp) (analyze-quoted exp))
|
||||
((quasiquoted? exp) (analyze-quasiquoted exp))
|
||||
((variable? exp) (analyze-variable exp))
|
||||
((assignment? exp) (analyze-assignment exp))
|
||||
((definition? exp) (analyze-definition exp))
|
||||
((if? exp) (analyze-if exp))
|
||||
((lambda? exp) (analyze-lambda exp))
|
||||
((quoted? exp) (analyze-quoted exp))
|
||||
((quasiquoted? exp) (analyze-quasiquoted exp))
|
||||
((variable? exp) (analyze-variable exp))
|
||||
((assignment? exp) (analyze-assignment exp))
|
||||
((definition? exp) (analyze-definition exp))
|
||||
((if? exp) (analyze-if exp))
|
||||
((lambda? exp) (analyze-lambda exp))
|
||||
;; Expand macros
|
||||
((and (pair? exp) (macro? (car exp)))
|
||||
(write (list 'debug 'macro exp))
|
||||
(analyze (apply (car exp) (cdr exp))))
|
||||
;; TODO: ideally, macro system would handle these next three
|
||||
((tagged-list? 'let exp)
|
||||
(let ((vars (map car (cadr exp))) ;(let->bindings exp)))
|
||||
|
|
Loading…
Add table
Reference in a new issue