Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Dmitry Pavlov
Matthew, I think the problem may be that "#lang" is triggering a search for `slon/main` before falling back to `slon/lang/reader`, and since no `slon/main` is embedded, the attempt looks for a "slon" collection. The "#lang" search continues as it should when an "slon" collection is found and no

Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Matthew Flatt
At Fri, 13 Sep 2013 17:54:47 +0400, Dmitry Pavlov wrote: > Matthew, > > > Assuming that this module is `slon/lang/reader`, does it help to add > > > > ++lib slon/lang/reader > > > > to the `raco exe` command, along with the `++lib` argument that you > > have already? > > Unfortunately, no. N

Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Dmitry Pavlov
Matthew, Assuming that this module is `slon/lang/reader`, does it help to add ++lib slon/lang/reader to the `raco exe` command, along with the `++lib` argument that you have already? Unfortunately, no. Nothing has changed: $ raco exe ++lib slon/slon-language ++lib slon/lang/reader slon

Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Matthew Flatt
At Fri, 13 Sep 2013 17:21:09 +0400, Dmitry Pavlov wrote: > > You have a reader for your language that is triggered by "#lang", > > right? > > > > Is that reader in a `reader` submodule, or is it in a separate > > ".../lang/reader.rkt" module file? > > In a separate file: > > $ cat lang/reader.rk

Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Dmitry Pavlov
Matthew, > You have a reader for your language that is triggered by "#lang", right? Is that reader in a `reader` submodule, or is it in a separate ".../lang/reader.rkt" module file? In a separate file: $ cat lang/reader.rkt (module reader syntax/module-reader #:language 'slon/slon-languag

Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Matthew Flatt
You have a reader for your language that is triggered by "#lang", right? Is that reader in a `reader` submodule, or is it in a separate ".../lang/reader.rkt" module file? At Fri, 13 Sep 2013 17:01:36 +0400, Dmitry Pavlov wrote: > Matthew, > > Many thanks! Your code works perfectly for my program

Re: [racket] Evaluating code written in non-SEXP language

2013-09-13 Thread Dmitry Pavlov
Matthew, Many thanks! Your code works perfectly for my program. Now I would like to describe my tries to make a standalone executable out of my program. Most obvious way fails: $ raco exe slon-main.rkt $ ./slon-main standard-module-name-resolver: collection not found collection: "slon" in

Re: [racket] Evaluating code written in non-SEXP language

2013-09-12 Thread Matthew Flatt
I'm not sure I understand what you want, but here are some ideas about evaluating a text that would a module if only a "#lang" line were added. To start, here's a function to `require` an input port that contains a module's source. It uses the current namespace, and it gensyms a name for the modul

Re: [racket] Evaluating code written in non-SEXP language

2013-09-12 Thread Joe Gibbs Politz
On Wed, Sep 11, 2013 at 12:57 PM, Dmitry Pavlov 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

Re: [racket] Evaluating code written in non-SEXP language

2013-09-12 Thread Robby Findler
Probably the simplest thing is to make a copy of the given files and insert the #lang line at the top and then go from there. You can mess around with namespace initialization to get some kind of an approximation to the #lang line for a single file, but it is messy and ultimately doesn't work as w

Re: [racket] Evaluating code written in non-SEXP language

2013-09-11 Thread Dmitry Pavlov
Robby, Generally speaking, Racket is set up to work well with the #lang lines, but > not as well without. Lots of things get easier if they are there. > I accept that thighs without #lang may be hard, but doable nonetheless: for example, DrRacket can run Algol 60 programs without the #lang line i

Re: [racket] Evaluating code written in non-SEXP language

2013-09-11 Thread Dmitry Pavlov
I think, you may simply add #lang into input-port when reading the file. > Good point, but how do I (dynamic-require) a port? I could make a temporary file with the #lang line preceding the contents of the original file, but then I lose all the references to the original file in the parser error m

Re: [racket] Evaluating code written in non-SEXP language

2013-09-11 Thread Robby Findler
Generally speaking, Racket is set up to work well with the #lang lines, but not as well without. Lots of things get easier if they are there. Robby On Wed, Sep 11, 2013 at 11:57 AM, Dmitry Pavlov wrote: > Hi Joe, > > Thank you. Actually my goal is to run files that do > not contain the #lang d

Re: [racket] Evaluating code written in non-SEXP language

2013-09-11 Thread Roman Klochkov
I think, you may simply add #lang into input-port when reading the file. Среда, 11 сентября 2013, 12:08 -05:00 от Robby Findler : >Generally speaking, Racket is set up to work well with the #lang lines, but >not as well without. Lots of things get easier if they are there. > >Robby > > >On Wed

Re: [racket] Evaluating code written in non-SEXP language

2013-09-11 Thread Dmitry Pavlov
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. I tried your approach anyway. It works well itself, but I have failed

Re: [racket] Evaluating code written in non-SEXP language

2013-09-11 Thread Joe Gibbs Politz
Hi Dmitry, I've been using `dynamic-require` for Pyret, a non-SEXP based language. For example, here's part of our command-line interface: https://github.com/brownplt/pyret-lang/blob/master/src/cmdline.rkt#L116 You can ignore the parameterization under `check-mode`, which is Pyret specific. Th