A programming language combining the best features from Rust, Python, and C/C++
ShitRust combines the best aspects of modern programming languages to deliver performance, safety, and developer productivity.
Inspired by Rust, ShitRust provides strong memory safety guarantees without the complexity of a garbage collector.
LLVM-based optimizing compiler that generates efficient native code with performance comparable to C/C++.
Clean, Python-inspired syntax that emphasizes readability while maintaining the expressiveness of systems languages.
Integrated code formatter ensures consistent style across your codebase, eliminating style debates.
First-class async/await syntax provides seamless asynchronous programming without callback hell.
Combination of Result types and try/catch blocks gives you flexibility in error handling approaches.
Powerful trait system allows for composition-based code organization with clear interfaces.
Python-style list comprehensions enable powerful, concise data transformations.
Functional programming with pipeline operator for clean, readable data transformations.
Safely access properties deep in object hierarchies without worrying about null references.
Comprehensive pattern matching with destructuring, guards, and or-patterns for expressive code.
First-class generic types and functions for type-safe, reusable code components.
Robust module system with explicit imports and exports for better code organization.
Built-in concurrency primitives make parallel programming straightforward and safe.
Seamless interoperability with C/C++ libraries through a simple and safe FFI.
Integrated testing framework makes writing and running tests frictionless.
Advanced static analysis catches bugs and ensures code quality before runtime.
Integrated package manager simplifies dependency management and sharing code.
Getting started with ShitRust is easy. Follow these steps to install the compiler on your system:
# Clone the repository
git clone https://github.com/Waowzar/shitrust.git
cd shitrust
# Build the compiler
./build.sh
# Install the binary (optional)
cargo install --path .
# Show help
shitrust --help
# Clone the repository
git clone https://github.com/Waowzar/shitrust.git
cd shitrust
# Build the compiler
build.bat
# Install the binary (optional)
cargo install --path .
# Show help
shitrust --help
The project includes build scripts for both Windows and Unix platforms with various options:
# Show help
./build.sh help
# Build debug version
./build.sh
# Build release version
./build.sh release
# Clean build artifacts
./build.sh clean
# Run tests
./build.sh test
# Run examples
./build.sh examples
# Run benchmark with timing information
./build.sh bench
# Generate documentation
./build.sh docs
# Show help
build.bat help
# Build debug version
build.bat
# Build release version
build.bat release
# Clean build artifacts
build.bat clean
# Run tests
build.bat test
# Run examples
build.bat examples
# Run benchmark with timing information
build.bat bench
# Generate documentation
build.bat docs
ShitRust's syntax is designed to be familiar to developers coming from Rust, Python, or C/C++. Here are some examples to help you get started:
// Hello World in ShitRust - A simple example
// Function to generate a greeting
fn generate_greeting(name: string) -> string {
let greeting = "Hello, " + name + "!";
return greeting;
}
// Main function - entry point of the program
fn main() -> void {
// Basic println
println("Hello, ShitRust World!");
// Variables with type inference
let name = "ShitRust";
let version = 0.2;
// String concatenation and method calls
println("Welcome to " + name + " version " + version.to_string() + "!");
// Conditional statement
if (version < 1.0) {
println("This is an early preview version.");
} else {
println("This is a stable release.");
}
// Function call
let message = generate_greeting("Programmer");
println(message);
}
// Function definition
fn add(a: int, b: int) -> int {
return a + b;
}
// Variables
let x = 5; // Type inference
let mut y = 10; // Mutable variable
let z: float = 3.14; // With type annotation
// Constants
const PI: float = 3.14159;
const MAX_SIZE: int = 100;
// Control flow
if x > y {
println("x is greater");
} else {
println("y is greater");
}
// Loops
while x > 0 {
x = x - 1;
}
for i in 0..10 {
println(i.to_string());
}
// Infinite loop with break
loop {
if x > 10 {
break;
}
x = x + 1;
}
// Match statement
match x {
0 => println("Zero"),
1 => println("One"),
n if n < 10 => println("Single digit"),
_ => println("Other"),
}
// Type aliases
type UserId = int;
type UserMap = HashMap;
// Generic struct
struct Point {
x: T,
y: T,
fn distance_from_origin() -> float {
return (this.x.to_float() * this.x.to_float() +
this.y.to_float() * this.y.to_float()).sqrt();
}
// Static method
static fn origin() -> Point {
return Point { x: T.from(0), y: T.from(0) };
}
}
// Trait definition
trait Printable {
fn print() -> void;
fn debug_print() -> string;
}
// Implementing a trait
impl Printable for Point {
fn print() -> void {
println("Point(" + this.x.to_string() + ", " + this.y.to_string() + ")");
}
fn debug_print() -> string {
return "Point { x: " + this.x.to_string() + ", y: " + this.y.to_string() + " }";
}
}
// Result enum for error handling
enum Result {
Ok(T),
Err(E)
}
// Function returning a Result
fn divide(a: int, b: int) -> Result {
if b == 0 {
return Result::Err("Division by zero");
}
return Result::Ok(a / b);
}
// Async function with await
async fn fetch_data(url: string) -> Result {
// Async code here
await timing.sleep(1000);
return Result::Ok("Data from " + url);
}
// Using async/await with error handling
fn process_data() -> void {
try {
let result = await fetch_data("https://api.example.com");
match result {
Result::Ok(data) => println("Success: " + data),
Result::Err(err) => println("Error: " + err)
}
} catch e {
println("Exception: " + e.to_string());
}
}
// List comprehension
let numbers = [1, 2, 3, 4, 5];
let squares = [x * x for x in numbers if x % 2 == 0];
// Pipeline operator
let result = numbers
|> [x * 2 for x in _]
|> _.filter(|x| -> bool { return x > 5; })
|> _.sum();
// Optional chaining and nullish coalescing
let user = get_user(123);
let username = user?.name ?? "Unknown";
let isActive = user?.is_active() ?? false;
Check out our full collection of examples to explore all of ShitRust's features:
View More ExamplesComprehensive documentation is available to help you learn and use ShitRust effectively.
New to ShitRust? Start here to learn the basics and get your first program running.
Read GuideDetailed documentation of ShitRust's syntax, types, functions, and standard library.
Explore ReferenceComplete API reference for the ShitRust standard library and core modules.
View API DocsYou can also generate comprehensive documentation locally using the build scripts:
# Windows
build.bat docs
# Linux/macOS
./build.sh docs
# Documentation will be available at:
# target/doc/shitrust/index.html
ShitRust is currently developed by a solo developer. Feel free to check out the GitHub repository for the latest updates.
ShitRust is an open-source project, and contributions are always welcome! Check out the contribution guidelines to get started:
git checkout -b feature/amazing-featuregit commit -m 'Add some amazing feature'git push origin feature/amazing-feature