14 lines
1.1 KiB
Markdown
14 lines
1.1 KiB
Markdown
lib/ww — frontend in ww (lex, parse, sym, typ, ast). Mirrors `cmd/wcc/` (the C bootstrap frontend). Compiled by `cmd/w6c` against the wwstage cgen.
|
|
|
|
Style:
|
|
- Hare-shaped syntax. Trailing `;`. `=` after fn/type signatures. `export` for visibility.
|
|
- Plan 9 names: run-together lowercase (`parsefile`, `lexnext`, `mksym`). No snake_case. No CamelCase.
|
|
- ww-side type names are lowercase (`node`, `sym`, `typ`); the C-side equivalents in `cmd/wcc/ww.h` are capitalized (`Node`, `Sym`, `Type`) per Plan 9 cc convention.
|
|
|
|
This directory is **not** a Hare-style stdlib module — it's a compiler-frontend port, so structural fidelity to `cmd/wcc/` beats Hare API mimicry. The "follow Hare APIs" rule from the root CLAUDE.md applies to peer `lib/*` modules (fmt, io, bufio, strings, ...), not here.
|
|
|
|
When porting from `cmd/wcc/*.c`:
|
|
- Keep the same data layout. The selfhost goal is byte-compatible structures so dump/inspect tools work either way.
|
|
- Read `cmd/wcc/ww.h` first for canonical field names and ordering.
|
|
- See `selfhost/CLAUDE.md` for the wwstage cgen traps to avoid (undersized `amalloc`).
|