On Sat, 3 Sept 2022 at 19:10, Shu-Hung You <[email protected]>
wrote:

> Running `racket foo.asm` will produce the desired output, so a shell
> script that directly passes the arguments to Racket could work.
> Otherwise, just use (dynamic-require filename #f) in main.rkt.
>

Thanks for helping!

Don't both of these methods require a #lang line in the input file? That's
not part of the assembly format, so I want to be able to specify the
language in the main module. Indeed, when I try it with a file with a #lang
line, dynamic-require works; when I remove that line, I get an error about
a missing module declaration (no surprise). I can see an obvious
workaround, namely to slurp the file and prepend a module declaration
before dynamic-requiring it, but that's ugly.

So it seems that in fact what I want is to call something like
dynamic-require with a module object. But I'm not sure what to call or how
to get one of those: read-syntax returns a syntax object, not a module,
while I don't (yet) know how to apply my expander's #%module-begin to it to
obtain a module.

At the technical level, foo.asm is in fact an ordinary Racket module,
> just like any other .rkt file. Therefore it can be run in the same way
> using APIs that require and instantiate modules.
>

Right! That's what I've obviously not fully understood yet.

(Thanks for the side node about moving to Discourse—it's a while since I've
been active on the list!)

-- 
https://rrt.sc3d.org

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAOnWdojngwzQRGz0dj1QpA4OJixOKGMXGLrepdae08D8dhpJfQ%40mail.gmail.com.

Reply via email to