Autolang Programming Language

3 min read Original article ↗

Active Development

A statically-typed scripting language and VM for sandboxed execution of AI-generated code. Wrap your existing functions as bindings, and let the AI call only what you allow — nothing more.

Why Autolang?

General-purpose runtimes expose too much surface area for AI-generated code — file I/O, network access, arbitrary imports. Restricting them after the fact is complex. Docker and MicroVM isolation work, but carry real overhead per instance.

Autolang takes a different approach: a minimal VM where scripts can only call explicitly registered functions. Static analysis catches type errors before execution. Opcode limits terminate runaway scripts without crashing the host.

Static typing

Type errors are caught at compile time, before the script ever runs. Wrong API calls and mismatched types are rejected upfront.

Opcode limiting

Set a hard cap on opcodes per script. Infinite loops and runaway logic are terminated immediately — the host process is unaffected.

Null safety

Nullable types must be handled explicitly with the ?? operator. AI scripts can be restricted from using nullable types or lateinit entirely.

Per-library permissions

Each registered library gets its own set of allowed language features. System libraries stay flexible; AI-generated code operates under stricter rules.

Native bindings

Wrap existing JS or C++ functions via @native. No need to rewrite existing code — just expose what the AI is allowed to call.

Low overhead

~4.2MB RAM per compiler instance (native), ~18ms warm start. Designed to run many concurrent agents without the memory cost of full runtime isolation.

Language Syntax

Autolang uses Kotlin-inspired syntax so AI models can write it without learning an unfamiliar language. Every syntax decision is made to assist the AI — explicit where clarity is needed, concise where context is sufficient.

Null safety

class User(var name: String?) var user: User? = null println(user?.name ?? "Anonymous") user = User(null) println(user?.name?.size() ?? 0)

Collections

Explicit type declaration on creation prevents data-type mismatches. Once the type is inferred, the shorthand form is sufficient.

val scores = <Int>[10, 20, 30] scores.insert(0, 5) val filtered = scores.filter {|v: Int| v > 10} println(filtered)

Classes and inheritance

class GAnimal { func sound() = "..." } class GCat extends GAnimal { constructor() { super() } @override func sound() = "Meow" } val pet: GAnimal = GCat() println(pet.sound())

Under the hood

  • Engine: Custom C++ VM designed for single-threaded throughput.
  • Memory: Reference counting + hot restart — memory resets to a clean state after each execution instead of relying on garbage collection.
  • Safety: Per-run opcode limiting and strict memory boundary checks.
  • Portability: Compiles to native binaries or Wasm for Node.js and browser environments.
  • Host environments: Node.js (npm) and C++ currently supported. Python bindings are planned.

Performance

Windows 11, i5 12th Gen, 16GB RAM

Cold start (native)~10ms

Cold start (npm)~20ms

RAM per instance (native)~4.2MB

RAM per instance (npm)~12MB

~900 lines of code~25ms compile + run

Contributing

Autolang is open source. Bug reports and pull requests are welcome, especially for npm wrappers and embedding APIs.