Autolang
Autolang is a high-performance, ultra-low latency scripting language written in C++. It is currently in active development, specifically built to serve as a fast, reliable execution engine for AI Agents and dynamic tool workflows.
Important Note: Autolang is not designed to compete with or replace established languages like C++, JavaScript, or TypeScript. Instead, it serves as a highly efficient, lightweight wrapper specifically designed for AI Agents to dynamically bridge and execute tool logic already written in your existing languages.
π Why Autolang for AI Agents?
In the era of autonomous agents, AI needs to generate and execute code on the fly. Traditional environments are often too heavy, too slow to start, or too complex to sandbox. Autolang solves this with a highly specialized architecture:
Ultra-Low Latency
Strictly Single-Threaded
Unified Execution Engine
Deterministic Memory & Hot Restart
Native Interoperability
@native annotations, allowing AI agents to securely interact with file systems, databases, or external APIs.Minimal Memory Footprint
ACompiler instance takes only around ~5MB of RAM on average, meaning you can comfortably run hundreds of isolated sandbox instances concurrently without exhausting system resources.Seamless Integration
β¨ Language Features & Syntax
Autolang offers a modern, expressive, and safe syntax, ensuring that AI-generated scripts are both highly functional and easy to validate.
1. Modern Null Safety & Optional Chaining
Autolang treats null safely by default, preventing unexpected runtime crashes.
class OptionalAccess(var child: OptionalAccess?) {
func hello(value: Int) {
println("Hello world nha ${value}")
}
func get(): Int? = null
}
var a: OptionalAccess?
a?.hello(1) // Safe call
println(a?.get() ?? 100) // Null coalescing (prints 100)
a = OptionalAccess(null)
a!.child = OptionalAccess(null) // Non-null assertion
a?.child?.hello(4) // Chaining2. Rich Collections with Sugar Syntax
Highly optimized generic collections (Array, Map, Set) with elegant literal syntax and higher-order functions.
// Arrays
val arr = <Int>[5, 9, 12, 6, 3, 4]
arr.insert(2, 1)
val popped = arr.pop()
// Maps
val map = <String, Int>{"Apple": 10, "Banana": 20, "Cherry": 30}
map.set("Apple", 15)
println(map.get("Banana")) // 20
// Sets
val set = <Int>{1, 2, 3, 4, 5, 5, 4}
// Functional Paradigms (Filter, Sort, ForEach)
func filterArr(value: Int): Bool = value > 5
val filteredArr = arr.filter(filterArr)3. Strong OOP & Generics
Supports polymorphic inheritance and robust generics for building complex tool architectures cleanly.
class GAnimal {
func sound() = "Nothing"
}
class GCat extends GAnimal {
constructor() { super() }
@override
func sound() = "Meow"
}
// Generic Classes with constraints
class GenericTest<T extends GAnimal>() {
val value: T = T()
func sound() = value.sound()
}
val f = GenericTest<GCat>()
println(f.sound()) // Meow4. Powerful Standard Library
Write system-level tools directly in Autolang. Import standard modules easily for File I/O, Time manipulation, and more.
@import("std/time")
@import("std/file")
val time = Time.now()
if (File.exists("path/to/script.atl")) {
val file = File("path/to/script.atl", FileMode.READ)
func countLine(line: String) {
if (!line.trim().isEmpty()) {
// Process logic
}
}
file.forEachLine(countLine)
file.close()
}
println("Execution Time: ${Time.now() - time} ms")ποΈ Build & Run
Autolang requires a C++17 compatible compiler. Compilation is blazing fast.
mingw32-makeif ($?) { mingw32-make run }clang++ tests/main.cpp -O2 -std=c++17 -I src -o build/autolang./build/autolangnpm install autolang-compilerπ Under the Hood
- Frontend: Hand-written Lexer, Parser, and Compiler ensuring immediate AST generation.
- Backend: Custom lightweight Virtual Machine (AVM) operating strictly on a single thread.
- Memory Management: Highly optimized allocators (StackAllocator, AreaAllocator, ChunkArena).
- Codebase: ~26,000+ lines of pure C++ (
src/).
π Contact & Contribution
Please use GitHub Issues for bug reports, discussions, or feature requests regarding AI Agent tool integration.
