How jac3km4/redscript works
Project type and purpose
• This is an open-source compiler toolchain for REDscript (a statically-typed game-scripting language for CD Projekt’s REDengine).
• It provides several sub-tools (compiler, decompiler, formatter, CLI driver, C API, file I/O, etc.) all implemented as Rust crates in a single monorepository.
File structure
• Top-level “crates” directory groups individual Rust libraries and executables:
• cli – unified command-line entry point
• compiler/{frontend,backend,api} – parsing, static analysis → IR → bytecode
• decompiler – bytecode → REDscript source
• syntax/{parser,ast,formatter} – language grammar, AST definitions, code formatting
• io – reading/writing native REDengine binary files
• scc/{cli,capi,core} – drop-in replacement compiler (CLI and C API)
• dotfile – .redscript config parser
• code-edit – source‐level transformation utilities
• Build and CI configured via Cargo.toml files, GitHub workflows, and OS-specific asset directories.
Insights from the README
• Key patterns:
• Modular micro-crates for single responsibility (parser, AST, formatter).
• Layered compiler architecture (frontend → IR → backend).
• Dual entry points: Rust CLI and C API (scc/capi).
• Shared core logic in scc/core for both capi and cli.