Quick Start
Janus Quick Start
Section titled “Janus Quick Start”Welcome to Janus :core — the foundational profile that teaches systems programming with radical honesty. No magic, no hidden costs, just pure computational thinking.
Installation
Section titled “Installation”# Clone the compilergit clone https://git.sovereign-society.org/janus/janus-lang.gitcd janus-lang
# Build (requires Zig 0.16.x)zig build
# Run your first program./zig-out/bin/janus run examples/hello.janYour First Program
Section titled “Your First Program”Create hello.jan:
func main() do println("Hello, Monastery!")endRun it:
janus run hello.janWhat you learned:
funcdeclares a functionmain()is the entry pointprintln()prints to stdout (built-in)
Variables & Types
Section titled “Variables & Types”func main() do // Immutable binding (preferred) let x = 42 let pi = 3.14159 let is_learning = true
// Mutable binding (when needed) var count = 0 count = count + 1
println("Count: ") print_int(count)endTypes in :core:
| Type | Description |
|---|---|
i32, i64 | Signed integers |
f64 | 64-bit floating point |
bool | Boolean (true / false) |
void | No return value |
Control Flow
Section titled “Control Flow”If/Else
Section titled “If/Else”func check_sign(x: i32) do if x > 0 do println("Positive") else if x < 0 do println("Negative") else println("Zero") endendFor Loops
Section titled “For Loops”func count_to_ten() do for i in 0..10 do print_int(i) endendPattern Matching
Section titled “Pattern Matching”func describe_number(n: i32) do match n { 0 => println("zero"), 1 => println("one"), 2 => println("two"), _ => println("something else"), }end::: tip SPEC-017 Law 2
match, enum, struct use { }. Control flow (func, if, for, while) uses do..end. This is law.
:::
Functions
Section titled “Functions”// Function with return valuefunc add(a: i32, b: i32) -> i32 do return a + bend
// Recursive functionfunc factorial(n: i32) -> i32 do if n <= 1 do return 1 end return n * factorial(n - 1)endAll function signatures MUST have explicit types.
Error Handling
Section titled “Error Handling”Janus uses Zig-style error unions — errors as values, not exceptions:
func divide(a: i64, b: i64) !i64 do if b == 0 do fail DivisionByZero end return a / bend
func main() do let result = divide(10, 0) catch |err| do println("Error: division by zero") 0 end print_int(result)endKeywords:
!T— error union return typefail— return an errorcatch— handle an errortry/?— propagate an error
Native Stdlib First
Section titled “Native Stdlib First”Janus compiles through Zig, but normal .jan code should still look like Janus.
Prefer native Janus modules and generated wrappers first:
use std.collections as collections
func main() do let numbers = collections.new_vector() _ = numbersendUse use zig only at an explicit boundary:
- bridge modules such as
use zig "std/bridge/process_bridge.zig" - compiler-generated wrappers
- narrow interop shims you intend to isolate and replace later
Raw use zig "std/..." across ordinary application modules is migration debt, not the target style.
Memory Management
Section titled “Memory Management”In :core, memory is explicit whether it comes from a native Janus module or a bridge.
Golden rules:
- Every
initneeds adeinit - Use
deferfor automatic cleanup - No garbage collection, no magic
What :core Does NOT Have
Section titled “What :core Does NOT Have”The :core profile intentionally excludes:
| Feature | Available In |
|---|---|
| Concurrency (spawn, channels) | :service |
| Async/Await | :service |
| Actors, supervision trees | :cluster |
| GPU/NPU kernels | :compute |
| Raw pointers, unsafe | :sovereign |
Why? To teach fundamentals without overwhelming complexity.
Next Steps
Section titled “Next Steps”- [Profiles System]/learn/profiles/ — Understand the capability ladder
- [Why Janus?]/learn/introduction/ — The philosophy and design
“The Monastery teaches fundamentals. Master :core, understand all of Janus.”