feat(lang): L3 module scope - module, export, friend module

A barrel's 'module NAME' makes its directory a module; a declaration other modules
use says 'export'. Private use from another module is an error naming the module
and where to mark it; 'friend module' sees everything (a test harness); a file in
no module is public and a package keeps its own module. LUDIC_VIS_REPORT=1 lists
every violation instead of stopping, so a codebase can be given its exports first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-24 00:52:06 +03:00
parent 0c73287e35
commit 0677aee93f
20 changed files with 55913 additions and 54132 deletions

View file

@ -41,6 +41,7 @@ function emit_assign(st: Node) -> void {
else {
let g = find_global(t.s)
if (g == null) { perr(`assign to unknown {t.s}`) }
vis_check(g, t.s)
addr = `@g_{t.s}`; ty = g.ty
}
} else {
@ -291,6 +292,7 @@ function emit_match(st: Node) -> void {
function emit_emit(st: Node) -> Val {
let ev = find_event(st.s)
if (ev == null) { perr(`emit: unknown event {st.s}`) }
vis_check(ev, st.s)
# evaluate each payload field in declared order (default for a missing arg)
let fcodes = new []pointer
let ftys = new []pointer