AutolangDocs
Active Development

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

With an initialization time of just ~2–4 ms, the total time from script compilation to execution is incredibly small. AI agents can interact with tools and environments in near real-time.
🧡

Strictly Single-Threaded

The Autolang Virtual Machine (AVM) runs entirely on a single thread. This eliminates lock contention and synchronization overhead, maximizing single-core speed. Concurrency is managed entirely by the user at the system level.
βš™οΈ

Unified Execution Engine

The compiler and runtime are bundled together. There is no separate compilation step for embedded systems. AI agents feed raw scripts into Autolang, and it compiles and runs them instantly.
♻️

Deterministic Memory & Hot Restart

Uses Reference Counting instead of unpredictable Garbage Collection. Combined with a Hot Restart architecture, the runtime state is wiped completely clean after each run. No memory leaksβ€”perfect for isolating ephemeral AI-generated code.
πŸ”—

Native Interoperability

Easily expose C++ functions via @native annotations, allowing AI agents to securely interact with file systems, databases, or external APIs.
πŸͺΆ

Minimal Memory Footprint

Autolang is incredibly lightweight. A single 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

Designed to be easily deeply embedded into existing C++ architectures, or directly into Web/Node.js projects via NPM. Check out the Integration Guide to see how effortless it is!

✨ 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) // Chaining

2. 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()) // Meow

4. 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.

WindowsWindows (MinGW / powershell)
$mingw32-make
$if ($?) { mingw32-make run }
LinuxLinux & macOS (Clang)
$clang++ tests/main.cpp -O2 -std=c++17 -I src -o build/autolang
$./build/autolang
πŸ“¦ Node.js / Browser Sandbox
$npm install autolang-compiler
// Install the pre-compiled WebAssembly module for seamless JavaScript/TypeScript integration. Checkout the Integration Guide.

πŸ›  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.