Docs/Language

Language

Syntax cheatsheet

Compact lookup for keywords, types, and common forms.

Non-normative. Source of truth: RFC-001.

File skeleton

aura
package main

fun main() {
  println("hi")
}

Declarations

FormExample
Functionfun add(a: Int, b: Int): Int { return a + b }
Expr-body funfun double(x: Int): Int = x * 2
Localval x = 1 / var y = 2
Classclass C(var n: Int) { fun f() {} }
Structstruct S(var x: Int) {}
Interfaceinterface I { fun f(): Int }
Implementsclass C() : I { ... } / class Box<T> : I<T>
Enumenum E { A, B }
Generic classclass Box<T>(var v: T) {}
Generic funfun id<T>(x: T): T { return x }
Type aliastype Id = Int
Top-level constconst N: Int = 42
Test@test fun t() { assert_eq(1, 1) }

Types

FormMeaning
Int Bool StringScalars
T?Nullable
Array<T>Array
Result<T, E>Success / error
(T) -> UFunction type (params → result)
T : BoundType param bound

Lambdas (C10 + C12 captures)

aura
val f = (x: Int) => x + 1
val g: (Int) -> Int = (x: Int) => x * 2
val h = (x: Int) => {
  val y = x + 1
  return y * 2
}
// Captures: val Int/Bool/String/class/Array; var Int/Bool by ref (C12m).
val base = 10
val add = (x: Int) => base + x
CaptureMVP rule
val Int / Bool / StringCopy into env (C10h)
val classGC ptr in env; env mark walks roots (C12k)
val ArrayNon-owning {data,len,cap} view (C12l)
var Int / BoolShared mutable box; lambdas share writes (C12m)
var class / Array / String; nested FunNot yet (debts)

Operators (common)

GroupForms
Arithmetic+ - * / %
Compare== != < <= > >=
Logic&& || !
Null?: !!
Rangea..b a..=b

Class == is identity. String content equality uses content compare in the current path; struct/enum equality is restricted in sema.

String helpers (MVP)

FormNotes
s + t / "hi ${name}"Concat; interp desugars to + (idents in ${…})
s.len / s.isEmpty()UTF-8 byte length
s.charAt(i)Byte as Int; OOB throws
s.startsWith / contains / endsWithSubstring search
s.indexOf(sub)Byte index of first match; −1 if missing; empty sub → 0 (C12f)
s.split(sep)Array<String>; empty sep throws; consecutive/trailing seps → empty segments (C12g)
s.trim() / trimStart / trimEndASCII whitespace MVP (' ', \t, \n, \r); owned copy (C12h)
s.toInt()Int?; full-string decimal; no auto-trim; optional +/-; invalid/overflow → null (C12i)
join(parts, sep)std.collections: Array<String> + sep → String; empty → "" (C12j)
s.substring(start, end)Exclusive end; UTF-8 byte indices (C11d)

No embedded NUL in strings. Indices are bytes, not Unicode scalar values.

Process I/O (std.io, C12b–e / C12p)

FormNotes
args(): Array<String>Process argv; [0] = program name; user flags from index 1 (C12b)
readLine(): String?One line without trailing newline; null on EOF (C12d)
readAllStdin(): StringRemainder of stdin (throws on oversize / error)
exit(code: Int)Terminate with status; flushes stdio (C12e)
tryReadFile(path)String? soft file read; null on missing/error (C12p)

Pass process args after --:

bash
aura run path -- flag value
aura test path --

Control

aura
if (cond) { } else if (other) { } else { }

while (cond) { break; continue }

for (i in 0..n) { }
for (i in 0..=n) { }
for (x in xs) { }

match (e) {
  Pattern => { }
}

try { } catch (e: String) { } finally { }
throw "msg"

Packages & imports

aura
package app

import math
import math as M
toml
# aura.toml
[package]
name = "app"
version = "0.1.0"

[dependencies]
math = { path = "../math" }

CLI one-liners

bash
# After install (or with aura on PATH):
aura new hello && aura run hello
aura check path
aura run path
aura run path -- a b
aura build path -o out
aura test path
aura version

# In-tree monorepo:
cargo run -p aura-cli -- run path
cargo run -p aura-cli -- run examples/wc -- file.txt

Next

All docs pages