start to trampoline macro expansion
This commit is contained in:
parent
2c6cf77b53
commit
af678f40ec
|
@ -113,6 +113,7 @@
|
|||
(for-template #%parens #%brackets #%braces)
|
||||
;; (for-meta 2 (rename-out (honu-syntax syntax)))
|
||||
(rename-out
|
||||
(syntax real-syntax)
|
||||
(honu-if if)
|
||||
(honu-provide provide)
|
||||
(honu-macro-item macroItem)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
"parse.ss"
|
||||
"literals.ss"
|
||||
)
|
||||
syntax/parse
|
||||
"literals.ss"
|
||||
;; "typed-utils.ss"
|
||||
)
|
||||
|
@ -556,6 +557,10 @@ if (foo){
|
|||
#'(require (for-syntax what))))
|
||||
#'rest)])))
|
||||
|
||||
#;
|
||||
(define-splicing-syntax-class unparsed
|
||||
[pattern (~seq x ...) #:with result #'(honu-unparsed-begin x ...)])
|
||||
|
||||
(define-syntax (honu-unparsed-begin stx)
|
||||
(printf "honu unparsed begin: ~a at phase ~a\n" (syntax->datum stx) (syntax-local-phase-level))
|
||||
(syntax-case stx ()
|
||||
|
|
|
@ -503,6 +503,7 @@
|
|||
(with-syntax ([(real-out (... ...)) #'(code ...)])
|
||||
(let ([result (honu-unparsed-begin #'(real-out (... ...)))])
|
||||
(lambda () result)))
|
||||
(printf "Macro transformer `~a'\n" (syntax->datum #'(code ...)))
|
||||
(let ([result (honu-unparsed-begin code ...)])
|
||||
(lambda () result))
|
||||
#'(rrest (... ...)))]))))))
|
||||
|
|
|
@ -208,7 +208,8 @@
|
|||
(with-syntax ([a #'(fix-template #'(honu-unparsed-begin expr ...))])
|
||||
#'a)
|
||||
|
||||
(printf "Making unparsed syntax???\n")
|
||||
(printf "Making unparsed syntax with `~a'\n" (syntax->datum #'(expr (... ...))))
|
||||
|
||||
#;
|
||||
(with-syntax ([unparsed (make-unparsed #'(expr ...))])
|
||||
#'(fix-template unparsed))
|
||||
|
@ -232,7 +233,9 @@
|
|||
#;
|
||||
(with-syntax ([(out ...) (local-expand #'(expr ...) 'expression '())])
|
||||
#'(honu-unparsed-begin out ...)))
|
||||
#'rest)]))))
|
||||
#'rest)]
|
||||
[else (raise-syntax-error 'maker "you have used this incorrectly")]
|
||||
))))
|
||||
|
||||
(honu-syntax-maker honu-syntax honu-unparsed-begin)
|
||||
(honu-syntax-maker honu-expression-syntax honu-unparsed-expr)
|
||||
|
|
|
@ -496,6 +496,11 @@
|
|||
[else (raise-syntax-error 'parse-an-expr "cant parse" stx)]
|
||||
))
|
||||
|
||||
(define-syntax (invoke-transformer stx)
|
||||
(syntax-parse stx
|
||||
[(_ all ...)
|
||||
(parse #'(all ...))]))
|
||||
|
||||
(define-splicing-syntax-class honu-body:class
|
||||
#:literals (#%braces)
|
||||
[pattern (~seq (#%braces code ...))])
|
||||
|
@ -548,7 +553,14 @@
|
|||
(parse-block-one/2 #'(stuff ... more ...) context))])
|
||||
(values out rest2))))
|
||||
]
|
||||
[(get-transformer stx) => (lambda (transformer)
|
||||
[(get-transformer stx) =>
|
||||
(lambda (transformer)
|
||||
(values
|
||||
(with-syntax ([(all ...) stx])
|
||||
#'(invoke-transformer all ...))
|
||||
#'()))
|
||||
#;
|
||||
(lambda (transformer)
|
||||
(define introducer (make-syntax-introducer))
|
||||
(define introduce introducer)
|
||||
(define unintroduce introducer)
|
||||
|
|
Loading…
Reference in New Issue
Block a user