Decision graphs of MoonBit functions: every test, arm and call in order, from the source.
| Call | Followed to |
|---|---|
| f(...) | the function f of the package, or the one using @p { f } brings in |
| @p.f(...) | f in the package that @p imports, inside the module |
| T::m(...), @p.T::m(...) | the method m of T, inherent first, then impl ... for T with m |
| x.m(...) | as T::m, when the type of x is written: an annotated parameter or let, self of a method, or a record field whose declaration writes its type |
| Layer | Package | Responsibility |
|---|---|---|
| Vocabulary | source | SourceFile, Span |
| Syntax | syntax | the only importer of moonbitlang/parser: diagnostics and rille's view of a file |
| Configuration | config | moon.mod and moon.pkg: module name and version, imports, target files |
| Model | graph | node and edge kinds, FnKey, SiteId, NodeId, Graph, GraphBuilder, Producer, JSON form |
| Resolution | resolve | names to definitions; unresolved as a value with its reason |
| Walk | walk | the view of a body to a graph, through GraphBuilder |
| Rendering | render | text tree, test list, Mermaid and DOT, from the graph alone |
| Edge | cmd/rille | arguments, files (the module, its git commit), printing |
{
"schema": "rille.graph/1",
"producer": { "name": "rille", "version": <rille version>,
"commit": <hash> | null, "commit_unknown": <reason, when null>,
"module": <module name>,
"module_commit": <hash> | null, "module_commit_unknown": <reason, when null> },
"module": <module name>, "package": <full package path>,
"entry": <name or Type::name>, "depth": <N>, "target": <target>,
"root": <node id>,
"nodes": [ pre-order: the order the flow meets them
{
"id": <node id>, path of edges from the root: m::f/body0/then1
"site": <site id>, function and path inside it: m::g#body0/arm1
"kind": fn | if | guard | match | arm | arm_guard | while | for | for_in
| try | return | raise | abort | panic | call | closure,
...the texts of the kind, as written:
fn: function; if, guard, arm_guard, while, for: cond; match: scrutinee;
arm: pattern; for_in: binders, iterable; return, raise: value;
abort: args; closure: text;
call: callee, resolution, target_unknown (when marked),
"span": { "file": <path>, "start": [line, col], "end": [line, col] },
"edges": [ { "kind": body | cond | then | else | arm | guard | call | return,
"to": <node id> } ]
}
]
}rille graph --module <root> --package <path> --entry <name>
[--depth N] [--format json|mermaid|dot|text|tests] [--target T]
[--width N | --no-truncate]
rille parse <dir>...
rille version
rille help| Status | Meaning |
|---|---|
| 0 | success (also help and version) |
| 1 | a defect of rille itself |
| 2 | usage error: unknown command or option, missing value, bad --depth, --format or --width |
| 3 | a file or directory the command needs cannot be read: missing, or denied by a sandbox policy (moon.mod, the entry package's moon.pkg, a directory or file of rille parse) |
| 4 | a moon.mod or moon.pkg does not parse or lacks its name, or rille parse found files with parser reports (the report is printed, then the status) |
| 5 | the entry cannot be drawn: no definition (a bare name that only methods have names them: did you mean Binary::add_ctx?), two or more, an extern stub |
moon build --target wasm --release src/cmd/rille
cat > policy.json <<'JSON'
{ "fs": { "read": ["/path/to/floating/library"] } }
JSON
moonrun --policy policy.json _build/wasm/release/build/cmd/rille/rille.wasm \
graph --module /path/to/floating/library --package interval --entry mul_interval_impl --format testsmoonx --experimental-policy policy.json Luna-Flow/rille/cmd/rille@<version> graph ...# rille 0.0.2 (commit <hash>); module Luna-Flow/floating (commit <hash>); package Luna-Flow/floating/binary; entry Binary::div_ctx; depth 1; target nativeflowchart TD
n0("fn Walker::call :405")
n1["closure (resolution : @graph.Resolution) =#gt; { self.add( parent, edge, Call(callee=callee... :414"]
n2{"T1 match def.body :422"}
n3["arm Extern :423"]
n4["call call :423"]
n5["call ignore :423"]
n6["arm Code(body) :424"]
n7{"T2 if frame.stack.iter().any(k =#gt; k == def.key) :425"}
n8["call frame.stack.iter :425"]
n9["closure k =#gt; k == def.key :425"]
n10["call frame.stack.iter().any :425"]
n11["call call :426"]
n12["call ignore :426"]
n13{"T3 if frame.depth #gt;= self.max_depth :427"}
n14["call call :428"]
n15["call ignore :428"]
n16["call call :430"]
n17["call self.add :431"]
n18["call self.walk_body :432"]
n0 -->|body| n1
n0 -->|body| n2
n2 -->|arm| n3
n2 -->|arm| n6
n3 -->|body| n4
n3 -->|body| n5
n6 -->|body| n7
n7 -->|cond| n8
n7 -->|cond| n9
n7 -->|cond| n10
n7 -->|then| n11
n7 -->|then| n12
n7 -->|else| n13
n13 -->|then| n14
n13 -->|then| n15
n13 -->|else| n16
n13 -->|else| n17
n13 -->|else| n18just fmt # format
just check # type-check the default target
just check-all # type-check every target
just test # run the tests
just info # regenerate pkg.generated.mbti
just ready # format, check all targets, regenerate interfaces, test with coverageInstall
Download zipDecision graphs of MoonBit functions: every test, arm and call in order, from the source.