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/ion-integration-tests/SKILL.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ 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 - compile and run them manually (see [README.md](../../../README.md)); they are not in the integration manifest.
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.
19
19
20
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`. Multi-file `data_lib/` keeps `.ion` only (see `examples/data_lib/README.md`).
21
21
@@ -29,7 +29,7 @@ for f in examples/*.ion; do ./target/release/ion-compiler "$f"; done
29
29
30
30
Multi-file `examples/data_lib/` has no committed `.c`; see `examples/data_lib/README.md`.
31
31
32
-
Link and run like integration tests (`gcc` + `runtime/ion_runtime.c`+ `-lpthread`; on Windows MinGW add `-lws2_32`).
32
+
To build examples, use `ion-build` (see README). Manual `gcc` + `runtime/ion_runtime.c`is for the test harness and advanced debugging only.
**Harness link step:** On startup, `test_runner.sh` precompiles `runtime/ion_runtime.c` once to `RUNTIME_OBJ` (default `.ion_test_runtime.o`) and links that object for each `run` test and `test_multifile`. Same `gcc` flags as before; manual example compiles below still use `ion_runtime.c` directly.
59
+
**Harness link step:** On startup, `test_runner.sh` precompiles `runtime/ion_runtime.c` once to `RUNTIME_OBJ` (default `.ion_test_runtime.o`) and links that object for each `run` test and `test_multifile`. This path uses `ion-compiler` and `gcc` directly, not `ion-build`. Example programs under `examples/`use `ion-build` per README.
60
60
61
61
**Windows:** Use Git Bash, not WSL. Rebuild release after compiler changes. Stop `ion-lsp` if build fails with "Access is denied".
Copy file name to clipboardExpand all lines: .cursor/skills/writing-ion-code/SKILL.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,7 +56,7 @@ fn main() -> int {
56
56
}
57
57
```
58
58
59
-
Import paths are string literals relative to the compiling file. Use `pub fn` in library modules; call with `alias::name(...)`.
59
+
Import paths like `import "stdlib/io.ion" as io;` resolve via stdlib search paths (`ion.toml`, `ION_STDLIB`, project `stdlib/`). Same-directory and `../` relative paths still work. Use `pub fn` in library modules; call with `alias::name(...)`.
60
60
61
61
## Core syntax (verified)
62
62
@@ -123,7 +123,7 @@ Fn literals lower to static C functions and must not reference outer bindings (o
123
123
124
124
## Documentation comments
125
125
126
-
Ion uses plain `//` line comments only — no `///` or `//!`. Contiguous `//` lines **immediately above** a declaration (no blank line before the declaration) are attached as documentation for IDE hover; the same rule applies when `pub` precedes the item. A blank line breaks association. File-level overview comments go at the top of the file before imports. Section-divider comment blocks in examples should be separated from declarations by a blank line. See ION_SPEC §12.6.
126
+
Ion uses plain `//` line comments only. No `///` or `//!`. Contiguous `//` lines **immediately above** a declaration (no blank line before the declaration) are attached as documentation for IDE hover; the same rule applies when `pub` precedes the item. A blank line breaks association. File-level overview comments go at the top of the file before imports. Section-divider comment blocks in examples should be separated from declarations by a blank line. See ION_SPEC section 12.6.
For a single file without a manifest, use `ion-compiler` plus manual `gcc` (see `ion-lang` skill). On Windows add `-lws2_32` for channel/spawn programs. Stop `ion-lsp` if rebuild fails with "Access is denied".
157
+
Multi-file: `cd examples\data_lib` then `..\..\target\release\ion-build.exe build`. See [examples/data_lib/README.md](../../../examples/data_lib/README.md).
158
+
159
+
For codegen inspection or `tests/` integration harness work, use `ion-compiler` plus manual `gcc` (see `ion-lang` skill). On Windows add `-lws2_32` for channel/spawn when linking manually. Stop `ion-lsp` if rebuild fails with "Access is denied".
157
160
158
161
For programs under `tests/`, follow the `ion-integration-tests` skill (`test_expectations.tsv` row required).
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.
1198
+
1197
1199
`ion-compiler` remains available for codegen inspection, LSP internals, and integration tests that grep `.c` output. It does not require `ion.toml`.
1198
1200
1199
1201
**`ion.toml` fields (tooling, not language semantics):**
Copy file name to clipboardExpand all lines: README.md
+47-76Lines changed: 47 additions & 76 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -114,7 +114,7 @@ Source: [examples/hello_world_safe.ion](examples/hello_world_safe.ion). For a mi
114
114
115
115
### Advanced: Manual Transpile and Link
116
116
117
-
For codegen inspectionor debugging, use `ion-compiler` directly:
117
+
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)):
`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`.
143
131
144
-
**Required flags:**
145
-
-`input.c` - generated C file
146
-
-`runtime/ion_runtime.c` - Ion runtime (when running from project root)
147
-
-`-I. -I.. -Iruntime -I../runtime` - include paths for runtime headers
148
-
-`-lpthread` - pthread library (required for channels and spawn)
149
-
-`-o input` - output executable name
132
+
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`:
If your Ion program uses FFI names that conflict with Ion keywords (`recv`, `send`), add `-D` flags when linking:
140
+
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).
On Linux or macOS, omit `-lws2_32` and `-Dclose=closesocket`. `ion_net_init()` is a no-op outside Windows.
144
+
Multi-file mode (`mode = "multi"` in `ion.toml`) transpiles each module to `.c`/`.h`, compiles objects, and links one executable. Artifacts default to `out_dir` (usually `target/`), not the source tree.
168
145
169
-
### Multi-File Mode
170
-
171
-
```bash
172
-
./target/release/ion-compiler --mode multi --output myprogram main.ion
146
+
```powershell
147
+
cd examples\data_lib
148
+
..\..\target\release\ion-build.exe build
149
+
.\target\data_lib.exe
173
150
```
174
151
175
-
This parses imported modules, generates `.c` and `.h` per module, compiles object files, and links with the runtime. The `--output` flag sets the executable name (defaults to the main module name). Multi-file mode handles compilation and linking; you do not need to run `gcc` manually.
152
+
For manual multi-file codegen in the source directory (no `ion-build`), use `ion-compiler --mode multi --output NAME main.ion`. See [examples/data_lib/README.md](examples/data_lib/README.md).
176
153
177
154
## Example Programs
178
155
179
-
Top-level `examples/*.ion` files each have a checked-in merged `examples/*.c` codegen snapshot. Regenerate after compiler codegen changes:
156
+
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):
Top-level single-file examples (including `channel_worker.ion`) commit a merged `.c` snapshot next to the `.ion`. The `text_summary/` subdirectory also commits one `.c` (it needs `sample.txt`). Multi-file `examples/data_lib/` keeps only `.ion` sources; see [examples/data_lib/README.md](examples/data_lib/README.md) for build output (`.c`/`.h` generated in place, not committed).
|[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)|
195
+
196
+
`examples/data_lib/` keeps only `.ion` sources; `ion-build` writes `.c`, `.h`, and the executable under `examples/data_lib/target/` (not committed).
0 commit comments