star.mod
star.mod is the project manifest at the root of every StarLang project. It declares the module identity, the StarLang version, the library dependencies, and the config file (if any). The CLI reads it before compiling: it sets up module paths for the compiler and registers the matching native libraries on the VM.
star-lang init creates a minimal one for you.
module star-lang.com/myproject
star 0.1
require ../dev-libs/math v0.1
require ../dev-libs/config v0.1
config config.json
- Lines starting with
#are comments. - Empty lines are ignored.
Directives
| Directive | Form | Description |
|---|---|---|
module |
module <path> |
Project module path — an identifier, not a URL |
star |
star <version> |
StarLang version the project targets |
require |
require <path> <version> |
Declare a library dependency |
config |
config <file> |
Declare the config file loaded by the config module |
require
- The path is relative to
star.mod, or absolute if it starts with/or~. - The last path segment becomes the module name used in
import(../dev-libs/math→import "math"). - The version is recorded for tracking — not enforced yet.
- Only modules listed here are available for native
import.
When you require a library, two things happen at build time:
- The compiler learns the module name and path, so
import "math"resolves andmath.sqrt(x)compiles to anOP_NATIVE_CALLopcode. - The VM registers that library's native functions at startup — no dynamic loading, no string lookup at runtime.
See Modules for import resolution and namespacing rules.
config
Declares the file the config module loads. The path is relative to star.mod, or absolute.
- The host loads this exact file — there is no on-disk guessing. If
configis imported but noconfig <file>is declared, the CLI warns and every getter returns its fallback. - Point it anywhere to switch configurations per build, e.g.
config prod.json. - On
deploy, the declared file is provisioned to the device over the serial link (an SLD SET-CONFIG frame) before the image runs, since the device has no filesystem. It stays resident across runs.
Creating a project
The generated manifest has just module and star; add require and config lines as the project grows.