🤖 Built entirely by AI

Rush

A programming language exploring simplicity, expressiveness, and performance.

hello.rush
# Welcome to Rush
greet = fn(name) {
    "Hello, " + name + "! 👋"
}

# Method chaining with arrays
people = ["World", "Rush", "Developers"]
people
    .map(greet)
    .each(print)

# Object-oriented programming  
class Calculator {
    fn add(a, b) { a + b }
    fn multiply(a, b) { a * b }
}

calc = Calculator.new()
result = calc.add(10, 5)
print("Result:", result)

Designed with developers in mind

Rush brings together functional and object-oriented programming with language features aimed at making coding more enjoyable and productive.

🎯

Intuitive Syntax

Clean, readable code that aims to feel natural. Designed to balance simplicity with expressiveness.

High Performance

Three-tiered execution system: tree-walking interpreter, bytecode VM, and ARM64 JIT compilation for maximum performance.

🧩

Method Chaining

Dot notation methods on all core types support readable code with method chaining capabilities.

🏗️

Object-Oriented

OOP support with classes, inheritance, and polymorphism for structured, maintainable applications.

📦

Rich Standard Library

JSON processing, regular expressions, file operations, and mathematical functions included.

🔍

Advanced Debugging

Logging, performance metrics, and debugging tools to help with optimization and troubleshooting.

See Rush in action

Explore some language features that we hope make Rush useful and enjoyable.

Functional Programming Support

First-class functions, closures, and method chaining aim to make functional programming natural in Rush.

  • Higher-order functions
  • Closures and lexical scoping
  • Method chaining on collections
  • Immutable data patterns
View Examples
functional.rush
# Higher-order functions and closures
createMultiplier = fn(factor) {
    return fn(number) {
        return number * factor
    }
}

double = createMultiplier(2)
triple = createMultiplier(3)

# Method chaining with collections
numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

result = numbers
    .filter(fn(x) { x % 2 == 0 })
    .map(double)
    .reduce(fn(acc, x) { acc + x }, 0)

print("Sum of doubled evens:", result)  # 60

Object-Oriented Programming

OOP features with classes, inheritance, and method calls for structured, maintainable code.

  • Class definitions and instantiation
  • Single inheritance with super calls
  • Instance variables and methods
  • Polymorphism and method overriding
Learn More
shapes.rush
# Base class with common functionality
class Shape {
    fn initialize(name) {
        @name = name
    }
    
    fn area() {
        return 0  # Override in subclasses
    }
    
    fn description() {
        return @name + " with area " + @area()
    }
}

# Inheritance and method overriding
class Rectangle < Shape {
    fn initialize(width, height) {
        super("Rectangle")
        @width = width
        @height = height
    }
    
    fn area() {
        return @width * @height
    }
}

rect = Rectangle.new(10, 5)
print(rect.description())  # "Rectangle with area 50"

Built-in Methods

Dot notation methods on core types with string, array, number, and JSON operations.

  • String manipulation and processing
  • Array operations and transformations
  • Number mathematical methods
  • JSON parsing and manipulation
API Reference
methods.rush
# String methods with chaining
text = "  Hello, Rush Programming!  "
clean = text.trim().lower().replace(" ", "_")
print(clean)  # "hello,_rush_programming!"

# Array transformations
numbers = [1, 2, 3, 4, 5]
doubled = numbers.map(fn(x) { x * 2 })
evens = doubled.filter(fn(x) { x % 4 == 0 })
print("Even doubles:", evens)  # [4, 8]

# Number methods
pi = 3.14159
rounded = pi.round(2)  # 3.14
sqrt_val = (16).sqrt()  # 4

# JSON processing
data = json_parse('{"name": "Rush", "version": 1.0}')
name = data.get("name")
print("Language:", name)  # "Rush"

Regular Expression Support

Built-in regex support with pattern matching, text processing, and string integration.

  • Regexp object with dot notation methods
  • Pattern matching and extraction
  • Text replacement and manipulation
  • String method regex integration
Try Examples
regex.rush
# Create regex patterns
email_pattern = Regexp("[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}")
phone_pattern = Regexp("\\d{3}-\\d{3}-\\d{4}")

text = "Contact john@example.com or call 555-123-4567"

# Find all matches
emails = email_pattern.find_all(text)
phones = phone_pattern.find_all(text)

print("Found emails:", emails)  # ["john@example.com"]
print("Found phones:", phones)  # ["555-123-4567"]

# Replace with patterns
safe_text = email_pattern.replace(text, "[EMAIL]")
print("Safe text:", safe_text)

# String methods support regex too
has_email = text.matches?(email_pattern)
parts = text.split(phone_pattern)
print("Has email:", has_email)  # true

JIT Compilation (ARM64)

High-performance ARM64 Just-In-Time compilation with adaptive optimization for compute-intensive functions.

  • Three-tiered execution system
  • Hot path detection and profiling
  • ARM64 native code generation
  • Performance monitoring and statistics
JIT Documentation
fibonacci.rush
# Recursive function for JIT demonstration
fibonacci = fn(n) {
    if (n <= 1) {
        return n
    }
    return fibonacci(n - 1) + fibonacci(n - 2)
}

# Execute with different performance modes
print("Tree-walking interpreter:")
# rush fibonacci.rush

print("Bytecode VM:")
# rush -bytecode fibonacci.rush

print("JIT compilation (ARM64):")
# rush -jit fibonacci.rush

# JIT with statistics shows performance gains:
# JIT Statistics:
#   Compilations attempted: 45
#   Compilations succeeded: 12
#   JIT hits: 156
#   Native execution speedup: ~15x

# Call enough times to trigger JIT compilation
i = 0
while (i < 15) {
    result = fibonacci(i)
    print("fibonacci(" + i + ") = " + result)
    i = i + 1
}

Getting started

Rush aims to be straightforward to install and learn. Try building with the language features available.

1

Clone Repository

Download Rush from GitHub and navigate to the project directory

2

Install & Build

Run make install to build and install Rush system-wide

3

Start Coding

Create your first Rush program and run it with rush file.rush

Terminal
# Quick installation
git clone https://github.com/zhubert/rush.git
cd rush && make install

# Start the interactive REPL
rush

# Run with bytecode VM for better performance  
rush -bytecode examples/comprehensive_demo.rush

# Run with JIT compilation (ARM64 only)
rush -jit examples/comprehensive_demo.rush

# Enable debug logging for development
rush -bytecode -log-level=debug your_program.rush

# JIT with performance statistics
rush -jit -log-level=info your_program.rush