How darthdeus/rock-lang works
Rock is an experimental statically typed language compiler targeting LuaJIT and GLSL, with a JavaScript backend and developer tooling. Its primary workflow takes a Rock program through parsing, semantic analysis and MIR lowering to backend output, which can then run under LuaJIT or be emitted as GLSL. The repository also includes an LSP and Stone game-engine support. Some source excerpts are incomplete or unsampled, so edges for those implementation details are marked unverified rather than asserted.
Main entry points: main.rs Rock CLI · workspace.rs Workspace · mod.rs MIR Lowering · pipeline.rs Codegen Pipeline
Components 25
Language Front End
- Parser
crates/skull-parser/src/parser.rs - HIR
crates/bone-core/src/hir.rs - Workspace
crates/bone-core/src/workspace.rs - Module Namespaces
crates/bone-core/src/modules.rs
Semantic Analysis
- Name Resolution
crates/bone-lower/src/resolve.rs - Type Inference
crates/bone-inference/src/lib.rs - Semantic Passes
crates/bone-semantic/src/semantic_passes.rs
Compiler Back End
- MIR Lowering
crates/skull-mir/src/lower/mod.rs - Type Identity
crates/skull-mir/src/code_identity.rs - Mono Types
crates/skull-mir/src/monoty.rs - MIR Storage
crates/skull-mir/src/lower/storage.rs - MIR Transforms
crates/skull-transform/src/lib.rs - Codegen Pipeline
crates/skull/src/pipeline.rs - Lua Backend
crates/skull-codegen-lua/src/lib.rs - JavaScript Backend
crates/skull-codegen-js/src/emit/session.rs - GLSL Backend
crates/skull-codegen-glsl/src/pipeline.rs
Developer Tools
- Rock CLI
crates/rock-cli/src/main.rs - Editor Queries
crates/bone-query/src/query.rs - Language Server
crates/rock-lsp/src/lib.rs - Linting
crates/bone-lints/src/lib.rs - Formatter
crates/skull-fmt/src/printer.rs
Execution and Engine
- LuaJIT
- Stone Engine
stone-rs/src/lib.rs - Engine Host
crates/rock-engine-host/src/engine_build.rs
Other components
- Rock Programmer
Connections 28
- Rock Programmer → Rock CLI: runs commands
README.md - Rock CLI → Parser: compiles source
- Parser → HIR: produces syntax
- HIR → Workspace: stored in
crates/bone-core/src/workspace.rs - Workspace → Module Namespaces: uses namespaces
crates/bone-core/src/workspace.rs - Workspace → Name Resolution: resolved by
- Name Resolution → Semantic Passes: resolves names
- Semantic Passes → Type Inference: infers types
- Workspace → Type Inference: stores results
crates/bone-core/src/workspace.rs - Workspace → Editor Queries: queried by
- Language Server → Editor Queries: requests queries
- Workspace → MIR Lowering: lowers HIR
crates/skull-mir/src/lower/mod.rs - MIR Lowering → Type Identity: uses identities
crates/skull-mir/src/code_identity.rs - MIR Lowering → Mono Types: uses types
crates/skull-mir/src/lower/mod.rs - MIR Lowering → MIR Storage: lowers storage
crates/skull-mir/src/lower/mod.rs - MIR Lowering → MIR Transforms: transformed by
- Codegen Pipeline → MIR Lowering: emits MIR
crates/skull/src/pipeline.rs - Codegen Pipeline → Lua Backend: selects backend
- Codegen Pipeline → JavaScript Backend: selects backend
- Codegen Pipeline → GLSL Backend: selects backend
- Lua Backend → LuaJIT: runs output
README.md - Rock CLI → GLSL Backend: prints shaders
README.md - Rock CLI → JavaScript Backend: offers backend
README.md - Rock CLI → Linting: runs lint
README.md - Rock CLI → Formatter: formats code
README.md - Rock CLI → Language Server: starts server
README.md - Rock CLI → Engine Host: builds games
- Engine Host → Stone Engine: stages engine
crates/rock-engine-host/src/engine_build.rs