···11+# hello_wasm
22+33+A tiny Gleam program that compiles to WebAssembly and runs under
44+[wasmtime](https://wasmtime.dev/) via WASI.
55+66+The compiler emits a `_start` entry that calls `main` and prints its return
77+value to stdout (`wasi_snapshot_preview1::fd_write`).
88+99+## Run
1010+1111+From this directory (builds the in-repo `gleam` first):
1212+1313+```sh
1414+./run.sh
1515+```
1616+1717+Or step by step:
1818+1919+```sh
2020+# from repo root
2121+cargo build -p gleam
2222+2323+# from this directory
2424+../../target/debug/gleam build
2525+wasmtime build/dev/wasm/hello_wasm/hello_wasm.wasm
2626+```
2727+2828+Expected output:
2929+3030+```text
3131+Hello from Gleam Wasm!
3232+fib(10) = 55
3333+```
3434+3535+You can also call individual exports:
3636+3737+```sh
3838+wasmtime --invoke fib build/dev/wasm/hello_wasm/hello_wasm.wasm 10
3939+# => 55
4040+```
4141+4242+## Notes
4343+4444+- Target is set in `gleam.toml`: `target = "wasm"`.
4545+- `main` must take no arguments. Supported return types for printing: `String`,
4646+ `Int`, and `Bool`.
4747+- No Hex packages yet — the Wasm backend does not implement enough of the
4848+ standard library for typical dependencies.