A programming language that is a minimal subset of Rust

23 hours ago 2

Caution

Listen, this repo is just for fun. I had it private, but I care more about being able to run GitHub Actions to make sure that things are good, so I'm open sourcing this repo. Not everything in here is good, or accurate, or anything: I'm just messing around. Feel free to take a look but don't look too much into this just yet. Someday I'll actually talk about this.

A programming language that starts as a minimal subset of Rust, designed to explore cutting-edge compiler implementation techniques.

Rue is an experimental programming language with Rust-like syntax that compiles to native code. It focuses on modern compiler architecture including incremental compilation using Salsa, IDE-first design with concrete syntax trees, and direct ELF executable generation without external tooling.

The compiler supports both Cargo and Buck2 build systems.

The compiler is fully functional with a complete implementation pipeline from lexing through native code generation. It includes an LSP server for IDE integration and VS Code extension.

Platform Support: Linux x86-64 only

Current language support:

  • Variables and assignment (let statements)
  • Arithmetic operations (+, -, *, /, %)
  • Control flow (if/else, while loops)
  • Functions with optional parameters
  • All values are 64-bit signed integers
fn factorial(n) { if n <= 1 { 1 } else { n * factorial(n - 1) } } fn main() { factorial(5) // Returns 120 as the exit code }
# Compile a program to executable cargo run -p rue samples/simple.rue # Run the compiled program (executable created in same directory as source) ./samples/simple; echo $? # Shows the program's return value
buck2 run //crates/rue:rue samples/simple.rue ./samples/simple; echo $?
# With Cargo cargo test # All tests cargo test -p rue-lexer # Just lexer tests cargo test -p rue-parser # Just parser tests # With Buck2 buck2 test //crates/... # All tests buck2 test //crates/rue-lexer:test # Just lexer tests buck2 test //crates/rue-parser:test # Just parser tests

The language server provides syntax highlighting and error detection:

# Install VS Code extension ./install-extension.sh # Start the language server for other editors cargo run -p rue-lsp # With Cargo buck2 run //crates/rue-lsp # With Buck2

See crates/rue-lsp/README.md for editor integration details.

See CONTRIBUTING.md for development guidance and docs/spec.md for the complete language specification.

Licensed under either of

at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Read Entire Article