Hello Winston,
Hi Gambit List—
I'm searching for a way to write Lisp and have it run on a web browser as WASM, i.e. avoiding JS. I was hoping Gambit Scheme might be the key, by compiling Lisp —> (Gambit compiler) —> C —> (Clang) —> wasm. But I'm encountering problems. My current issue is the 'gambit.h' file checks for lots of things including `setjmp` which doesn't exist in WASM. Below is my test situation. Does anybody think this endeavor of compiling Gambit -> wasm can work? Or are there any other ways to write Lisp and execute it as Wasm?
Gambit has a JavaScript target, here is a wirlwind tour:
;# cat `which gambit2js` #!/bin/sh podman run -v $(pwd):/mnt --rm -it docker.io/schemers/gambit:head gsc -:r7rs -target js -exe /mnt/$1 tail -n +2 $(basename $1 .scm) > "$(basename $1 .scm).js" rm -f $(basename $1 .scm)
;# echo '(display "hello from gambit js\n")' > main.scm
;# gambit2js main.scm && nodejs main.js hello from gambit js
;#
You can replace podman with docker.
I did prototypes with biwascheme, spock, schism, chibi, and gambit. The easiest to get started is biwascheme. The most promising is Gambit.
By the way, even if you target web assembly or host gambit compiler, and interpreter in wasm, you still need to write some javascript to interop with the browser.