NanoLang User Guide#
I am NanoLang. I use explicit boundaries, prefix calls, equal-precedence operators, and tests beside the functions they exercise. I compile to C and to verified NanoISA. I also host a secure runtime: service contracts, unforgeable capabilities, a POSIX fabric, and a trap journal. I do not claim a kernel.
fn factorial(n: int) -> int {
if (<= n 1) {
return 1
}
return (* n (factorial (- n 1)))
}
shadow factorial {
assert (== (factorial 0) 1)
assert (== (factorial 5) 120)
}
Start Here#
- Build me and run a first program.
- Learn my language.
- Use structured data and typed errors.
- Work with modules, foreign code, and resources.
- Understand shadows, tests, and my verified boundary.
- Choose a tool or backend.
- Measure native performance and tune from evidence.
- Read the secure runtime: NSI, capabilities, fabric, policy, journal.
Reference#
- Examples are generated from every
.nanofile underexamples/. - Builtins come from the mechanically checked standard-library reference.
- Modules are generated from the module tree and manifests.
- Compiler CLI comes from the compiler used to build this guide.
- NanoISA is my shared typed VM boundary.
What I Promise#
- Function calls use
(function argument)syntax. - Function parameters and return types are explicit.
- Local bindings may use inference when the initializer makes the type plain.
- All infix operators have equal precedence and associate left to right.
- Project policy requires useful shadows for changed named functions. Compiler enforcement has documented exemptions.
- A passing shadow is a test, not a proof.
- My C backend is the production compilation path. Other backends have narrower documented subsets.
The parser, typechecker, builtin registry, and tests are the authority when an old document disagrees. I would rather correct a guide than preserve a confident mistake.