mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 00:07:36 +02:00
WIP
This commit is contained in:
parent
1444e89d73
commit
915915b75f
3 changed files with 14 additions and 11 deletions
18
cyclone.scm
18
cyclone.scm
|
@ -117,13 +117,15 @@
|
||||||
(lambda (v)
|
(lambda (v)
|
||||||
(macro? (Cyc-get-cvar (cdr v))))
|
(macro? (Cyc-get-cvar (cdr v))))
|
||||||
(Cyc-global-vars))))
|
(Cyc-global-vars))))
|
||||||
(trace:info (map
|
(set! *defined-macros*
|
||||||
(lambda (v)
|
(append
|
||||||
; TODO: can prepend these macros to *defined-macros*, but
|
;(map
|
||||||
; also need to use Cyc-get-cvar to deref before using macro
|
; (lambda (v)
|
||||||
; during expansion
|
; (cons (car v) (cdr v)))
|
||||||
(cons (car v) (cdr v)))
|
; macros))
|
||||||
macros)))
|
macros
|
||||||
|
*defined-macros*)))
|
||||||
|
TODO: try this again, make sure macro is loaded: (trace:info *defined-macros*)
|
||||||
;; END JAE DEBUG
|
;; END JAE DEBUG
|
||||||
|
|
||||||
(set! input-program (expand input-program))
|
(set! input-program (expand input-program))
|
||||||
|
@ -271,7 +273,7 @@
|
||||||
(in-prog (read-file in-file))
|
(in-prog (read-file in-file))
|
||||||
(program? (not (library? (car in-prog))))
|
(program? (not (library? (car in-prog))))
|
||||||
(lib-deps
|
(lib-deps
|
||||||
(if (and program?
|
(if (my-and program?
|
||||||
(tagged-list? 'import (car in-prog)))
|
(tagged-list? 'import (car in-prog)))
|
||||||
(lib:get-all-import-deps (cdar in-prog))
|
(lib:get-all-import-deps (cdar in-prog))
|
||||||
'()))
|
'()))
|
||||||
|
|
|
@ -49,10 +49,10 @@
|
||||||
|
|
||||||
;; assumes ER macro
|
;; assumes ER macro
|
||||||
(if macro
|
(if macro
|
||||||
((cdr macro)
|
((Cyc-get-cvar (cdr macro))
|
||||||
;exp
|
;exp
|
||||||
; could be a raw lambda, if that is the case try quoting it
|
; could be a raw lambda, if that is the case try quoting it
|
||||||
(if (procedure? (cdr macro))
|
(if (macro? (Cyc-get-cvar (cdr macro)))
|
||||||
exp
|
exp
|
||||||
(list 'quote exp))
|
(list 'quote exp))
|
||||||
rename
|
rename
|
||||||
|
|
|
@ -1048,8 +1048,9 @@
|
||||||
;would have to look up symbol to see if it is a macro, and then get the macro that way...
|
;would have to look up symbol to see if it is a macro, and then get the macro that way...
|
||||||
;may need to have a *define-macros* equivalent but in the compiled code, similar to globals.
|
;may need to have a *define-macros* equivalent but in the compiled code, similar to globals.
|
||||||
;need to be able to look up var in a list and get the (macro?) instance.
|
;need to be able to look up var in a list and get the (macro?) instance.
|
||||||
((or (macro? exp)
|
((or ;(macro? exp)
|
||||||
(macro:macro? exp *defined-macros*))
|
(macro:macro? exp *defined-macros*))
|
||||||
|
(trace:info (list 'expanding exp))
|
||||||
(expand ;; Could expand into another macro
|
(expand ;; Could expand into another macro
|
||||||
(macro:expand exp *defined-macros*)))
|
(macro:expand exp *defined-macros*)))
|
||||||
(else
|
(else
|
||||||
|
|
Loading…
Add table
Reference in a new issue