Modules
AutoLang uses a compile-time module system based on the @import(string) directive. Modules can reference either built-in standard libraries or local files.
Import Syntax
The argument must be a string literal known at compile time. The import annotation must be declared at the top level of the file, outside any class or function definition.
@import("./utils")
@import("../core/math")Standard Library
Built-in libraries are imported using the std/ prefix. These modules are resolved internally and do not correspond to physical files. Core types like Array, Map, and Set are available by default — no import required.
val a: Array<Int> = Array<Int>()
println(a)Example built-in modules:
std/vmstd/timestd/mathstd/jsonstd/httpstd/regexstd/date
Local File Imports
Local modules are resolved relative to the current file using ./ and ../. The compiler resolves these paths during compilation and merges module contents into the current compilation unit.
@import("./helpers")
@import("../models/user")Example Project Structure
project/
├── main.atl
├── utils.atl
└── models/
└── user.atlIn main.atl:
@import("./utils")
@import("./models/user")
fun main() {
println("Program started")
}Module Behavior
The module system is intentionally simple. It avoids runtime overhead and keeps compilation deterministic.
- Imports are processed at compile-time.
- No runtime module loading.
- No dynamic imports.
- Import paths must be string literals.
