How dilanr/rustpiler works
RnR is a small language toolchain with a CLI and browser playground. The main workflow accepts source, parses it into an AST, type-checks it, then optionally interprets it or generates and runs MIPS-like code. The playground adds in-browser compilation, diagnostics, editing, and AST exploration. The pipeline and CLI behavior are documented; the WASM adapter and CLI internals were not sampled, so their detailed wiring is omitted.
Main entry points: cli.rs CLI options · pipeline.rs Compiler pipeline · useWorkspace.tsx Playground workspace · useRustpiler.ts Browser compiler hook
Components 22
CLI
- CLI app
crates/cli/src/main.rs - CLI options
crates/cli/src/cli.rs
Compiler
- Compiler pipeline
crates/compiler/src/pipeline.rs - Parser
crates/compiler/src/parse.rs - Program AST
crates/compiler/src/ast/mod.rs - Type checker
crates/compiler/src/type_check.rs - Diagnostics
crates/compiler/src/error/diagnostic.rs - AST serialization
crates/compiler/src/ast/serialize.rs
Execution
- Tree-walk VM
crates/compiler/src/vm.rs - MIPS codegen
crates/compiler/src/code_gen.rs - MIPS VM runner
crates/compiler/src/pipeline.rs
Playground
- WASM interface
crates/wasm/src/lib.rs - Playground workspace
playground/src/workspace/hooks/useWorkspace.tsx - Browser compiler hook
playground/src/features/compiler/hooks/useRustpiler.ts - Code editor
playground/src/features/editor/components/CodeEditor.tsx - Editor diagnostics
playground/src/features/editor/hooks/useMonacoMarkers.ts - AST visualization
playground/src/features/ast/components/AstGraph.tsx - Run output
playground/src/workspace/components/Console.tsx
Other components
- Language user
- RnR source
- Assembly file
- AST dump file
Connections 24
- Language user → CLI app: invokes
- CLI app → CLI options: parses options
- CLI options → RnR source: reads input
- CLI options → Compiler pipeline: selects stages
- Compiler pipeline → Parser: parses source
- Parser → Program AST: produces AST
- Compiler pipeline → Type checker: checks program
- Type checker → Diagnostics: reports errors
- CLI options → AST serialization: requests AST dump
- CLI options → AST dump file: writes dump
- CLI options → Tree-walk VM: runs interpreter
- Compiler pipeline → Tree-walk VM: evaluates program
- CLI options → MIPS codegen: requests codegen
- Compiler pipeline → MIPS codegen: generates instructions
- Compiler pipeline → MIPS VM runner: runs instructions
- CLI options → Assembly file: writes assembly
- Language user → Playground workspace: edits and runs
- Playground workspace → Code editor: hosts editor
- Playground workspace → Browser compiler hook: runs compilation
- Browser compiler hook → WASM interface: calls compile
- Browser compiler hook → Editor diagnostics: provides diagnostics
- Playground workspace → AST visualization: shows AST
- Playground workspace → Run output: shows results
- WASM interface → Compiler pipeline: compiles source