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:
parent
69352babfd
commit
e738741521
17 changed files with 44510 additions and 41589 deletions
12
examples/modules/tangle.ludic
Normal file
12
examples/modules/tangle.ludic
Normal 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())
|
||||
}
|
||||
}
|
||||
9
examples/modules/tangle/a/index.ludic
Normal file
9
examples/modules/tangle/a/index.ludic
Normal 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
|
||||
}
|
||||
6
examples/modules/tangle/b/index.ludic
Normal file
6
examples/modules/tangle/b/index.ludic
Normal 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()
|
||||
}
|
||||
5
examples/modules/tangle/c/index.ludic
Normal file
5
examples/modules/tangle/c/index.ludic
Normal 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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue