Why is run-query not a macro and if it were, why would you quote 
lines-to-syntax-tree? 


> On Jan 27, 2019, at 4:06 PM, Jonathan Simpson <jjsim...@gmail.com> wrote:
> 
> I'm having macro troubles with a DSL I'm writing. I have a macro that looks 
> something like this:
> 
> (define-syntax (query stx)
>   (let ([lines (cdr (syntax->datum stx))])
>     (define lines-syntax-tree (parse-to-tree lines))
>     (datum->syntax stx lines-syntax-tree)))
> 
> So something like 
> 
> (query ...linear series of s-expressions containing non-nested code...)
> 
> is transformed into (...hierarchical code in tree form...).
> 
> But what I really want is
> 
> (run-query '(...code in tree form...))
> 
> The code that I'd like quoted and passed to run-query has a number of macros 
> I wrote that also need expanding. My problem is that all of my attempts to 
> write a macro that results in run-query being passed a list of code to 
> execute blocks the expansion of the passed code. Basically, I want to expand 
> 'lines-syntax-tree' before I quote it and generate an expansion including 
> run-query.
> 
> For instance, this obviously doesn't work:
> 
> (define-syntax (query stx)
>   (let ([lines (cdr (syntax->datum stx))])
>     (define lines-syntax-tree (parse-to-tree lines))
>     (define q (list 'run-query (quote lines-syntax-tree)))
>     (datum->syntax stx q)))
> 
> I'm sure I'm missing something silly, but I'd appreciate any help. I should 
> probably read https://docs.racket-lang.org/reference/syntax-model.html, but 
> it is going to take me some time to grok that.
> 
> Thanks,
> Jonathan
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to racket-users+unsubscr...@googlegroups.com 
> <mailto:racket-users+unsubscr...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to