Language Reference
The Sleela language is a Java-like language compiled by Sleelvac™ and executed on the C/C++ core. This page is the practical reference; the normative documents are COMPILER.md, SOURCE.md, SLEELA.md, STRUCTS.md, and VERSION.md.
Current normative edition: SLeeLa Syntax 3.01 (3.1). The shared Sleela/Sleelvac frontend accepts source syntax 1.0–3.1 and defaults an unversioned source unit to 3.1 with a warning.
#sleela 3.01and#sleela 3.1are the same edition. It adds the character literal and thechartype, the array initializer,a.lengthand multi-dimensionalnew T[a][b], labeledbreak/continue, andreturn/break/continuethroughfinally(sections 44, 45 and 46 of the grammar). The compiler/tool release number is independent of the source syntax edition. SeeSLEELA.syntax.
Java source is specified separately. Everything specific to Java (the Java tier and the Java to SLeeLa conversion) is in the Java Specific Section,
lib/java/JAVA.SPEC.md, summarized in Java-Specific-Section. It is not part of the language reference.
Program structure
A program is one or more class declarations. There are no top-level statements — code lives in methods. Execution starts at a main() method.
#sleela 3.0
class Greeter {
static String who() { return "Sleela"; }
void main() {
print("Hello, " + who() + "!");
}
}
import <module>;lines (native modules //libpackages) come before class declarations.- A class holds fields and methods;
staticmarks class-level members. - Multiple source files can be compiled together as one program (see Compiler commands): a class in one file may use a class or method defined in another.
Keywords & types
Control / declaration keywords: class, interface, enum, record, struct, static, final, abstract, sealed, non-sealed, const, usualmem, accuratemem, public, private, protected, import, native, extends, implements, throws, transient, volatile, strictfp.
usualmem/accuratemem(Sleela memory tiers): modifiers that designate which memory tier a function or program should run against, so the VM routes usual activities to a cheaper tier (e.g. DDR2) and competency/accuracy-critical work to a faster tier (e.g. DDR5).usualmemselects the usual (DDR2) tier;accuratememselects the accurate (DDR5) tier. They compose withpublic/static/finallike any other modifier, and are mutually exclusive by intent; an unmarked declaration inherits the program's main tier (accurate/DDR5 by default). The tiers themselves are designated in an.xltmodel viamemtier "<preset>" usual|accurate;andmaintier "usual|accurate";(seelib/xlt/README.md).
const(Sleela): a developer-intent modifier that declares "I intend to keep this variable constant until the System Design is complete." It combines withpublic/static/finallike any other modifier and is recorded on the declaration's modifier set. Unlikefinal, it is a design-time intent marker, not a hard compile-time immutability guarantee — it signals and documents stability of intent during design, rather than enforcing it.
Extensible-network access semantics (SLExtensibleNetwork)
A program may opt into the extensible-network interpretation, in which the
compiler records — and the VM reads back from the compiled image — a
system-role meaning for public / private / protected, so the VM stands
up a clean System backdrop instead of guessing a file-network topology. The
roles (full catalog in lib/cpu/SLAccessSemantics.sleela):
| Modifier | System role | Meaning |
|---|---|---|
public | exposed hop | The function is exposed like a REST API endpoint and may act as a Hop Controller for a System; a network of files may assume it is reachable. Public members form an ordered hop chain — registered doc 1, doc 2, doc 3 communicate in order 1 → 2 → 3. |
private | local system | Relates to the local System itself or to admin / safety / security / data-backup (also audit, config) concerns; never exposed to the network. |
protected | integrity-guarded | The connection carries inherent safety concerns and applies integrity controls before proceeding: double-input verification, virus scan, system-integrity check, heuristics, admin involvement, database-integrity check (also checksum, rate-limit, schema validation). |
SLExtensibleNetwork is a Dynamite Connector (`initialize → resolve →
[deferConstruction] → load`, fail-closed): register each file's members under
their modifier, resolve() to classify them and order the public hop chain,
load() to realize the backdrop. toManifest() flattens the result into an
SLAccessManifest (the counterpart of SLTimingManifest, MAGIC 5214) that
the compiled SLProgram carries via attachAccess(...); the VM reads it back
(hasAccess() / accessCompetent()) and infers the same backdrop. See
lib/cpu/examples/extensible-network-access.sleela.
VM-side enforcement. The Secondary VM carries the role on each member and
gates resolution by it — the first VM-level access check in the stack:
SLVMMethod / SLVMField carry an accessRole (set via configureAccess(...));
SLVMClass / SLVMModule expose resolveExposedMethod(...) (binds only a
public hop — what a network of files may reach) and `resolveMethodForCaller(...,
callerRole)` (private/protected bind only for a local/in-system caller, never a
network caller). SLVMModuleLoader.finishModuleWithAccess(...) adopts the
manifest so a loaded module honors the stated roles (accessRealized()).
Statement keywords: if, else, while, do, for, switch, case, default, break, continue, return, throw, try, catch, finally, assert, yield, synchronized, print, new, instanceof, this, super, true, false, null.
Types:
| Type | Meaning |
|---|---|
int | 64-bit integer |
double | floating point |
boolean | true / false |
String | text; + concatenates |
void | no return value |
struct types | named aggregates (syntax 1.2+; see STRUCTS.md) |
T[] arrays | dynamic, zero-indexed sequences (see Arrays) |
print(x) writes a line to standard output. + concatenates when either side is a String (Java-like). A built/printed String is not length-capped by the small legacy buffer — large documents (generated HTML, DXF, JSON) build and print whole.
Statements & expressions
int i = 0; // declaration
i = i + 1; // assignment (also += -= *= /= %=)
if (i < 10) { ... } else { ... }
while (i < 10) { i = i + 1; }
do { i = i - 1; } while (i > 0);
for (int k = 0; k < n; k = k + 1) { ... }
switch (code) { case 1: ...; break; default: ...; }
try { ... } catch (e) { ... } finally { ... }
return expr; // (or bare `return;` in a void method)
Operators: arithmetic + - * / %, comparison == != < <= > >=, logical && || !, ternary ?:, instanceof, cast (Type)x, unary -.
&& and || short-circuit (Java/C semantics): the right operand — and any method call or side effect in it — is not evaluated when the left operand already decides the result. For example, in p != null && p.ok() the call p.ok() runs only when p is non-null.
Structs (syntax 1.2+)
A struct is a named aggregate — data, as opposed to a class (code). new Type() builds an instance; .field reads/writes; struct values are reference types reached by a bounded VM handle. structPack / structUnpack move a struct over the wire as JSON. Full detail in STRUCTS.md.
#sleela 1.6
struct Point { int x; int y; }
class Geo {
void main() {
Point p = new Point();
p.x = 3; p.y = 4;
print(p.x + p.y); // 7
}
}
Arrays
A T[] is a dynamic, growable, zero-indexed sequence of values — a first-class type reached by a bounded VM handle (like a struct).
#sleela 1.6
class Demo {
void main() {
int[] a = new int[3]; // three zero/null elements
a[0] = 10; a[1] = 20;
a[2] = a[0] + a[1]; // index write/read -> 30
print(arrayLength(a)); // 3
int n = arrayPush(a, 40); // append; grows -> new length 4
print(a[3]); // 40
print(a); // [10, 20, 30, 40]
}
}
Array built-ins:
| Call | Meaning |
|---|---|
new T[n] / arrayNew(n) | fresh array of n null/zero elements (n may be any runtime int) |
arrayLength(a) | element count (int) |
arrayGet(a, i) / a[i] | element at i (runtime bounds-checked) |
arraySet(a, i, v) / a[i] = v | write element i (runtime bounds-checked) |
arrayPush(a, v) | append v, growing the array; returns the new length |
The #sleela version pragma
The first line may declare the syntax version:
#sleela 1.6
- The compiler accepts 1.3 through 1.6.
- Feature gates: network / file I/O built-ins require 1.1+, structs & struct transport require 1.2+, Synchro / Munction / best-of built-ins require 1.3+ (so they are available across the whole supported range).
- A missing pragma emits a warning and assumes the default (1.6).
- A version newer than the compiler's max, or a malformed pragma, is rejected with a clear diagnostic.
Native modules
Import a native module to call its functions with module.function(...) syntax. The authoritative, importable packages are discovered recursively under /lib; common native-subject modules include:
math, physics, economics, inference, chemistry, financial, plus the standard-library families under /lib (text, collections, ui, codecs, languages, website, autocad, …).
Physics and Economics build on math (declare import math explicitly).
#sleela 1.6
import math;
import economics;
class Model {
static double grow() {
return economics.future_value(1000.0, 0.05, 10.0);
}
void main() { print(grow()); }
}
Financial functions
The financial library lowers financial.* calls to the native math kernels:
future_value, present_value, annuity_present, annuity_future, npv4, bond_price, capm, wacc, determinant2, solve2x2_x, solve2x2_y, quadratic_discriminant, quadratic_root_plus, quadratic_root_minus, ratio.
#sleela 1.6
import math;
import financial;
class Desk {
void main() {
print(financial.future_value(1000.0, 0.05, 10.0)); // 1628.89
print(financial.capm(0.04, 1.2, 0.10)); // 0.112
}
}
Conducted methods (the object catalog)
Sleela exposes the SHEET.sheet catalog as conducted methods — queries over the catalog of common system objects:
| Method | Returns |
|---|---|
insight(Object) | the object's one-line gloss |
role(Object) | the object's conduct role |
congruent(A, B) | whether two objects are directly connectable |
route(A, B) | the connection route between two objects |
sysdepth() | the system depth invariant (3024) |
degreemax() | the max complexity degree (4) |
See impl/examples/conduct.sleela.
Networking & file I/O (syntax 1.1+)
Network built-ins lower to the core socket ABI (LISTEN / ACCEPT / CONNECT / SOCKREAD / SOCKWRITE / SOCKCLOSE):
listen, accept, connect, sockread, sockwrite, sockclose.
File / pipe built-ins: openFile, read, write, close, unlinkFile, pipe, pipePeer, fifoCreate.
See impl/examples/network_echo.sleela and impl/examples/fileio.sleela.
Synchro, Munction, and best-of (syntax 1.3+)
Honest packet measurement and route selection are first-class:
- Synchro —
synchroOpen,synchroDispatch,synchroReport,synchroClose, and the stat readers (synchroMean,synchroLoss, …). - Munction — the reach-composition sentence:
Munction.start(name)then.connect,.enable,.send,.consume,.reception,.close. - best-of —
bestOfNew,bestOfWeight,bestOfCandidate,bestOfBest,bestOfReport, …
See impl/examples/bestof_route.sleela.
Concurrency
The core is thread-friendly; see impl/examples/threads.sleela. spawn(method) runs a zero-arg method on a new thread; join() waits. Threading maps onto the catalog's concurrency objects (Thread, Lock, Future, Join, …), which Nordshrift renders per target.
Time, audio, and codecs
- Time (
SLEELA_TIME_API.md):timeUtcMillis,timeMonotonicNanos,timeHttpDate,timeJson,timeNtp,timeSetLocation, … - Audio (
audio/):audioNew,audioAdd,audioControls,audioValidate,audioRender,audioClose. - Codecs (
codecs/): programs call the Codec Loader / Manager, never an individual codec. The manager loads/unloads codec plugins and dispatches decode/encode; native codecs (PCM/WAV, AIFF, G.711 μ-law/A-law) work in-package, and backend codecs dispatch to a registered library adapter. The SLeeLa-facing handle islib/codecs/SLCodecLoader.
Localization (the languages family)
SLeeLa output and prompts can be presented in a language other than English. The languages/ folder holds dependency-free key = value packs (English, Spanish, French, German, Portuguese, Italian, Japanese, Chinese, Hindi, Korean, Thai, and right-to-left Arabic), chosen via languages/settings.conf; the lib/languages library (SLLanguage, SLLanguageCatalog, SLLanguageSettings) resolves the active locale and returns localized text. String literals accept raw UTF-8, so non-Latin and RTL text round-trips through print.
The .sleela file — a Wrapper™
Every .sleela file is a Wrapper™: the program unit that carries the SL-META-0001 metadocument addend. It also supports a configurable Sigil QR code and a deterministic 248×48 steganographic frame, generated by the dependency-free tool in tools/sigil/. See SLEELA.md.
Compiler commands (Sleelvac™)
sleela run <file.sleela> [more.sleela ...] # compile + run (one or more files, merged)
sleela run <program.sleela> # run a prebuilt Core artifact
sleela run <file.xclass> [more...] # ingest SecureJDK 28 .xclass and run
sleela compile <file.sleela> [more.sleela ...] -o <out.sleela> # persistent runnable artifact
sleela check <file.sleela> # parse/validate only
sleela xclass [--run|--emit|--info] <file.xclass> [more...]
sleela langin [--run|--emit-sleela|--emit-xclass|--info] <file>
sleela nordshrift [--emit] [--target=sleela|java|c] <file.sleela>
sleela version
Both run and compile accept multiple .sleela files, parsed independently and merged into one compilation unit; duplicate definitions across files are reported.
See also
- Nordshrift Sheet Reference — driving builds with
.sst - Writing a Subject — attaching explicit semantics
COMPILER.md,SOURCE.md,VERSION.md,SLEELA.md,STRUCTS.md,NATIVE_API.md