Chibi Scheme and Spock both run in the browser.  You can build Chibi Scheme with a WASM target; Spock is written in JavaScript.

On Sat, Mar 18, 2023 at 3:15 PM Winston W <winston@nitidbit.com> wrote:
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?

---

```
;; fib.scm
(define (square x)
  (expt x 2))
```

```
% gsc -c fib
```

produces a fib.c file. Then:

```
% clang --target=wasm32 -O1 -Wno-deprecated-declarations -Wno-unused -Wno-write-strings -Wdisabled-optimization -fwrapv -fno-strict-aliasing -fno-math-errno -fomit-frame-pointer -fPIC -fno-common -D___SINGLE_HOST -D___DONT_HAVE_MATH_H -D___DONT_HAVE_SETJMP_H -D___DONT_HAVE_SIGNAL_H -D___DONT_HAVE_WCHAR_H -I"/opt/homebrew/Cellar/gambit-scheme/4.9.3_2/v4.9.3/include"  fib.c
```

Gives this error:
```
In file included from fib.c:36:
/opt/homebrew/Cellar/gambit-scheme/4.9.3_2/v4.9.3/include/gambit.h:8012:5: error: unknown type name 'jmp_buf'
    jmp_buf buf;
    ^
1 error generated.
make: *** [fib.o] Error 1
```
_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://mailman.iro.umontreal.ca/cgi-bin/mailman/listinfo/gambit-list