mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 23:37:38 +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;}
|
if (obj_is_char(x)) {fprintf(port, "%c", obj_obj2char(x)); return quote_void;}
|
||||||
switch (type_of(x))
|
switch (type_of(x))
|
||||||
{case macro_tag:
|
{case macro_tag:
|
||||||
|
fprintf(port, "<macro %p>",(void *)((closure) x)->fn);
|
||||||
|
break;
|
||||||
case closure0_tag:
|
case closure0_tag:
|
||||||
case closure1_tag:
|
case closure1_tag:
|
||||||
case closure2_tag:
|
case closure2_tag:
|
||||||
|
|
|
@ -382,6 +382,10 @@
|
||||||
((definition? exp) (analyze-definition exp))
|
((definition? exp) (analyze-definition exp))
|
||||||
((if? exp) (analyze-if exp))
|
((if? exp) (analyze-if exp))
|
||||||
((lambda? exp) (analyze-lambda 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
|
;; TODO: ideally, macro system would handle these next three
|
||||||
((tagged-list? 'let exp)
|
((tagged-list? 'let exp)
|
||||||
(let ((vars (map car (cadr exp))) ;(let->bindings exp)))
|
(let ((vars (map car (cadr exp))) ;(let->bindings exp)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue