jdc_core/lib.rs
1//! jdc-core — machine-neutral decompiler core.
2//!
3//! A decompiler is a pipeline: `machine code → CFG → per-block expressions →
4//! control-flow structuring → statement tree → refinement passes → source`.
5//! Only the first two steps know anything about the source machine (JVM `.class`
6//! operand stack, DEX registers, ...). Everything after them operates on the
7//! machine-neutral IR defined here, and that is what this crate provides.
8//!
9//! ```text
10//! front-end (machine-specific) jdc-core (machine-neutral)
11//! ─────────────────────────── ──────────────────────────
12//! parse bytes cfg::Cfg (blocks + edges)
13//! decode instructions ───────────────► ir::BlockResult (stmts + term)
14//! build expressions per block structure::Structurer / sese
15//! synthesize a VarTable convert::Converter
16//! machine idioms (javac / d8 / ...) ────────► passes::* (shared refinements)
17//! emit::Printer (source text)
18//! ```
19//!
20//! The front-end implements [`ctx::Ctx`] (naming, type queries, nested method
21//! bodies) and fills [`cfg::Cfg`] + [`ir::BlockResult`]. See `docs/CONTRACT.md`
22//! for the exact obligations, and `tests/toy_frontend.rs` for a complete
23//! non-JVM example.
24
25pub mod analysis;
26pub mod cfg;
27pub mod convert;
28pub mod ctx;
29pub mod dbg;
30pub mod var;
31pub mod emit;
32pub mod ir;
33pub mod sese;
34pub mod structure;
35pub mod typeutil;
36pub mod types;
37
38pub use ctx::{ctx_method_body, Ctx, Family, MethodBody, NestedClass, NestedKind, NullCtx};
39pub use ir::{BlockResult, Expr, Stmt, SwitchTargets, Term};