ww: lift introspection files to lib/ww/ (ast, lex, tok, parse, typ, sym)

This commit is contained in:
2026-05-11 16:17:23 +09:00
parent 3f8d64e01b
commit 177862fb29
16 changed files with 80 additions and 74 deletions

View File

@@ -59,10 +59,11 @@ slurp_eq(const char *a, const char *b)
return rc;
}
/* Each tool builds via `ww_ww build -I <local> -I selfhost/cmd/wcc src`.
* Some tools have a local module dir (w6a, w6l with sibling .ww files);
* wwc-only tools (w6c, ww, wwdump) just need the wwc -I. inc_local is
* "" for those.
/* Each tool builds via `ww_ww build -I <local> -I lib/ww -I selfhost/cmd/wcc src`.
* lib/ww holds the language introspection (lex/tok/ast/parse/typ/sym);
* selfhost/cmd/wcc holds the compiler internals (mem/check/cgen*).
* Some tools have a local module dir (w6a, w6l with sibling .ww files).
* inc_local is "" for tools without one (w6c, ww, wwdump).
*/
static int
rebuild_one(const char *bin, const char *cwd, const char *tool,
@@ -76,14 +77,14 @@ rebuild_one(const char *bin, const char *cwd, const char *tool,
if (inc_local && inc_local[0]) {
snprintf(cmd, sizeof cmd,
"cd %s && %s/ww_ww build -I %s/%s -I %s/selfhost/cmd/wcc "
"cd %s && %s/ww_ww build -I %s/%s -I %s/lib/ww -I %s/selfhost/cmd/wcc "
"%s/%s >/dev/null 2>&1",
workdir, bin, cwd, inc_local, cwd, cwd, src_rel);
workdir, bin, cwd, inc_local, cwd, cwd, cwd, src_rel);
} else {
snprintf(cmd, sizeof cmd,
"cd %s && %s/ww_ww build -I %s/selfhost/cmd/wcc "
"cd %s && %s/ww_ww build -I %s/lib/ww -I %s/selfhost/cmd/wcc "
"%s/%s >/dev/null 2>&1",
workdir, bin, cwd, cwd, src_rel);
workdir, bin, cwd, cwd, cwd, src_rel);
}
if (runwait(cmd) != 0) {
fprintf(stderr, "self-rebuild FAIL: ww_ww build errored on %s\n", tool);