21 releases (7 breaking)
Uses new Rust 2024
| 0.8.0-pre.10 | Nov 26, 2025 |
|---|---|
| 0.8.0-pre.8 | Jul 24, 2025 |
| 0.4.0 | Mar 9, 2025 |
| 0.3.0 | Dec 28, 2024 |
#2475 in Web programming
Used in 2 crates
525KB
11K
SLoC
Three-Address Code (TAC) intermediate representation for JavaScript.
This crate provides a TAC representation for JavaScript/ECMAScript code, serving as an intermediate layer between the Control Flow Graph (CFG) and Static Single Assignment (SSA) forms in the compilation pipeline.
Three-Address Code
TAC is a linear intermediate representation where each statement performs at most one operation and uses at most three operands (typically: two sources and one destination). This form makes data flow analysis and optimization easier than working directly with the AST or CFG.
Key Types
TFunc: A complete function in TAC form, including its control flow graphTCfg: The control flow graph containing basic blocks and metadataTBlock: A single basic block containing a sequence of statementsTStmt: A single statement assigning a value to a left-hand side identifierTTerm: A block terminator (return, jump, conditional branch, etc.)Item: The right-hand side of an assignment (operation, literal, call, etc.)- [
LId]: A left-hand side identifier (simple variable, member access, or private field)
Example Flow
JavaScript code is transformed through these stages:
- Parse to AST (using SWC)
- Convert to CFG (using
swc-cfg) - Lower to TAC (this crate)
- Transform to SSA (using
swc-ssa)
Modules
Dependencies
~25–39MB
~545K SLoC