feeley
Joined 12 years ago
Joined 12 years ago
Author: do you see issues with that use case?
The Gambit Scheme REPL that comes with a tutorial, supports threads in the browser and has a JS FFI: https://try.gambitscheme.org
Gambit in emacs in the browser: https://feeley.github.io/gambit-in-emacs-in-the-browser/
https://app.codeboot.org/5.3.1/?init=.fbWF0aF9wcmFjdGljZS5we...
For more complex UIs, CodeBoot provides an FFI for accessing the DOM directly from Python code. For example here is a dice throwing app with a button to roll the dice again. The text in the button has translations to multiple languages and will adjust to the browser's default.
https://app.codeboot.org/5.3.1/?init=.fZGljZS5weQ==~XQAAgADq...
https://try.gambitscheme.org is a playground for the Scheme language (specifically Gambit Scheme). It has a REPL and a code editor that saves files in the browser local storage. It also has a tutorial for learning the basics of Scheme.
https://codeboot.org is a playground for Python (there's an old version that supports JavaScript and we may resurrect it at some point). It was specifically designed as a simple IDE to teach programming to beginners and is in use at the Université de Montréal. Aside from the simple and intuitive UI, it has two important features for teaching:
1) Fine granularity single-stepping of Python code to help teach students how the computer goes about executing the code. It displays a bubble containing the variables in scope and their values.
2) It can bundle programs and the current state of execution in a URL that can be embedded in documents (HTML, PDF, PowerPoint, Keynote, etc) so that coding examples can be executed by the students in a single click. It also allows students to create simple web apps that require no installation and can easily be shared with others (because the URL contains all the relevant code of the app). You will find examples of this feature on the following pages:
https://codeboot-org.github.io/presentations/
https://codeboot-org.github.io/cegep/ (in french, but just click on the images)
- REPL history with up/down arrows (explained on the landing page's README)
- You can use the "help" procedure to browse the full documentation
- TAB key for autocompletion
- In addition to the REPL there is a code editor to edit programs stored in the browser
- The system supports multiple threads, one REPL per thread
- There is a builtin tutorial to learn the basics of Scheme with examples executable in the REPL with a single click on a "run" button
- The REPL supports single stepping the execution of code
- Easy interface to JS with the SIX syntax extension, e.g. (let ((msg "hello")) \console.log(`msg, 1+2/3))
- The error messages are clear and precise giving the file and line number and highlighting in yellow the piece of code (in the REPL or file) that raised the exception. Just try this in both systems to see the difference:
> (define (f x) (/ 1 (* x x)))
> (f 5)
> (f "hello") ;; the * procedure will raise an exception and highlight "(* x x)"What I'd love to do someday is to write a compiler for a fairly complete C subset in POSIX shell. The goal would be to use only a POSIX shell and this compiler to compile TCC, and then use TCC to bootstrap gcc, all from source. This would be a great tool for reproducible builds from source. If someone here finds this interesting and would like to help out, please reach out to me.
$ cat hello.scm
(display "hello!\n")
$ gsc hello.scm
$ gsi hello.o1
hello!
$ ls -l hello.o1 # this is generated by gcc
-rwxrwxr-x 1 feeley feeley 18152 Mar 13 17:16 hello.o1
$ rm hello.o1
$ gsc -cc "tcc -shared" hello.scm
$ gsi hello.o1
hello!
$ ls -l hello.o1 # this is generated by tcc
-rwxrwxr-x 1 feeley feeley 4432 Mar 13 17:17 hello.o1