Again, you have an issue of scope. Using `(syntax-local-introduce
(datum->syntax #f 'root))` creates an identifier with no scopes that also
won't get the macro-introduction scope from `md-module-begin`. This works
for `doc` in the previous example, because `handle` can also introduce a
`doc` identi
Thanks, that makes sense. However, I tried doing this with a variable
defined within a program, but it doesn't work. I would like the user to
define their our `root` function to wrap everything, however, when I try to
access it with `syntax-local-introduce` it isn't found. I have:
(define-fo
The error is `set!` reporting that `doc` is undefined, because the `doc`
identifier from `md-module-begin` is introduced hygienically. Also, I
believe your pattern for `md-module-begin` has an extra set of parentheses.
Here is a working version:
#lang racket/base
#lang racket/base
(module lang r
Stupid question, but how would I saving them in a global variable? So far
I have this:
(define-syntax handle
(syntax-parser
[(_ b:expr) #`(set! #,(syntax-local-introduce (datum->syntax #f 'doc))
(string-append #,(syntax-local-introduce (datum->syntax #f 'doc)) b))]))
(define-syntax wrapp
I would try make-wrapping-module-begin too. Basically, it wraps all
module-level forms that "calculates something" with the syntax object
you gave it. For example, the following program
;; some-language.rkt
#lang racket
(provide (except-out (all-from-out racket)
#%module-begi
Thanks for the example. I'm still somewhat new to racket, so I may have to
study the example for a while before I understand it. The
`make-wrapping-module-begin` that Alexis mentioned seems to do something
similar, so I may end up using that due to it's simplicity.
--
You received this messa
In general, you can look for identifiers that are free-identifier=? to
something from the grammar for "fully expanded programs" (
https://docs.racket-lang.org/reference/syntax-model.html#%28part._fully-expanded%29).
That's a little abstract, though, so I've included an example. There might
be more
How would I go about doing this? Is there a certain function that can tell
if something is a top-level declaration?
On Thursday, August 16, 2018 at 6:44:53 PM UTC-6, Philip McGrath wrote:
>
> You probably want to partially expand the expressions, collect the
> definitions, and lift them to the
You might find make-wrapping-module-begin from syntax/modbeg useful here:
http://docs.racket-lang.org/syntax/module-helpers.html#%28def._%28%28lib._syntax%2Fwrap-modbeg..rkt%29._make-wrapping-module-begin%29%29
Alexis
> On Aug 16, 2018, at 18:58, Vityou wrote:
>
> I'm attempting to make a l
You probably want to partially expand the expressions, collect the
definitions, and lift them to the module level.
-Philip
On Thu, Aug 16, 2018 at 11:58 PM, Vityou wrote:
> I'm attempting to make a language similar to scribble. I'm using the
> `make-at-reader` that scribble provides, and have
I'm attempting to make a language similar to scribble. I'm using the
`make-at-reader` that scribble provides, and have my module-begin as this:
(define-syntax md-module-begin
(syntax-parser
[(_ (expr1 ...)) #'(#%module-begin (define doc (parse-markdown
(string-append (begin expr1) ...)))
11 matches
Mail list logo