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
@@ -14,122 +14,11 @@ If you need detailed specification, read the `docs/spec.md`.
14
14
15
15
The compiler is implemented in `wado-compiler/`.
16
16
17
-
Standard libraries (stdlib) are implemented in `wado-compiler/lib`, with `wasi/` for WASI interface and `core/` for the core library.
18
-
19
-
For other important files:
20
-
21
-
-`wado-compiler/lib/core/builtin.wado` for compiler intrinsics.
22
-
-`wado-compiler/lib/core/internal.wado` for utilities to implement language features
23
-
24
17
See also:
25
18
26
19
-`docs/compiler.md` for the compiler internals.
27
20
-`docs/optimizer.md` for the optimization passes.
28
21
29
-
### Wasm Compatibility
30
-
31
-
`wado-compiler` must compile for `wasm32-unknown-unknown`. Do not use OS-dependent `std` modules in production code. CI enforces this with a wasm32 build check.
32
-
33
-
### E2E Test Specification (Compiler Tests)
34
-
35
-
E2E tests verify language features and compiler behaviors (codegen, error messages, optimization). They are `.wado` files in `wado-compiler/tests/fixtures/` with a `__DATA__` section containing JSON test specification.
36
-
37
-
Each test fixture group has the same prefix in their filenames.
38
-
39
-
By default, only O0 and O2 run locally; O1/O3/Os require `WADO_FULL_TEST=1`.
40
-
41
-
#### Data Section Schema
42
-
43
-
The target world is indicated by the top-level key in the JSON object:
44
-
45
-
- No world key → `wasi:cli/command` (default)
46
-
-`"test": {}` → test world (runs test block exports)
47
-
-`"wasi:http/service": {...}` → HTTP service world
After adding new `.wado` files to `wado-compiler/tests/fixtures/`, you must touch `wado-compiler/tests/e2e.rs` to trigger `datatest_mini` to rediscover test files:
122
-
123
-
```sh
124
-
touch wado-compiler/tests/e2e.rs
125
-
```
126
-
127
-
Without this, `cargo test` will not detect the new fixture because `datatest_mini` discovers files at compile time.
128
-
129
-
### Standard Library Tests (Library Logic)
130
-
131
-
Tests for standard library logic live alongside implementations in `wado-compiler/lib/`. These are `.wado` files with `test` blocks (e.g., `zlib_test.wado`, `string_test.wado`) , run with `wado test`.
132
-
133
22
### The `wasi:*` Modules
134
23
135
24
`wasi:*` modules are part of the Wado standard library.
wado run --allocator debug file.wado # not yet wired, use compile + wasmtime
177
66
```
178
67
179
-
The debug allocator is **automatically selected** when compiling for tests.
68
+
The debug allocator is selected when compiling for the test world, and enabled in E2E tests as well.
180
69
181
70
### Serve Command
182
71
@@ -238,7 +127,7 @@ The compiler bundles Wasm modules for the language futures:
238
127
239
128
-`wado-bundled-libm/` - deterministic Math functions with `libm` crate
240
129
241
-
###Wasm and WASI
130
+
## Wasm and WASI
242
131
243
132
Wado is designed on the following Wasm features:
244
133
@@ -253,17 +142,22 @@ Wado is designed on the following Wasm features:
253
142
- P3 is supported by wasmtime v42
254
143
- See wasmtime P3 support: `find vendor/wasmtime/crates/wasi/src/p3/wit -name '*.wit'`
255
144
145
+
## Vendor submodules
146
+
147
+
There are reference repositories in `vendor/` for the specification of Wasm & Component Model, and also runtimes such as wasmtime.
148
+
149
+
To initialize: `git submodule update --init`
150
+
256
151
## General Rules
257
152
258
-
- Don't be anchored by existing implementations or conventions. Always design from first principles toward the optimal solution.
259
153
- All the documents and comments must be written in English.
260
-
- When referring to WAT, use folded style syntax.
261
-
- If you find a compiler bug or a limitation, fix it. Such a problem must be treated as the highest priority.
154
+
- If you find a compiler bug, fix it with the highest priority by TDD - a standalone minimum reproducible e2e fixture is required before fixing the bug.
262
155
- Use sub-agents only for research tasks (searching, reading, exploring). Never use sub-agents for editing files.
263
-
-`CLAUDE.md` is a symlink to `AGENTS.md`. Editing either one is sufficient.
156
+
-`CLAUDE.md` is a symlink to `AGENTS.md`.
264
157
265
158
## Rules for Rust
266
159
160
+
- Write correct code with correct design.
267
161
- Manage dependencies in the workspace `Cargo.toml`.
268
162
- Do not use `#![allow(deprecated)]`; use newer alternatives instead.
269
163
- Use `panic!` for things that are not yet implemented or not supported.
@@ -272,17 +166,11 @@ Wado is designed on the following Wasm features:
272
166
- Do not use any comment sections to separate or organize code.
273
167
- Follow TDD: write a failing test case first, then implement the concern.
274
168
275
-
### Rules for the Compiler Code Base
276
-
277
-
- The principle: `codegen.rs` emits the `Project` as is, which does not have the knowledge of the previous phases.
278
-
- Use utilities in `name.rs` to handle name mangling and monomorphization. Other components must not know the details of name formats.
279
-
- Minimize hard-coded logic for compiler builtins or WASI. Define builtin and internal functions in Wado source files in `lib/core/*.wado` or `lib/wasi/*.wado`.
280
-
281
169
## Wado Evolution Proposals (WEP)
282
170
283
171
Wado has a set of document for significant language features and architecture decisions.
284
172
285
-
See [docs/WEP.md] for details and existing WEPs.
173
+
See `docs/` for existing WEPs.
286
174
287
175
## Project Development
288
176
@@ -304,8 +192,8 @@ Then run `mise run on-task-started` to install the development tools.
304
192
### Development Tasks
305
193
306
194
```sh
307
-
mise run test# test Rust crates (included in on-task-done)
308
-
mise run test-wado # test Wado modules (included in on-task-done)
195
+
mise run test# test Rust crates
196
+
mise run test-wado # test Wado modules
309
197
mise run format # format Rust files and Markdown files
310
198
311
199
mise run benchmark-all # count-prime, mandelbrot, sieve, fts, and zlib
@@ -317,7 +205,7 @@ mise run report-wasm-size # hello_world, pi_approx, and zlib
317
205
The compiler emits timestamped diagnostics to stderr. Use `--log-level` to control verbosity.
318
206
319
207
```sh
320
-
wado compile --log-level debug file.wado# all messages including phase spans
208
+
wado compile --log-level debug file.wado
321
209
```
322
210
323
211
## Development Workflow
@@ -335,13 +223,13 @@ mise run on-task-started # install project tools
335
223
336
224
When you have completed a task, make sure everything is up-to-date and tested:
337
225
338
-
- Update the docs if necessary:
226
+
- Update docs if necessary:
339
227
- docs/spec.md
340
228
- docs/cheatsheet.md
341
229
- docs/compiler.md
342
230
- docs/optimizer.md
343
231
- Run `time mise run on-task-done`
344
-
- It performs format, clippy-fix, update golden fixtures, regenerate stdlib docs, and tests.
345
-
- It will take 15+ minutes
346
-
- Run in foreground and commit the results with without `| tail` in order not to lost the results.
347
-
-CI's integrity check fails if generated files are uncommitted.
232
+
- It performs format, clippy-fix, update golden fixtures, generation of stdlib docs, and tests.
233
+
- It will take 20+ minutes.
234
+
- Run it in foreground without `| tail` in order not to lost the results.
- Keep documentation mutually exclusive and collectively exhaustive (MECE).
7
+
- Keep documentation mutually exclusive and collectively exhaustive.
6
8
- Do not use `**...**` (bold) for sub-sections. Use markdown sections instead.
7
9
- Use markdown checklist for TODOs (`- [ ] ...`) and what's done (`- [x] ...`), instead of `~~...~~` (strike-through) and emojis.
8
10
- After updating any docs, always run `mise run format`.
11
+
- Do not make a sub-directory for docs.
12
+
13
+
## WEP: Wado Evolution Proposals
14
+
15
+
WEPs combine language specification and implementation strategy in a single document, covering both user-visible features and compiler architecture decisions.
0 commit comments