Re: Aspects of JavaScript Schemes
Marc Feeley 29 Dec 2020 21:35 UTC
> On Dec 29, 2020, at 11:54 AM, Jakub T. Jankiewicz <xxxxxx@onet.pl> wrote:
>
>
>> If we can get people collaborating on try.scheme.org, we could add one
>> code editor there that works with all the supported JavaScript Schemes.
>> In the best case, it could save everyone some time finding and fixing
>> bugs with the JS libraries <-> Scheme integration and end up with a
>> result that could be re-used on implementations' own websites as well.
>>
>
> What about if you create repo try.scheme.org in scheme org, and add me
> to the org maybe you can add Marc as well and we will be able to work on the
> page if Marc agree.
>
> Marc can start the project with base emscripten of Gambit, but it need have
> the source code. The gambit itself don't need to be included, but it need to
> have all makefiles and scripts that build this so it can be build by anyone.
> And the code should be Open Source (Free Open license).
I’ve added some files to the try.scheme.org github repo to show how a barebones Scheme interpreter webapp can be created using Gambit. It is a makefile and a 45 line Scheme source file.
The interpreter is only “barebones” in its UI. It currently runs a REPL using the JavaScript “prompt” function that allows showing the last few lines of output and allowing the next line of input to be entered. Very minimal but often good enough to start developing webapps.
The I/O for the interpreter’s console can be redirected elsewhere by redefining the JavaScript functions g_console_input_add and g_console_output_add. I’m confident an interface to JQueryTerminal would be easy to achieve with minimal work. For Gambit-in-the-browser I had used Terminus (https://github.com/breuleux/terminus) another JavaScript terminal emulator,with lots of interesting features by the way. I expect JQueryTerminal to be similarly easy to interface to.
File I/O would have to be improved to support editing files in the browser. Currently open-input-file will use AJAX to read files from the web server, which is useful for accessing libraries and other resources.
Marc