Hey all, I ended up figuring this out. 
The solution was essentially to make a reader that looked like this:

(define (read-syntax input-port)
  (let ([copy1 (copy input-port)]
        [copy2 (copy input-port)])
     (with-syntax ([mod1 (Lang1-read-syntax copy1)]
                   [mod2 (Lang2-read-syntax copy2)])
        #'(module mod-name racket
             mod1
             mod2
             (require *mod1's name*)
             (require *mod2's name*)))))

Then users can do a #lang *This language's name*
and it will produce the results of both languages! Turning them into dynamic 
requires and wrapping them with error handling works too!

On Sunday, August 13, 2017 at 1:25:10 PM UTC-4, Ben Greenman wrote:
> One idea:
> - write your program just like that, `1 + 2` with no #lang line,
> - run your program with a raco command that runs the program once for each 
> language
> 
> 
> Something like `raco mystery-lang -L lang1 -L lang2 -L lang3 file.txt`
> 
> 
> 
> 
> In case you need an example raco-command:
> https://github.com/AlexKnauth/syntax-sloc/blob/master/syntax-sloc/info.rkt
> 
> 
> 
> On Sat, Aug 12, 2017 at 7:45 PM, Sam Waxman <samw...@gmail.com> wrote:
> Hello,
> 
> 
> 
> Let's say I have a program the user entered that just looks like
> 
> 
> 
> 
> 
> 1 + 2
> 
> 
> 
> 
> 
> and I have three different #langs, all with different parsers and different 
> notions of addition, for which this is a valid program. I'm looking to make 
> it so that this program outputs the following:
> 
> 
> 
> "Output for language 1:
> 
>  ....
> 
> 
> 
> Output for language 2:
> 
>  ....
> 
> 
> 
> Output for language 3:
> 
>  ....
> 
> "
> 
> 
> 
> Is there any simple way to do this?
> 
> 
> 
> --
> 
> 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...@googlegroups.com.
> 
> For more options, visit 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