plum

#treesitter#compiler#wasm

git clone https://git.pyrossh.dev/plum

A statically typed, imperative programming language inspired by rust, python


ef56ea3 — Peter John 2026-11-10T23:12:54+05:30
docs/tools.md: PLUM_NO_WASM_OPT, build -o for an executable, the filter and timeout changes, test-all's grammar step
Files changed (1) hide show
  1. docs/tools.md +8 -7
docs/tools.md CHANGED
@@ -26,22 +26,22 @@
26
26
  | `--no-watch` | Don't rebuild and reload when files change |
27
27
  | `--replay FILE` | Replay a recorded run headless, with no browser, and print the draw calls of its last frame (see [Record and replay](game.md#record-and-replay)) |
28
28
 
29
- **Options for `plum build` on a game:**
29
+ **Options for `plum build`:**
30
30
 
31
31
  | Option | What it does |
32
32
  |---|---|
33
- | `-o DIR` | Write the site to `DIR` (default `dist`) |
33
+ | `-o DIR` | A game: write the site to `DIR` (default `dist`). Otherwise: write the executable to this path (default: the file's name without `.plum`, in the current folder) |
34
- | `--assets DIR` | Load assets from `DIR` |
34
+ | `--assets DIR` | A game: load assets from `DIR` |
35
35
 
36
36
  **Options for `plum test`:**
37
37
 
38
38
  | Option | What it does |
39
39
  |---|---|
40
- | `--filter TEXT` | Run only the tests whose name contains `TEXT` |
40
+ | `--filter TEXT` | Run only the tests whose name contains `TEXT` (it fails when no test does) |
41
41
  | `--watch` | Run the tests again whenever a tested file, or a file it imports, changes |
42
- | `--timeout SECONDS` | Fail a test that runs longer, as `TIMEOUT` (default 60, or `PLUM_TEST_TIMEOUT`; 0 means no limit). The other tests in the file still run |
42
+ | `--timeout SECONDS` | Fail a test that runs longer, as `TIMEOUT` (default 120, or `PLUM_TEST_TIMEOUT`; 0 means no limit). The other tests in the file still run |
43
43
 
44
- Folders are tested one file per process, as many at once as there are cores (`PLUM_TEST_JOBS` sets the number), slowest first: how long each file took is kept in `$TMPDIR/plum-test-durations.txt`.
44
+ Folders are tested one file per process, as many at once as there are cores (`PLUM_TEST_JOBS` sets the number), slowest first: how long each file took is kept in `$TMPDIR/plum-test-durations.txt`, which every checkout shares (each reads only its own files' times).
45
45
 
46
46
  **Options for looking at the compiler's work** (`run`, `build`, `test`, `compile`):
47
47
 
@@ -59,6 +59,7 @@ Folders are tested one file per process, as many at once as there are cores (`PL
59
59
  | `PLUM_TEST_TIMEOUT=SECONDS` | The default of `plum test --timeout` |
60
60
  | `PLUM_DUMP_WASM=out.wasm` | `plum test`: also write the compiled test module to `out.wasm` |
61
61
  | `PLUM_TIMINGS=1` | Print how long each compiler pass takes |
62
+ | `PLUM_NO_WASM_OPT=1` | Skip the passes over the finished wasm (dropping redundant casts, inlining small functions, removing unreachable ones), to compare a program with and without them. Set to any value, it turns them off |
62
63
 
63
64
  A program that crashes prints one line, such as `crash: division by zero in div (called from main)`, or the message and place of a `crash`.
64
65
 
@@ -74,7 +75,7 @@ You need a recent stable Rust toolchain and a C compiler.
74
75
  cargo install --path compiler/cli
75
76
  ```
76
77
 
77
- This installs `plum` to `~/.cargo/bin`. Run it again after pulling changes. While working on the compiler, use `cargo run -p plum-cli --` instead, and run `compiler/scripts/test-all.sh` before a commit: it builds, runs every Rust test and then `plum test std examples tests` in the default, `--no-fbip` and `--no-fusion` modes, and ends with `ALL PASSED` or `FAILED: <n>`.
78
+ This installs `plum` to `~/.cargo/bin`. Run it again after pulling changes. While working on the compiler, use `cargo run -p plum-cli --` instead, and run `compiler/scripts/test-all.sh` before a commit: it builds, runs every Rust test, `plum test std examples tests` in the default, `--no-fbip` and `--no-fusion` modes, and the grammar's corpus when the `tree-sitter` CLI is installed, and ends with `ALL PASSED` (naming a step it skipped) or `FAILED: <n>`.
78
79
 
79
80
  `plum build` of a program that is not a game compiles the `compiler/runtime` crate with cargo, so it needs this source tree and cargo on `PATH`.
80
81