[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scheme interpreter with web interface ?



This is extremely easy to do in PLT Scheme -- about ten lines or so.
I would put up a demo for you, except that would expose my
department's filesystem to the rest of the world to do as they wished
with it, and I have no intent of doing that.

To write something like this yourself, load the _CGI_ library.  Build
an HTML form with a TEXTAREA for code entry.  In the CGI script, using
the CGI library, _extract_ the field corresponding to the TEXTAREA.
Open this as a _string port_, _read_ its content and _eval_ them.
Then _pretty print_ the resulting value to a string port, and use
_string->html_ to include this in the generated page.  You may find
the _XML_ library handy for generating the output.  

That's it!  If you can't figure out how to do this, let me know.

The terms I've underlined above are all phrases you ought to be able
to search for in the search box of Help Desk.  It will lead you to the 
corresponding primitive or primitives.

You will also find the _threads_ and _custodians_ built into PLT
Scheme extremely useful for this task, to enforce timeouts and to
gather up resources allocated by the user's program.

The security risks of doing this are massive.  Be sure you know what
you're doing.

Shriram

Lorenz Graf wrote:

> Hello,
> 
> does anyone know a scheme interpreter to which I can post my code via an
> HTML form and which gives its output it back via web ?
> Or a scheme implementation in Perl or another script language, so I could
> fix up something myself ?
> 
> Regards,
> Lorenz
> 
>