AtlatestRepositorysigil-web-repl
sigil-web-repl / treeREADME.md
1
# sigil-web-repl3
A web-based REPL for trying [Sigil](https://codeberg.org/sigil/sigil) in the browser. Uses `sigil-wasm-runtime` as the WebAssembly runtime and delimited continuations for interactive input/output between JavaScript and Sigil.5
## How it works7
The REPL runs Sigil compiled to WebAssembly via Emscripten. It uses delimited continuations (prompts) to yield control back to JavaScript when waiting for user input:9
1. `repl-start` begins the REPL and yields waiting for input10
2. JavaScript collects input from the user11
3. JavaScript calls back into WASM with `web-input-resume`12
4. The saved continuation is invoked with the input13
5. The REPL evaluates the expression and yields again for the next input15
## Requirements17
Building this package requires [Emscripten](https://emscripten.org/) and the `sigil-wasm-runtime` C runtime. This is not a standard Sigil package build; it produces `.js` and `.wasm` output files for browser deployment.19
## Dependencies21
- `sigil-wasm-runtime` - WebAssembly C runtime (from sigil monorepo)22
- `sigil-stdlib` - Standard library23
- `sigil-repl` - REPL commands24
- `sigil-ansi` - Terminal color codes26
## Building28
Building requires the Emscripten SDK. On Guix systems, use the included helper script to set up an FHS container with emsdk:30
```bash31
# Enter an Emscripten shell (installs emsdk on first run, ~400MB)32
./scripts/emsdk-shell34
# Install dependencies and build inside the shell35
sigil deps install36
sigil build37
```39
Or run the build directly:41
```bash42
./scripts/emsdk-shell sigil deps install && ./scripts/emsdk-shell sigil build43
```45
This compiles the Sigil modules, links them into a web application (`sigil-web-repl.js` and `sigil-web-repl.wasm`), and copies the HTML assets to the output directory.47
## Usage49
Add as a dependency in your `package.sgl`:51
```scheme52
(from-git url: "codeberg:sigil/sigil-web-repl")53
```55
## License57
BSD-3-Clause