Modules and Imports
Sysl organises code into modules. Each source file declares one module; other files import from it by path.
Module declarations
Section titled “Module declarations”module oskit.kernelThe declared module path must match the file’s directory path. The driver validates this at compile time. Files without a module declaration are treated as anonymous and participate in no name mangling.
Imports
Section titled “Imports”import posix.stdlib.{malloc, free} // named importsimport posix.string.* // wildcard importimport posix.io.{open => fopen} // aliased importImports are resolved through module metadata (.smeta) produced by dependent modules and merged into analysis scope.
Visibility
Section titled “Visibility”Declarations are public by default. Prefix a declaration with private to keep it file-local:
private myHelper() -> int = 42 // not exportedmyPublicFunc() -> int = 0 // publicName mangling
Section titled “Name mangling”Functions and global variables defined in a module are mangled with the module path to prevent cross-module collisions:
module std.strings → trim_space → std_strings__trim_spacemodule mylib → helper → mylib__helperModule parts are joined by _, separated from the symbol name by __. Source code always uses the short name; the compiler resolves it to the mangled form.
Never mangled:
mainexternfunctions- builtin functions
- functions in files without a
moduledeclaration - any function whose name matches an
externdeclaration in the current compilation