[racket] Evaluating code written in non-SEXP language

From: Joe Gibbs Politz (joe at cs.brown.edu)
Date: Thu Sep 12 09:20:52 EDT 2013

On Wed, Sep 11, 2013 at 12:57 PM, Dmitry Pavlov <dpavlov at ipa.nw.ru> wrote:
> Hi Joe,
> Thank you. Actually my goal is to run files that do
> not contain the #lang declaration--only pure non-Racket
> non-sexp code. Is there a way to (dynamic-require)
> a module with an externally preset language? I do not know.

Not that I've been able to find.  We've hacked this to some degree so
that we can write tests as raw strings in Racket files.  For example,
lines 42-57 of this file
show how to construct a namespace and use `eval` to run a string
parsed down to a Racket syntax object in the Pyret namespace.  I'm not
sure this is the best code for doing this, as there was a bit of
guesswork involved in getting all of that to what we expected.

The payoff is that we can write tests just as strings in a Racket file:


> I tried your approach anyway. It works well itself,
> but I have failed (as with all the other approaches)
> to make a standalone executable from my "interpreter"
> program. I wonder if anybody tried that with programs
> of this kind.

Were you trying something like `raco exe` for this?  I've had issues
there as well, and it's not impossible that they'd be similar to
yours.  I started a thread about this a few days ago, but I suspect it
requires Matthew to answer.  Can you share what you've tried?

Posted on the users mailing list.