A-lang is a revolutionary scripting language that brings together the best of modern language design with groundbreaking features like time-travel debugging and reactive variables. Built with Rust for performance and safety.
๐ Portuguรชs | ๐ Documentation | ๐ฏ Examples
Built-in time-travel debugging lets you rewind execution, inspect historical states, and replay code execution from any point. No external debugger needed!
let x = 10;
snapshot; // Take a snapshot
x = x + 5;
rewind 1; // Go back one snapshot
print(x); // Prints: 10Features: snapshot, rewind, checkpoint - Full execution history control built into the language!
Variables are reactive by default - changes automatically propagate through your program like in modern frontend frameworks, but at the language level.
reactive counter <- 0;
computed double <- counter * 2;
counter <- 5; // double automatically becomes 10Features:
- Reactive variables (
reactive x <- value) - Computed values (
computed y <- expression) - Effects (
effect { ... }) - Watch expressions
- Automatic dependency tracking
Create new syntax during runtime! Define DSLs on-the-fly without recompiling.
syntax "unless" {
pattern: "unless COND then BODY",
transform: |cond, body| if !cond then body
}
unless x > 10 then print("x is small")Features:
- Quote (code as data)
- Unquote (evaluate in quote context)
- Runtime macro system
- Custom DSL creation without recompiling
The runtime automatically detects and parallelizes safe operations without manual intervention.
parallel {
let results = [1, 2, 3, 4, 5].map(|x| heavy_computation(x));
}
// Automatically runs on multiple threads!Features:
- Automatic parallelization of safe operations
- Parallel blocks
- Concurrent execution
- Atomic blocks (synchronized)
- Parallel map & filter
Types adapt to their usage context with bidirectional type inference, providing the flexibility of dynamic typing with the safety of static typing.
fn process(x) { // Type inferred from usage
x + 1 // x must be numeric
}
let result = process(42); // Works!Features:
- Bidirectional type inference
- Context-aware type adaptation
- Type constraints
- Flexible yet safe typing
wget https://github.com/A-The-Programming-Language/a-lang/releases/download/v1.0-preview/alang_1.0-preview_amd64.deb
sudo dpkg -i alang_1.0-preview_amd64.debwget https://github.com/A-The-Programming-Language/a-lang/releases/download/v1.0-preview/alang-1.0-preview-linux-x64.tar.gz
tar -xzf alang-1.0-preview-linux-x64.tar.gz
export PATH=$PATH:$(pwd)/alang-1.0-preview-linux-x64# Coming soon via Homebrew
brew install a-langDownload and run A-lang-1.0-preview-Setup.exe
print("Hello, World!")Run it:
alang hello.alOr use the REPL:
alang
> print("Hello, World!")
Hello, World!num1 = float(input("First number: "))
num2 = float(input("Second number: "))
print("Sum: " + str(num1 + num2))
print("Product: " + str(num1 * num2))// Load math library
ffiLoadLibrary("libm", "/lib/x86_64-linux-gnu/libm.so.6")
// Square root
ffiRegisterFunction("sqrt", "double", ["double"])
print(ffiCall("libm", "sqrt", [16.0])) // 4.0
// Power
ffiRegisterFunction("pow", "double", ["double", "double"])
print(ffiCall("libm", "pow", [2.0, 8.0])) // 256.0total = 0
for (i in range(5)) {
total += i
snapshot("step_" + str(i))
}
print("Final: " + str(total))
// Go back and inspect
rewind("step_2")
print("At step 2, total was: " + str(total))reactive counter = 0
computed doubled = () => counter * 2
computed squared = () => counter * counter
effect () => {
print("Counter: " + str(counter))
print("Doubled: " + str(doubled))
print("Squared: " + str(squared))
}
counter = 5
// Automatically prints:
// Counter: 5
// Doubled: 10
// Squared: 25app = createExpressApp()
app.get("/api/hello", fn(req, res) {
res.json({"message": "Hello, World!"})
})
app.post("/api/echo", fn(req, res) {
body = req.body
res.json(body)
})
print("Server running on http://localhost:3000")
app.listen(3000)// Variables
name = "Alice"
age = 30
active = true
// Functions
fn greet(name) {
return "Hello, " + name + "!"
}
// Arrow functions
double = (x) => x * 2
add = (a, b) => a + b
// Control flow
if (age >= 18) {
print("Adult")
} elif (age >= 13) {
print("Teen")
} else {
print("Child")
}
// Loops
for (i in range(10)) {
print(i)
}
while (count < 100) {
count++
}
// Arrays
numbers = [1, 2, 3, 4, 5]
print(numbers[0])
// Objects
person = {
name: "Alice",
age: 30,
city: "NYC"
}
print(person.name)// Math
abs(-5), min(1,2,3), max(1,2,3)
floor(3.7), ceil(3.2), round(3.5)
// Strings
len("hello"), split("a,b,c", ","), join(["a","b"], ",")
toUpperCase("hello"), toLowerCase("WORLD")
// Arrays
push(arr, item), pop(arr), slice(arr, 0, 5)
indexOf(arr, item), includes(arr, item)
// Type conversion
int("42"), float("3.14"), str(123)
// I/O
input("Prompt: "), print("Output")
readFile("data.txt"), writeFile("data.txt", content)
// System
sleep(1000), timestamp(), exit(0)Replace Bash/Python scripts with modern syntax and better debugging.
Build REST APIs, WebSocket servers, and microservices.
Control hardware with GPIO, I2C, SPI, and UART support.
Access C libraries directly via FFI for low-level operations.
Process files, APIs, and databases with reactive pipelines.
Build CLIs and TUIs with built-in input and rich formatting.
A-lang Architecture
โโโ Lexer (Logos) - Tokenization
โโโ Parser (Chumsky) - AST generation
โโโ Interpreter (Rust) - Execution engine
โโโ Time-Travel Debugger - Snapshot management
โโโ Reactive System - Dependency tracking
โโโ FFI Layer (libloading) - C interop
โโโ Standard Library - 80+ functions
โโโ Backend (Axum/Hyper) - HTTP/WebSocket
โโโ IoT Module - Hardware abstraction
Built with Rust for:
- Memory safety
- Zero-cost abstractions
- Blazing fast performance
- Fearless concurrency
- Startup Time: ~50ms
- Execution: 1M+ operations/sec
- Memory: ~10MB base + script size
- FFI Overhead: ~50-100ns per call
| Platform | Status | Features |
|---|---|---|
| Linux (x86_64) | โ Full | All features including FFI |
| macOS (Intel/ARM) | โ Full | All features including FFI |
| Windows 10/11 | All except FFI (coming soon) | |
| Raspberry Pi | ๐ Coming | IoT features optimized |
hello.al- Hello worldinput_demo.al- User input examples โญ NEWffi_demo.al- FFI C function calls โญ NEWreactive_counter.al- Reactive variablesrest_api_example.al- HTTP serveriot_complete_example.al- IoT features- And more...
- Math: abs, min, max, floor, ceil, round
- String: len, split, join, replace, trim
- Array: push, pop, slice, indexOf, includes
- File I/O: readFile, writeFile, appendFile
- Network: httpGet, httpPost, fetch
- System: exec, getEnv, timestamp
- Database: MySQL support
- IoT: GPIO, I2C, SPI, UART
- โ Windows FFI support
- โ ARM/Raspberry Pi builds
- โ Package managers (brew, apt)
- โ More FFI type signatures
- โ Performance improvements
- ๐ฎ Async/await syntax
- ๐ฎ Module system
- ๐ฎ Standard library expansion
- ๐ฎ Better error messages
- ๐ฎ Language Server Protocol (LSP)
- ๐ฎ IDE integrations (VS Code, Vim)
- ๐ฎ Debugger protocol
- ๐ฎ Production stability
We welcome contributions! Here's how:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
See CONTRIBUTING.md for details.
MIT License - see LICENSE file.
- Familiar JavaScript-like syntax
- Powerful debugging with time-travel
- Interactive REPL
- Rich error messages
- Reactive programming built-in
- FFI for C integration
- Full-stack capabilities
- IoT ready
- Rust-powered execution
- Native compilation
- Zero-cost abstractions
- Fast startup
- Scripting to system programming
- Web backends to IoT devices
- Data processing to automation
- Everything in between
- GitHub: github.com/A-The-Programming-Language/a-lang
- Discussions: GitHub Discussions
- Issues: Report bugs
- Twitter: @alang_dev
Built with these amazing technologies:
- Rust - Systems programming language
- Logos - Lexer generator
- Chumsky - Parser combinator
- Tokio - Async runtime
- Axum - Web framework
- libloading - Dynamic library loading
- ๐ Documentation - Complete language reference
- ๐ฏ Examples - 15+ working examples
- ๐ง Building from Source - Compile yourself
- ๐บ๏ธ Roadmap - Future plans
# Install
sudo dpkg -i alang_1.0-preview_amd64.deb
# Run REPL
alang
# Try examples
alang examples/input_demo.al
alang examples/ffi_demo.al
alang examples/reactive_counter.al
# Write your first script
echo 'print("Hello from A-lang!")' > hello.al
alang hello.alBuilt with โค๏ธ by the A-lang team
"The future of scripting is here, and it can time-travel."
Version: 1.0-preview | Released: December 2024 | License: MIT# a-lang
