Nexo

Scripting & Automation
Made Simple

Python-style syntax meets powerful pipelines. Minimal ceremony, maximum productivity. Build scripts, automate tasks, and integrate with C and Python seamlessly.

hello.nx
# Simple and expressive
import fs
import proc

def greet(name):
    return "Hello, " + name + "!"

# Pipeline operator for clean data flow
files = fs.list(".") |> filter(fn(f): f.endswith(".nx"))

print(greet("World"))

Why Nexo?

Designed for developers who value simplicity without sacrificing power.

Fast Execution

Stack-based VM with optimized bytecode. Compile once, run fast with versioned bytecode format.

Clean Syntax

Python-style indentation with colons. No boilerplate, no ceremony. Just write your logic.

Pipeline Operator

Chain operations elegantly with |>. Transform data with functional composition.

C FFI & Python

Load C libraries directly. Call Python scripts and get JSON results. Best of all worlds.

Built-in Linter

Static analysis with strict mode. Catch errors before runtime. Warnings for unused code.

LSP Support

Editor integration with diagnostics and document symbols. Works with VS Code, Neovim, and more.

Installation

Get Nexo running on your system in seconds.

Windows

Download installer

Download .exe

macOS

Intel & Apple Silicon

Download .dmg

Linux

Debian, Ubuntu, Fedora

Download .tar.gz

From Source

Build with Cargo

View Source

Or install via Terminal

Unix/macOS/Linux
curl -fsSL https://nexo.dev/install.sh | sh
Windows PowerShell
irm https://nexo.dev/install.ps1 | iex
Cargo (Rust)
cargo install nexo

Syntax Overview

Familiar and intuitive syntax inspired by Python.

Data Types

# Primitives
num = 42          # Number (f64)
text = "hello"    # String
flag = true       # Bool
empty = null      # Null

# Collections
arr = [1, 2, 3]
map = {"key": "value", "n": 10}

Control Flow

if x > 10:
    print("big")
else:
    print("small")

while i < 5:
    print(i)
    i = i + 1

try:
    risky_operation()
catch err:
    print("Error: " + err)

Functions

def add(a, b):
    return a + b

def greet(name):
    print("Hello, " + name)

# Closures capture by value
def make_counter():
    count = 0
    return fn():
        count = count + 1
        return count

Modules

# Import modules
import fs
import proc as p

# Export functions
export my_function

# Resolution order:
# 1. Relative path
# 2. nexo_modules/
# 3. Parent nexo_modules/

Operators

Arithmetic

+ - * / %

Comparison

== != > >= < <=

Logical

and or not

Pipeline

|>

Examples

Real-world examples showing Nexo's power and simplicity.

File Operations

Read, write, and list files

import fs

# Read file contents
content = fs.read("config.json")

# Write to file
fs.write("output.txt", "Hello, Nexo!")

# List directory
files = fs.list("./src")
for file in files:
    print(file)

Process Execution

Run shell commands

import proc

# Run a command
result = proc.run("ls -la")

# Access output
print(result.out)
print("Exit code: " + str(result.code))

# Check for errors
if result.code != 0:
    print("Error: " + result.err)

Pipeline Operator

Chain operations elegantly

# Transform data with pipelines
numbers = [1, 2, 3, 4, 5]

result = numbers
    |> filter(fn(x): x > 2)
    |> map(fn(x): x * 2)
    |> reduce(fn(a, b): a + b, 0)

print(result)  # 24

C FFI Integration

Call C libraries directly

# Load a C library
lib = ffi_load("mymath.dll")

# Call C functions
result = ffi_call(lib, "add", [10, 20])
print("10 + 20 = " + str(result))

# Supports up to 4 arguments
# extern "C" fn(f64...) -> f64

Python Integration

Run Python scripts

import py

# Run Python script with input
data = py.run("process.py", "input data")

# Python returns JSON via stdout
# Nexo converts to map/array
print(data.result)
print(data.items)

JSON Handling

Parse and stringify JSON

# Parse JSON string
data = json_parse('{"name": "Nexo", "version": 9}')
print(data.name)  # Nexo

# Create JSON string
obj = {"status": "ok", "count": 42}
json_str = json_stringify(obj)
print(json_str)

CLI Commands

Powerful command-line interface for development.

nexo run

Execute a .nx source file or .nxbc bytecode

nexo --emit

Compile to bytecode (.nxbc) without executing

nexo lint

Static analysis with optional --strict mode

nexo repl

Interactive REPL with multiline support

nexo lsp

Language Server Protocol for editor integration