mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-14 00:07:36 +02:00
Allow ER define-syntax from eval
This commit is contained in:
parent
29b49a371a
commit
ba1d1e87e6
1 changed files with 14 additions and 11 deletions
|
@ -357,9 +357,9 @@
|
||||||
((and (definition? exp)
|
((and (definition? exp)
|
||||||
(not (null? (cdr exp))))
|
(not (null? (cdr exp))))
|
||||||
(analyze-definition exp env))
|
(analyze-definition exp env))
|
||||||
;((and (syntax? exp)
|
((and (syntax? exp)
|
||||||
; (not (null? (cdr exp))))
|
(not (null? (cdr exp))))
|
||||||
; (analyze-syntax exp env))
|
(analyze-syntax exp env))
|
||||||
((and (if? exp)
|
((and (if? exp)
|
||||||
(not (null? (cdr exp))))
|
(not (null? (cdr exp))))
|
||||||
(analyze-if exp env))
|
(analyze-if exp env))
|
||||||
|
@ -407,19 +407,22 @@
|
||||||
(let ((var (cadr exp)))
|
(let ((var (cadr exp)))
|
||||||
(cond
|
(cond
|
||||||
((tagged-list? 'er-macro-transformer (caddr exp))
|
((tagged-list? 'er-macro-transformer (caddr exp))
|
||||||
(let ((sproc (analyze-syntax-lambda (cadr (caddr exp)) a-env)))
|
(let ((sproc (make-macro (cadr (caddr exp))))) ;(analyze-syntax-lambda (cadr (caddr exp)) a-env)))
|
||||||
(lambda (env)
|
(lambda (env)
|
||||||
(env:define-variable! var sproc #;(sproc env) env)
|
(env:define-variable! var sproc env)
|
||||||
'ok)))
|
'ok)))
|
||||||
(else
|
(else
|
||||||
|
;; TODO: need to support syntax-rules, and other methods of
|
||||||
|
;; building a macro. maybe call into something like
|
||||||
|
;; analyze-syntax-lambda instead of erroring here
|
||||||
(error "macro syntax not supported yet")))))
|
(error "macro syntax not supported yet")))))
|
||||||
|
|
||||||
(define (analyze-syntax-lambda exp a-env)
|
;(define (analyze-syntax-lambda exp a-env)
|
||||||
(let ((vars (lambda-parameters exp))
|
; (let ((vars (lambda-parameters exp))
|
||||||
(bproc (analyze-sequence (lambda-body exp) a-env)))
|
; (bproc (analyze-sequence (lambda-body exp) a-env)))
|
||||||
(write `(debug ,(lambda-body exp)))
|
; (write `(debug ,(lambda-body exp)))
|
||||||
;(lambda (env)
|
; ;(lambda (env)
|
||||||
(make-macro `(lambda ,vars ,@(lambda-body exp)))))
|
; (make-macro `(lambda ,vars ,@(lambda-body exp)))))
|
||||||
|
|
||||||
(define (analyze-if exp a-env)
|
(define (analyze-if exp a-env)
|
||||||
(let ((pproc (analyze (if-predicate exp) a-env))
|
(let ((pproc (analyze (if-predicate exp) a-env))
|
||||||
|
|
Loading…
Add table
Reference in a new issue