feat(cli): ludic deps - the module graph as the compiler resolved it

With LUDIC_DEPS=<file> the compiler records every reference the
visibility pass resolves (from module, to module) and every assignment
to another module's global. ludic deps prints the modules,
dependencies, largest cycle, cross writes and globals written from
outside, with --graph, --dot, --writes, --uses MOD, --check FILE and
--baseline FILE. Reseed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-25 11:16:34 +03:00
parent 69352babfd
commit e738741521
17 changed files with 44510 additions and 41589 deletions

View file

@ -0,0 +1,12 @@
# tangle.ludic — the program `ludic deps` is tested on: a and b use each other (the largest cycle is
# 2), both use the leaf c (not counted), and a writes b's global b_count (one cross-module write).
#
# Running it prints: 4
import "tangle/c"
import "tangle/a"
import "tangle/b"
program Tangle {
entry {
print(a_run())
}
}

View file

@ -0,0 +1,9 @@
# a/index.ludic - uses b, and writes b's global from outside it
module a
export function a_run() -> int {
b_count = b_count + 1
return b_run() + c_one()
}
export function a_two() -> int {
return 2
}

View file

@ -0,0 +1,6 @@
# b/index.ludic - uses a back: a and b are a cycle
module b
export var b_count: int = 0
export function b_run() -> int {
return a_two() + c_one()
}

View file

@ -0,0 +1,5 @@
# c/index.ludic - uses nothing: a leaf, which the dependencies do not count
module c
export function c_one() -> int {
return 1
}