Skip to main content

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 / decode                       cfg::Cfg          blocks + edges
13//!   build expressions per block   ──────────► ir::BlockResult   stmts + term
14//!   synthesize a VarTable                      structure::Structurer / sese
15//!   machine idioms (javac / d8 / R8 / ...)  ──► convert::Converter (Region → Stmt)
16//!   your refinement passes  ───────────────────► emit::Printer    Java source text
17//!   (the shared pass suite is the last
18//!    piece still living front-end-side)
19//! ```
20//!
21//! The front-end implements [`ctx::Ctx`] (naming, type queries, nested method
22//! bodies) and fills [`cfg::Cfg`] + [`ir::BlockResult`]. See `docs/CONTRACT.md`
23//! for the exact obligations, and `tests/toy_frontend.rs` for a complete
24//! non-JVM example.
25
26pub mod analysis;
27pub mod cfg;
28pub mod convert;
29pub mod ctx;
30pub mod dbg;
31pub mod emit;
32pub mod fx;
33pub mod ir;
34pub mod rename;
35pub mod sese;
36pub mod structure;
37pub mod types;
38pub mod typeutil;
39pub mod var;
40
41pub use fx::{FxBuildHasher, FxHashMap, FxHashSet, FxHasher};
42pub use ctx::{ctx_method_body, Ctx, Family, MethodBody, NestedClass, NestedKind, NullCtx};
43pub use ir::{BlockResult, Expr, Stmt, SwitchTargets, Term};