Razen is a modern, efficient programming language designed for building reliable and performant software with clean, readable syntax.
Current Version: v0.1-beta.8
This is the main source code repository for Razen. It contains the compiler, standard library, and documentation.
Latest Update (v0.1-beta.8): Simplified RAJIT optimization system with intuitive -O flag. Level 0 provides baseline performance for debugging, while Level 2 (enabled with -O) delivers 10-15% faster execution through intelligent constant folding, dead code elimination, and strength reduction. The new interface matches industry standards like GCC and Clang for familiar developer experience.
-
Performance: Fast compilation and efficient execution, suitable for system programming, web services, and general-purpose applications.
-
Simplicity: Clean, intuitive syntax that reduces cognitive overhead and makes code easier to read and maintain.
-
Reliability: Strong type system and compile-time checks help catch errors early and ensure program correctness.
-
Productivity: Professional toolchain with comprehensive CLI, clear error messages, and seamless development workflow.
Razen is engineered for efficiency, combining the speed of compiled languages with the productivity of modern syntax. Here's how it performs:
- Optimized Performance: Achieves 10-15% faster execution with the
-Oflag - Efficient Loops: Optimized loop structures for maximum throughput
- Low Overhead: Minimal runtime overhead for consistent performance
- Fast Compilation: Quick build times for rapid development cycles
- Incremental Compilation: Only recompiles changed code for faster iterations
- Constant Folding: Pre-computes constant expressions at compile time
- Dead Code Elimination: Removes unused code for smaller binaries
- Strength Reduction: Replaces expensive operations with faster equivalents
- Memory Efficiency: Predictable memory usage patterns for better cache utilization
- Low Memory Footprint: Efficient memory management for resource-constrained environments
- Scalable Performance: Maintains consistent speed even with large codebases
# 25,000 print operations
$ razen run -O tests/test_25k_prints.rzn
RAJIT execution completed in 0.136s (optimization: standard)Razen's performance characteristics make it suitable for:
- High-performance applications
- System utilities
- Web services
- Embedded systems
- General-purpose programming
curl -sSf https://raw.githubusercontent.com/BasaiCorp/Razen-New/main/install.sh | bash# Download the installer
curl -O https://raw.githubusercontent.com/BasaiCorp/Razen-New/main/install.sh
# Make it executable and run
chmod +x install.sh
./install.shWindows users should use Git Bash to run the installation commands above. Git Bash provides the necessary Unix-like environment for the installation script.
Create a file named hello.rzn:
fun main() {
println("Hello, Razen!")
println("Welcome to modern programming!")
}
Run your program:
razen run hello.rznstruct Person {
name: str,
age: int
}
impl Person {
fun new(name: str, age: int) -> Person {
return Person { name: name, age: age }
}
fun greet(self) {
printlnc(f"Hello, I'm {self.name}!", "green")
}
}
fun main() {
var person = Person.new("Hanuman", 25)
person.greet()
}
fun main() {
var name = "Razen"
var version = "0.1-beta.7"
// Colored output
printlnc("Welcome to Razen!", "cyan")
printc("Language: ", "yellow")
printlnc(name, "bright_green")
// F-string interpolation
println(f"Version: {version}")
printlnc(f"Hello from {name} v{version}!", "#FF6600")
}
fun main() {
// Range iteration
for i in 1..=5 {
printlnc(f"Count: {i}", "blue")
}
// Array iteration
for name in ["Hanuman", "Ram", "Brahma"] {
printlnc(f"Hello, {name}!", "green")
}
// While loops with break/continue
var i = 1
while i <= 10 {
if i == 5 {
i = i + 1
continue
}
if i == 8 {
break
}
println(f"Number: {i}")
i = i + 1
}
}
// math.rzn
pub fun add(a: int, b: int) -> int {
return a + b
}
pub const PI = 3.14159
// main.rzn
use "./math.rzn"
fun main() {
var result = math.add(5, 3)
println(f"5 + 3 = {result}")
println(f"PI = {math.PI}")
}
Razen supports project-based development similar to Cargo and Go modules:
# Create a new project directory
razen create my-app
# Or initialize in existing directory
razen init --name my-appThis creates a razen.toml configuration file:
[project]
name = "my-app"
version = "0.1.0"
description = "A Razen project"
[build]
main = "main.rzn"
src_dir = "src"
optimization = 2
debug = false
[dependencies]
# Add your dependencies here# Build the project (reads razen.toml)
razen build
# Build with maximum optimization
razen build --release
# Build with custom output name
razen build -o my-executable
# Build with specific optimization level
razen build -O 3The build command automatically:
- Reads project configuration from
razen.toml - Finds the main file and source directory
- Scans and compiles all
.rznfiles - Creates a self-contained native executable
- No external dependencies required (no GCC/Clang needed)
After installation, you can use Razen with the following commands:
# Compile and run immediately (like go run)
razen run program.rzn
# Build entire project to executable (like cargo build)
razen build
# Build with release optimizations
razen build --release
# Build with custom output name
razen build -o my-executable
# Development mode with detailed compiler output
razen dev program.rzn
# Create a new Razen file
razen new hello --main
# Create a new Razen project
razen create my-project --template basic
# Initialize razen.toml in existing directory
razen init --name my-project
# Compile single file to native executable
razen compile program.rzn -o myprogram
# Run test files
razen test program.rzn
# Show help
razen --help
# Show version information
razen --versionThe installer performs the following actions:
- Downloads the latest Razen compiler from GitHub
- Installs it to
~/.razen/ - Adds
~/.razen/binto your PATH - Creates a global
razencommand
~/.razen/
├── bin/
│ ├── razen-lang # Main compiler binary
│ └── razen # Symlink for easy access
├── version # Version tracking for updates
└── scripts/ # Additional utility scripts
The installer automatically checks for updates when run again:
./install.shThis will check your current version against the latest release and prompt you to update if a newer version is available.
To remove Razen from your system:
# Remove installation directory
rm -rf ~/.razen
# Remove from PATH (edit your shell profile)
# Remove the line: export PATH="$HOME/.razen/bin:$PATH"- Modern Syntax: Clean, readable code structure with intuitive keywords and professional design
- Static Typing: Compile-time type checking with intelligent type inference and flexible typing modes
- Memory Safety: Automatic memory management with predictable performance characteristics
- Primitive Types: Integers, floats, strings, booleans, characters, and null values
- Complex Types: Arrays, maps, and custom data structures with full type safety
- Structs & Enums: User-defined types with field access and pattern matching support
- Type Conversion: Built-in conversion functions (
toint(),tostr(),tofloat(),tobool())
- Impl Blocks: Rust-like implementation blocks for methods and associated functions
- Method Calls: Dot notation for method invocation with proper
selfparameter handling - Static Methods: Associated functions without
selffor constructor patterns - Member Access: Direct field access and method chaining support
- Conditional Statements:
if,elif,elsewith proper scoping and type checking - Loop Constructs:
whileloops andforloops with comprehensive iteration support - Range Iteration: Both exclusive (
1..10) and inclusive (1..=10) range syntax - Array Iteration: Direct iteration over array literals and collections
- Break & Continue: Full support for loop control with proper nested loop handling
- F-String Interpolation: Python-style string formatting with
f"Hello, {name}!"syntax - Expression Support: Full expression evaluation within f-string braces including dot notation
- String Operations: Concatenation, length calculation, and manipulation functions
- Color Output: Built-in colored printing with
printc()andprintlnc()functions supporting 16+ colors and hex codes
- Module Imports:
usestatements for importing external modules and libraries - Namespace Management: Clean module organization with proper scoping and visibility
- File-Based Modules: Each
.rznfile can be imported as a module - Visibility Control:
pubkeyword for public declarations and controlled access
- Pattern Matching:
matchstatements with comprehensive pattern support - Exception Handling:
try/catchblocks for robust error management - Operator Overloading: Complete operator support including increment/decrement and compound assignment
- Method Chaining: Fluent interfaces with dot notation method calls
- Type Inference: Smart type detection while maintaining compile-time safety
- Professional Error Messages: Clear, helpful diagnostics with suggestions and context
- Debug Mode: Comprehensive development mode with detailed compiler output
- Fast Compilation: Quick build times optimized for rapid development cycles
- Cross-Platform: Native support for Linux, macOS, and Windows
For questions, bug reports, and discussions:
- Check the documentation
- Browse existing issues
- Join our community discussions
We welcome contributions to Razen! To get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes and add tests
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please read our Contributing Guidelines for detailed information about the development process, coding standards, and how to submit patches.
Razen is distributed under the Apache License 2.0. See LICENSE for details.
The Razen name and logo are trademarks of BasaiCorp. Please see our trademark policy for usage guidelines.