emit macro-debugger steps. dont try to use phased macro invocation
This commit is contained in:
parent
af678f40ec
commit
44fc323cff
|
@ -14,6 +14,7 @@
|
||||||
"private/literals.ss"
|
"private/literals.ss"
|
||||||
"private/syntax.ss"
|
"private/syntax.ss"
|
||||||
"private/more.ss"
|
"private/more.ss"
|
||||||
|
(for-template scheme/base)
|
||||||
(for-template "private/literals.rkt")
|
(for-template "private/literals.rkt")
|
||||||
(for-syntax "private/more.ss")
|
(for-syntax "private/more.ss")
|
||||||
(for-syntax "private/syntax.ss")
|
(for-syntax "private/syntax.ss")
|
||||||
|
@ -34,7 +35,7 @@
|
||||||
(define (sql5) #f)
|
(define (sql5) #f)
|
||||||
|
|
||||||
(provide (rename-out (#%dynamic-honu-module-begin #%module-begin)
|
(provide (rename-out (#%dynamic-honu-module-begin #%module-begin)
|
||||||
(honu-top #%top)
|
;; (honu-top #%top)
|
||||||
(semicolon \;
|
(semicolon \;
|
||||||
)
|
)
|
||||||
(honu-+ +)
|
(honu-+ +)
|
||||||
|
@ -48,6 +49,8 @@
|
||||||
(honu-. |.|)
|
(honu-. |.|)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#%top
|
||||||
|
|
||||||
;; sql nonsense
|
;; sql nonsense
|
||||||
(rename-out
|
(rename-out
|
||||||
(sql1 SQL_create_insert)
|
(sql1 SQL_create_insert)
|
||||||
|
@ -97,12 +100,15 @@
|
||||||
display2
|
display2
|
||||||
newline
|
newline
|
||||||
with-syntax
|
with-syntax
|
||||||
|
honu-unparsed-begin
|
||||||
|
(for-template with-syntax)
|
||||||
;; stuff i done want
|
;; stuff i done want
|
||||||
define
|
define
|
||||||
let
|
let
|
||||||
;; end stuff
|
;; end stuff
|
||||||
else
|
else
|
||||||
#%app
|
#%app
|
||||||
|
(for-template #%app)
|
||||||
quote
|
quote
|
||||||
...
|
...
|
||||||
foobar2000
|
foobar2000
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
syntax/parse
|
syntax/parse
|
||||||
syntax/parse/experimental/splicing
|
syntax/parse/experimental/splicing
|
||||||
scheme/splicing
|
scheme/splicing
|
||||||
|
macro-debugger/emit
|
||||||
"contexts.ss"
|
"contexts.ss"
|
||||||
"util.ss"
|
"util.ss"
|
||||||
"ops.ss"
|
"ops.ss"
|
||||||
|
@ -506,10 +507,11 @@ if (foo){
|
||||||
(define-honu-syntax scheme-syntax
|
(define-honu-syntax scheme-syntax
|
||||||
(lambda (body ctx)
|
(lambda (body ctx)
|
||||||
(syntax-parse body
|
(syntax-parse body
|
||||||
[(_ expr . rest)
|
[(_ template . rest)
|
||||||
(values
|
(values
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(apply-scheme-syntax #'#'expr))
|
(printf "Applying syntax to ~a\n" (quote-syntax template))
|
||||||
|
(apply-scheme-syntax #'#'template))
|
||||||
#'rest)])))
|
#'rest)])))
|
||||||
|
|
||||||
(define-honu-syntax honu-provide
|
(define-honu-syntax honu-provide
|
||||||
|
@ -562,6 +564,9 @@ if (foo){
|
||||||
[pattern (~seq x ...) #:with result #'(honu-unparsed-begin x ...)])
|
[pattern (~seq x ...) #:with result #'(honu-unparsed-begin x ...)])
|
||||||
|
|
||||||
(define-syntax (honu-unparsed-begin stx)
|
(define-syntax (honu-unparsed-begin stx)
|
||||||
|
(emit-remark "Honu unparsed begin!" stx)
|
||||||
|
#;
|
||||||
|
(emit-remark "Honu unparsed begin" stx)
|
||||||
(printf "honu unparsed begin: ~a at phase ~a\n" (syntax->datum stx) (syntax-local-phase-level))
|
(printf "honu unparsed begin: ~a at phase ~a\n" (syntax->datum stx) (syntax-local-phase-level))
|
||||||
(syntax-case stx ()
|
(syntax-case stx ()
|
||||||
[(_) #'(void)]
|
[(_) #'(void)]
|
||||||
|
|
|
@ -5,6 +5,9 @@
|
||||||
"parse.ss"
|
"parse.ss"
|
||||||
"syntax.ss"
|
"syntax.ss"
|
||||||
syntax/parse
|
syntax/parse
|
||||||
|
(for-syntax macro-debugger/emit)
|
||||||
|
(for-meta 2 macro-debugger/emit
|
||||||
|
scheme/base)
|
||||||
(for-meta -3
|
(for-meta -3
|
||||||
(only-in "literals.rkt" (#%parens literal-parens)))
|
(only-in "literals.rkt" (#%parens literal-parens)))
|
||||||
#;
|
#;
|
||||||
|
@ -454,6 +457,7 @@
|
||||||
|
|
||||||
(define foobar 0)
|
(define foobar 0)
|
||||||
|
|
||||||
|
|
||||||
(define-honu-syntax honu-macro
|
(define-honu-syntax honu-macro
|
||||||
(lambda (stx ctx)
|
(lambda (stx ctx)
|
||||||
(define-syntax-class honu-macro3
|
(define-syntax-class honu-macro3
|
||||||
|
@ -493,6 +497,7 @@
|
||||||
(syntax/loc stx
|
(syntax/loc stx
|
||||||
(define-honu-syntax name
|
(define-honu-syntax name
|
||||||
(lambda (stx ctx)
|
(lambda (stx ctx)
|
||||||
|
#;
|
||||||
(printf "Executing macro `~a' on input `~a'\n" 'name (syntax->datum stx))
|
(printf "Executing macro `~a' on input `~a'\n" 'name (syntax->datum stx))
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
#:literal-sets ([cruft #:at name])
|
#:literal-sets ([cruft #:at name])
|
||||||
|
@ -503,9 +508,15 @@
|
||||||
(with-syntax ([(real-out (... ...)) #'(code ...)])
|
(with-syntax ([(real-out (... ...)) #'(code ...)])
|
||||||
(let ([result (honu-unparsed-begin #'(real-out (... ...)))])
|
(let ([result (honu-unparsed-begin #'(real-out (... ...)))])
|
||||||
(lambda () result)))
|
(lambda () result)))
|
||||||
(printf "Macro transformer `~a'\n" (syntax->datum #'(code ...)))
|
(begin
|
||||||
|
#;
|
||||||
|
(emit-remark "Do macro transformer" (quote-syntax (code ...)))
|
||||||
|
#;
|
||||||
|
(printf "Macro transformer `~a'\n" (syntax->datum (quote-syntax (code ...))))
|
||||||
(let ([result (honu-unparsed-begin code ...)])
|
(let ([result (honu-unparsed-begin code ...)])
|
||||||
(lambda () result))
|
(lambda ()
|
||||||
|
(emit-remark "Excuting macro " (symbol->string 'name))
|
||||||
|
result)))
|
||||||
#'(rrest (... ...)))]))))))
|
#'(rrest (... ...)))]))))))
|
||||||
#;
|
#;
|
||||||
(with-syntax ([parsed (let-values ([(out rest*)
|
(with-syntax ([parsed (let-values ([(out rest*)
|
||||||
|
|
|
@ -214,6 +214,19 @@
|
||||||
(with-syntax ([unparsed (make-unparsed #'(expr ...))])
|
(with-syntax ([unparsed (make-unparsed #'(expr ...))])
|
||||||
#'(fix-template unparsed))
|
#'(fix-template unparsed))
|
||||||
|
|
||||||
|
#;
|
||||||
|
(datum->syntax stx
|
||||||
|
(cons #'fix-template
|
||||||
|
(cons #'unparsed #'(expr (... ...))))
|
||||||
|
stx stx)
|
||||||
|
|
||||||
|
#;
|
||||||
|
(let ([original #'(expr (... ...))])
|
||||||
|
(datum->syntax original
|
||||||
|
(cons #'fix-template
|
||||||
|
(cons #'unparsed #'(expr (... ...))))
|
||||||
|
original original))
|
||||||
|
|
||||||
#'(fix-template (unparsed expr (... ...)))
|
#'(fix-template (unparsed expr (... ...)))
|
||||||
|
|
||||||
#;
|
#;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
syntax/parse/experimental/splicing
|
syntax/parse/experimental/splicing
|
||||||
"syntax.ss"
|
"syntax.ss"
|
||||||
(for-syntax syntax/parse)
|
(for-syntax syntax/parse)
|
||||||
|
macro-debugger/emit
|
||||||
scheme/splicing
|
scheme/splicing
|
||||||
(for-syntax syntax/define)
|
(for-syntax syntax/define)
|
||||||
syntax/name
|
syntax/name
|
||||||
|
@ -496,11 +497,6 @@
|
||||||
[else (raise-syntax-error 'parse-an-expr "cant parse" stx)]
|
[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
|
(define-splicing-syntax-class honu-body:class
|
||||||
#:literals (#%braces)
|
#:literals (#%braces)
|
||||||
[pattern (~seq (#%braces code ...))])
|
[pattern (~seq (#%braces code ...))])
|
||||||
|
@ -553,14 +549,7 @@
|
||||||
(parse-block-one/2 #'(stuff ... more ...) context))])
|
(parse-block-one/2 #'(stuff ... more ...) context))])
|
||||||
(values out rest2))))
|
(values out rest2))))
|
||||||
]
|
]
|
||||||
[(get-transformer stx) =>
|
[(get-transformer stx) => (lambda (transformer)
|
||||||
(lambda (transformer)
|
|
||||||
(values
|
|
||||||
(with-syntax ([(all ...) stx])
|
|
||||||
#'(invoke-transformer all ...))
|
|
||||||
#'()))
|
|
||||||
#;
|
|
||||||
(lambda (transformer)
|
|
||||||
(define introducer (make-syntax-introducer))
|
(define introducer (make-syntax-introducer))
|
||||||
(define introduce introducer)
|
(define introduce introducer)
|
||||||
(define unintroduce introducer)
|
(define unintroduce introducer)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user