Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/T-Brick/lean2wasm
Tool for compiling Lean to WASM
https://github.com/T-Brick/lean2wasm
lean lean4 wasm
Last synced: 23 days ago
JSON representation
Tool for compiling Lean to WASM
- Host: GitHub
- URL: https://github.com/T-Brick/lean2wasm
- Owner: T-Brick
- License: mit
- Created: 2023-12-12T22:03:48.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-17T22:16:26.000Z (9 months ago)
- Last Synced: 2024-08-10T14:11:57.484Z (4 months ago)
- Topics: lean, lean4, wasm
- Language: Lean
- Homepage:
- Size: 12.7 KB
- Stars: 12
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lean2Wasm
Tool to compile Lean4 code to WASM. Right now this is really just for me to test
things out. So actually using it is a little scuffed right now :)This is largely a translation of [these instructions](https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/wasm.20build/near/402692669)
into something that can be executed.This requires [emcc](https://emscripten.org/docs/getting_started/downloads.html)
to already be installed.## Usage
Run `lake build test` to build the test program. Then run `lake build` to build
the utility. Running `lake exe lean2wasm` will compile the `Main` program.Once compiled, you can run `node .lake/build/wasm/main.js` to run the program.
Alternatively you can use `lake run js`.If you want to change what is being compiled, in `Lean2Wasm.lean` just change
the `root` variable.## Example
[Here](https://github.com/T-Brick/c0_web_driver) is an example of embedding lean
into a webpage. Importantly, we have to use the `MODULARIZE` flag so that we
can invoke the `main` function multiple times since there are issues with doing
so without resetting the emscripten runtime (specifically, emscripten generates
a factory function which can then be invoked to initialise the runtime again
and call `main`).