You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .cursor/skills/adding-ion-features/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,7 @@ New builtins (channels, Vec, String, spawn) often need C runtime helpers. Keep h
111
111
112
112
## Debugging a failing stage
113
113
114
-
**Stale binaries:** Rebuild `target/release/ion-compiler` (and `ion-build` when touching build code) after cgen or tc changes before `test_runner.sh` or regenerating `examples/*.c`. The harness defaults to `../target/release/ion-compiler`. Agent shells may set `CARGO_TARGET_DIR` outside the repo; pin it to the repo `target/` when verifying locally, or override with `COMPILER=` / `ION_BUILD=` and confirm the binary mtime.
114
+
**Stale binaries:** Rebuild `target/release/ion-compiler` (and `ion-build` when touching build code) after cgen or tc changes before `test_runner.sh` or rebuilding examples.
Copy file name to clipboardExpand all lines: .cursor/skills/ion-integration-tests/SKILL.md
+2-12Lines changed: 2 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,19 +15,9 @@ paths:
15
15
16
16
End-to-end tests: Ion → C → gcc → run executable → assert exit code (or assert compile failure).
17
17
18
-
The harness runs tests under `tests/` only. Files in `examples/` are documented demos; build and run them with `ion-build`and per-example manifests (see [README.md](../../../README.md#example-programs)). Regenerate committed `examples/*.c` snapshots with `ion-compiler` after codegen changes.
18
+
The harness runs tests under `tests/` only. Files in `examples/` are documented demos; build and run them with `ion-build`from each example directory (see [README.md](../../../README.md#example-programs)).
19
19
20
-
**Example output policy:** Top-level single-file examples commit one merged `.c` next to the `.ion`. `text_summary/` commits one `.c` plus `sample.txt`. `data_lib/` and `todo_demo/` keep `.ion` and `ion.toml` only (see each directory's `README.md`).
21
-
22
-
After compiler codegen changes, regenerate committed example `.c` files:
Multi-file `examples/data_lib/` has no committed `.c`; see `examples/data_lib/README.md`. `examples/todo_demo/` is the same; see `examples/todo_demo/README.md`.
20
+
**Example output policy:** Each demo is `examples/<name>/` with `ion.toml`. Generated `.c` and executables go under that directory's `target/` (not committed). `text_summary/` also ships `sample.txt`.
31
21
32
22
To build examples, use `ion-build` (see README). Manual `gcc` + `runtime/ion_runtime.c` is for the test harness and advanced debugging only.
Copy file name to clipboardExpand all lines: .cursor/skills/ion-lang/SKILL.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -102,7 +102,7 @@ Read these when the task matches:
102
102
1.**Spec first** - If semantics change, update `ION_SPEC.md` before or alongside code.
103
103
2.**Minimal diff** - Match existing patterns in the module you're editing; don't refactor adjacent code.
104
104
3.**Test both paths** - Positive compile+run tests and negative compile-error tests where applicable.
105
-
4.**Rebuild release** - Integration harness defaults to `target/release/ion-compiler`. After codegen changes, rebuild before `test_runner.sh` or regenerating `examples/*.c`. Confirm the binary timestamp matches your build; a stale `target/release/ion-compiler` can pass an old harness run or fail on new tests. Cursor agent shells may set `CARGO_TARGET_DIR` outside the repo; point `COMPILER=` at the binary you just built, or unset `CARGO_TARGET_DIR` and rebuild into `target/release/`.
105
+
4.**Rebuild release** - Integration harness defaults to `target/release/ion-compiler`. After codegen changes, rebuild before `test_runner.sh` or rebuilding examples.
Copy file name to clipboardExpand all lines: .cursor/skills/writing-ion-code/references/verified-patterns.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ Manual codegen only (emits `.c`/`.h` in cwd):
130
130
./target/release/ion-compiler --mode multi --output app path/to/main.ion
131
131
```
132
132
133
-
Multi-file mode prefixes each module's C symbols (`io_print_int`, `fmt_print_int`) so stdlib modules can link together. The compiler walks up from the current directory to find `runtime/`. Spawn captures move by value even for `int`; use a helper function if the same constant is needed after `spawn` (see `examples/channel_worker.ion`).
133
+
Multi-file mode prefixes each module's C symbols (`io_print_int`, `fmt_print_int`) so stdlib modules can link together. The compiler walks up from the current directory to find `runtime/`. Spawn captures move by value even for `int`; use a helper function if the same constant is needed after `spawn` (see `examples/channel_worker/channel_worker.ion`).
Copy file name to clipboardExpand all lines: CHANGELOG.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,8 @@
10
10
-**Tooling**: GitHub Actions CI (Linux and Windows), pinned toolchain (1.96.0), `test_expectations.tsv` manifest, `--version`, line-numbered errors, Cursor agent skills. Split `tc` and `cgen` into submodules. `ion-build` driver and `ion.toml` manifests (`single`/`multi`, `out_dir`, `cflags`, `ldflags`, `stdlib_paths`, `emit_in_source`); per-example manifests and `build_hello`/`build_bad_main` harness smoke tests. Shared `discover_import_config` and stdlib search paths for `ion-compiler`, `ion-build`, and LSP. Integration harness precompiles `runtime/ion_runtime.c` once per run (`RUNTIME_OBJ`). `writing-ion-code` agent skill; `creating-ion-skills` examples index lists all eight project skills. Documented checked-in `examples/*.c` codegen snapshots in README and integration-test skill; regenerated example C output. Fixed `researching-pl-literature` skill `paper-seeds` reference formatting.
11
11
-**Docs**: README, CONTRIBUTING, ION_SPEC, and agent skills aligned on project layout, `ion-build` workflow, `emit_in_source`, stdlib import order, LSP features and limitations, `src/build/` checklists, portable Git Bash paths for `test_runner.sh`, and rebuilding release binaries before harness or example C regen (stale `target/release/ion-compiler` note).
12
12
- **Fixes**: match rvalue codegen, `Vec` struct drops, channel codegen, parser handling of `alias::call()`, scope-drop for moved-into-call bindings, HTTP server on Windows, integration harness on Windows. Cgen return-unwind: stop marking bindings dropped after inner-branch `return` (restores outer-path drops), dedupe `_`-prefixed unused silences, mark call arguments moved at emission to avoid double-free on unwind, and unify all function returns via `emit_function_return` (including diverging rvalue `match` arms). Cgen struct field move-out neutralizes owned fields after partial move, deferred to statement end when the move is a call argument; `Vec::push` passes address of struct lvalues; non-generic enums emit before structs; tuple IR uses resolved element types and `tuple_Vec_T` mangling with compound-zero `ret_val` for tuple returns (functions and fn literals). Integer indexing and `Vec<i32>` inference in the type checker. Match rvalue arms: reject diverging arms mixed with value arms; structural control-flow analysis for arm bodies (nested `if`/`else`, `loop` without `break`, `unsafe` blocks); reject mixed diverge and value-producing paths within one arm; cgen assigns through `if`/`else` value branches. `fmt::int_to_string` uses `String::push_byte` per digit instead of per-digit `push_str` branches; integration test asserts `0`, negatives, and `int::MIN`. `int::MIN`/`int::MAX` on integer primitives; `Vec::new()`/`with_capacity()` infer `T` from a `let` type annotation. Clippy fix in `portable_source_label`. `Vec::get`/`Vec::pop`: IR infers `Option<T>` from the vector argument; cgen dereferences `&mut Vec<T>` parameters, unpacks runtime `Option` via `ion_option_from_raw`, and uses a temp for struct-returning `Vec::push`/`Vec::set` call values. Grouped `match` switch arms: scope drops before the case `break` (GCC `-Wimplicit-fallthrough` under `-Werror`); guarded arms in a shared variant case break inside the guard `if` so fallback arms do not run.
13
-
-**Examples**: `text_summary` (fixture file), `data_lib` (multi-module), `channel_worker` (flat single-file), `todo_demo` (interactive stdin, `Vec` of structs with `String`). Per-example `*.toml` manifests for `ion-build`. `http_server` accepts one client then exits (verifiable demo).
14
-
-**Multi-file fixes**: merge private struct types for cross-module type checking; per-module C symbol prefixes in multi-file codegen (`io_print_int`); walk-up `runtime/` discovery for nested build directories. Integration tests `test_multi_struct`, `test_multi_fmt_io`. Example policy: single-file examples commit `.c` snapshots; `data_lib` multi-file keeps `.ion` only.
13
+
-**Examples**: `text_summary` (fixture file), `data_lib` (multi-module), `channel_worker` (flat single-file), `todo_demo` (interactive stdin, `Vec` of structs with `String`). Per-example `*.toml` manifests for `ion-build`. `http_server` accepts clients until stdin `quit`.
14
+
-**Multi-file fixes**: merge private struct types for cross-module type checking; per-module C symbol prefixes in multi-file codegen (`io_print_int`); walk-up `runtime/` discovery for nested build directories. Integration tests `test_multi_struct`, `test_multi_fmt_io`. Example policy: each demo under `examples/<name>/` with `ion.toml`; build output under `target/` only (no committed `.c`).
After compiler codegen changes, rebuild before `tests/test_runner.sh` or regenerating committed `examples/*.c`. A stale `target/release/ion-compiler` can produce misleading harness results.
15
+
After compiler codegen changes, rebuild before `tests/test_runner.sh` or rebuilding examples. A stale `target/release/ion-compiler` can produce misleading harness results.
Manifest discovery walks upward from the current directory for a file named `ion.toml`. To use another filename (for example `examples/http_server.toml`), pass `--manifest <path>`; the manifest's parent directory is the project root and `main` paths are relative to that directory.
1199
+
Manifest discovery walks upward from the current directory for a file named `ion.toml`. Pass `--manifest <path>` when cwd is not the example directory; the manifest's parent directory is the project root and `main` paths are relative to that directory.
1200
1200
1201
1201
`ion-compiler` remains available for codegen inspection, LSP internals, and integration tests that grep `.c` output. It does not require `ion.toml`.
`ion build` transpiles, compiles generated C, links the runtime, and writes the executable under `target/` by default.
120
120
121
-
Source: [examples/hello_world_safe.ion](examples/hello_world_safe.ion). For a minimal FFI example without stdlib, see [examples/hello_world.ion](examples/hello_world.ion).
121
+
Source: [examples/hello_world_safe/hello_world_safe.ion](examples/hello_world_safe/hello_world_safe.ion). For a minimal FFI example without stdlib, see [examples/hello_world/hello_world.ion](examples/hello_world/hello_world.ion).
122
122
123
123
### Advanced: Manual Transpile and Link
124
124
125
125
For codegen inspection, integration test workflows, or debugging generated C, use `ion-compiler` directly (see [ION_SPEC.md section 10.1](ION_SPEC.md#101-project-build-ion-build)):
@@ -137,15 +137,15 @@ The integration harness (`tests/test_runner.sh`) calls `ion-compiler` and `gcc`
137
137
138
138
`ion-build` discovers `ion.toml` by walking up from the current directory. Required fields: `name`, `main`, `output`. Common optional fields: `mode` (`single` or `multi`), `out_dir` (default `target`), `cflags`, `ldflags`, `stdlib_paths`, `emit_in_source`.
139
139
140
-
Root [ion.toml](ion.toml) builds [examples/hello_world_safe.ion](examples/hello_world_safe.ion). Per-example manifests live under [examples/](examples/)(for example `spawn_channel.toml`, `http_server.toml`, `examples/data_lib/ion.toml`). Use `--manifest path` when the file is not named `ion.toml`:
140
+
Root [ion.toml](ion.toml) builds [examples/hello_world_safe/hello_world_safe.ion](examples/hello_world_safe/hello_world_safe.ion). Each example lives in its own directory under [examples/](examples/)with an `ion.toml` manifest. Use `--manifest path` when cwd is not the example directory:
FFI programs that rename C symbols (for example `recv_sys`) set compile-time `-D` flags in `cflags`, not `ldflags`. See [examples/http_server.toml](examples/http_server.toml).
148
+
FFI programs that rename C symbols (for example `recv_sys`) set compile-time `-D` flags in `cflags`, not `ldflags`. See [examples/http_server/ion.toml](examples/http_server/ion.toml).
149
149
150
150
### Multi-file projects
151
151
@@ -161,53 +161,31 @@ For manual multi-file codegen in the source directory (no `ion-build`), use `ion
161
161
162
162
## Example Programs
163
163
164
-
Top-level `examples/*.ion` files each have a checked-in merged `examples/*.c` codegen snapshot. Regenerate after compiler codegen changes (from repo root, relative paths keep portable banners):
Committed `.c` snapshots are for review and `ion-compiler` regression; building and running examples uses `ion-build` and the manifests below.
164
+
Each example is a subdirectory of [examples/](examples/) with `ion.toml`. Build with `ion-build` from that directory; generated C and executables go under `target/` (not committed).
172
165
173
-
**Build and run** (from `examples/` unless noted):
166
+
**Build and run:**
174
167
175
168
```powershell
176
-
# Single-file example with a manifest in examples/
|[examples/todo_demo/todo_demo.ion](examples/todo_demo/todo_demo.ion)|[todo_demo/ion.toml](examples/todo_demo/ion.toml)| Interactive todo list: `Vec` of structs with `String`, stdin via FFI `read`; see [todo_demo/README.md](examples/todo_demo/README.md)|
208
-
|[examples/data_lib/main.ion](examples/data_lib/main.ion)|[data_lib/ion.toml](examples/data_lib/ion.toml)| Multi-module library; see [data_lib/README.md](examples/data_lib/README.md)|
209
-
210
-
`examples/data_lib/` and `examples/todo_demo/` keep `.ion` sources and manifests only; `ion-build` writes under each project's `target/` (not committed).
176
+
| Directory | What it demonstrates |
177
+
|-----------|---------------------|
178
+
|[hello_world/](examples/hello_world/)| Minimal FFI `write()` to stdout (no stdlib) |
179
+
|[hello_world_safe/](examples/hello_world_safe/)| stdlib `io` module; also built by root [ion.toml](ion.toml)|
180
+
|[minimal/](examples/minimal/)| Smallest valid program |
181
+
|[spawn_channel/](examples/spawn_channel/)|`spawn` with cross-thread channels |
|[http_server/](examples/http_server/)| Sockets FFI, spawn per client, stdin `quit` to stop; see [http_server/README.md](examples/http_server/README.md)|
0 commit comments