Nebula

Nebula is a compiled, high-performance scripting language designed for modern development. It combines Python's readability with the speed of compiled languages.

At a Glance

fn main() do
    perm users = ["Alice", "Bob", "Charlie"]
    
    each user in users do
        log("Hello,", user)
    end
    
    perm total = sum_range(1, 100)
    log("Sum 1-100:", total)
end

fn sum_range(start, finish) do
    total = 0
    for i = start, finish do
        total = total + i
    end
    give total
end

Core Philosophy

PrincipleImplementation
ReadabilityPython-like syntax, do...end blocks
Safetyempty instead of null, on/off for booleans
PerformanceNanBoxed values, bytecode VM, peephole optimization
SimplicityMinimal keywords, consistent rules

Key Features

State Logic

Replace confusing true/false with clear on/off:

perm server_active = on
perm maintenance_mode = off

if server_active and !maintenance_mode do
    log("Accepting connections...")
end

Safe Null Handling

empty explicitly represents absence of value:

fn find_user(id) do
    if id == 0 do
        give empty
    end
    give {"name": "User " + id}
end

perm user = find_user(0)
if user == empty do
    log("User not found")
else
    log("Found:", user["name"])
end

High Performance

Up to 4x faster than Python:

OperationNebulaPython
Fibonacci(28)0.05s0.20s
1M iterations0.15s0.45s
String ops0.08s0.12s

First-Class Functions

Functions are values you can pass around:

fn apply_twice(func, value) do
    give func(func(value))
end

fn add_five(x) = x + 5

log(apply_twice(add_five, 10))  # 20

Pattern Matching

Clean switch-like syntax:

fn http_status(code) do
    match code do
        200 => give "OK",
        201 => give "Created",
        400 => give "Bad Request",
        404 => give "Not Found",
        500 => give "Server Error",
        _ => give "Unknown",
    end
end

Error Handling

Robust try-catch-finally:

try do
    perm data = load_file("config.json")
    process(data)
catch err do
    log("Error:", err)
    use_defaults()
finally do
    cleanup()
end

Language Overview

Types

TypeKeywordExample
Integerint42
Floatfl3.14159
Stringwrd"hello"
Booleanboolon, off
Listlst[1, 2, 3]
Mapmap{"key": "val"}
Nullnilempty

Control Flow

# Conditionals
if condition do
    # ...
elsif other do
    # ...
else
    # ...
end

# Loops
while condition do ... end
for i = 0, 10 do ... end
each item in list do ... end

Functions

# Standard
fn greet(name) do
    log("Hello,", name)
end

# Short form
fn double(x) = x * 2

# Closure
fn counter() do
    count = 0
    give fn() do
        count = count + 1
        give count
    end
end

What's Next?

  1. Installation - Get Nebula running
  2. CLI Reference - Command-line usage
  3. Basics - Variables and types
  4. Functions - Reusable code
  5. Advanced - Structs, async, modules

Community

  • GitHub: github.com/Sxf0z/Nebula
  • Issues: Report bugs and request features
  • Discussions: Ask questions and share projects

Built with 💜 and Rust