Show HN: I made a compiler/VM for untrusted scripts

hoansdz1 pts0 comments

Vision and Philosophy - Autolang | Autolang Docs

Docs MenuDocs

Introduction<br>Editor<br>Philosophy & Vision<br>Integration Guide<br>AI Reference<br>Examples<br>Get started<br>Language Guide<br>Syntax<br>Variables<br>Type system<br>Operators<br>Control flow<br>Functions<br>Classes & Inheritance<br>Generics<br>Enums & When<br>Annotations<br>Magic const<br>Exceptions<br>Modules<br>Closures<br>Standard library<br>String<br>Array<br>Set<br>Map<br>File<br>Date<br>Math<br>Regex<br>JSON<br>Runtime / VM<br>Design Notes

Autolang is a scripting language designed for AI to write code safely, quickly, and at low cost while reusing existing functions.

1. Why Autolang Exists<br>In the era of AI Agents, an issue has become increasingly apparent: the vast majority of current tools are designed for humans, not for AI.<br>This creates a paradox. Humans require flexible, feature-rich environments where they can do anything. But AI Agents do not need all that power. When we let AI directly use tools like Python, JavaScript, or other general-purpose runtimes, we hand it an ecosystem that is far too broad: the ability to read, write, and delete files, make network calls, manipulate the system, and perform unintended actions. That flexibility is excellent for humans, but it represents a real risk for AI.<br>To mitigate this risk, developers typically apply language restrictions, permission blocking, sandboxing, or environment isolation via virtualization. However, these methods all share common weaknesses: they are complex, hard to fully control, and strong isolation comes at the heavy cost of system resources — specifically RAM, CPU, and operational overhead.<br>Autolang was born to solve this exact problem.

Autolang is not meant to replace Python or JavaScript. It is an orchestration layer that sits on top of or alongside those languages, allowing you to wrap existing functions from Python, JavaScript, C++, and other ecosystems into a unified, safe, and controlled execution environment.<br>Autolang does not require rewriting tools that already work. Instead, you wrap existing functions — from npm, C++, or any other ecosystem — and expose them to the AI through Autolang bindings. The AI calls only what you register. Nothing else is accessible.<br>In other words, Autolang doesn't try to be a language that can do everything. Autolang acts as a manager.

2. What is Autolang in an AI Agent System?<br>With Autolang, AI is no longer free to directly invoke functions outside its controlled scope. Every action the AI takes must pass through Autolang's static compiler and the rules established by the system.<br>🧩This creates a very clear model:

The AI writes high-level logic.<br>Autolang verifies, restricts, and validates that logic.<br>The actual underlying execution functions can come from Python, JavaScript, C++, or existing libraries.<br>The AI is only permitted to operate within the scope defined by Autolang.

This approach significantly reduces the risks associated with AI-generated code, while preserving the ability to reuse existing software ecosystems.

3. Characteristics of AI-Generated Code<br>Autolang was designed based on the real-world characteristics of code written by AI. Snippets generated by AI typically share the following traits:<br>They are short, usually under 100 lines.<br>They do not require extreme, deep performance optimization.<br>They cannot be fully trusted in terms of safety.<br>They are prone to logical errors such as infinite loops, incorrect data types, null pointer accesses, or wrong API calls.<br>That is the exact class of problems Autolang focuses on solving. Autolang is not optimized for massive, heavy programs. It is optimized for small, frequently-run code snippets that demand safety, strict control, and low total execution time.<br>This also informs the bet Autolang is making: AI doesn't need to write entire monolithic systems, but it can write small fragments of logic reliably — provided the syntax is clear, the semantics are strict, the environment is safe, and the ability to call external functions is tightly controlled. These are exactly the conditions Autolang is built to provide.

4. Performance Mindset: Total Time over Runtime<br>When discussing performance, Autolang doesn't solely focus on runtime. Instead, Autolang prioritizes total time:<br>compile time + runtime<br>The reason is that AI scripts rarely need to run so fast that it justifies a heavy compile-time penalty. If compiling takes a whole second just to deeply optimize a short script, the overall user experience degrades.<br>Therefore, Autolang is designed to strike a balance between compilation speed, compiler intelligence, and execution cost. The goal is to optimize just enough — without unnecessary deep optimizations that add compile cost but benefit long-running programs Autolang is not designed for.<br>According to internal benchmarks in the GitHub src/tests folder, Autolang executes roughly 900 lines of code in ~25ms on Windows 11 with a 12th-gen i5 processor and 16GB RAM. RAM usage for a single compiler instance is approximately 5.1MB (peak ~7MB). Cold start is ~18ms on a warm...

autolang functions code system designed existing

Related Articles