⚔️ Jarlang Syntax Reference
What is Jarlang?
Jarlang is a small, warrior-themed expression language and learning interpreter implemented in Java. It uses themed keywords (forge, wield, chant, summon, judge, lest, mend) and provides familiar arithmetic, control flow, functions, and a small standard library.
💬 Have feedback or found an issue?
Submit a bug report or feature request →
Submit a bug report or feature request →
Lexical Elements
- Comments: # single-line comment
- Identifiers: Letters, digits, and _, must start with a letter
- Strings: "Hello"
- Numbers: 42, 3.14
- Tokens:
- Arithmetic: + - * / ^
- Comparison: == != < > <= >=
- Assignment: =
- Grouping: ( ) { }
- Delimiters: , : ;
Themed Keywords
- wield — declare a variable (wield x 10)
- forge — begin a function definition (forge add(a, b) ...)
- mend — return from a function or end a single-line judge branch
- chant — print/output expression
- summon — import another .vase file
- judge — if/conditional branch
- orjudge — else-if/chained conditional branch
- lest — while loop
- gather/disperse — parentheses (internal naming)
Statements & Control Flow
- Variable declaration: wield x 10
- Assignment: x = x + 1
- Print: chant "Hello"
- Blocks: { ... } for grouped statements
- If / elif / else:
- judge x > 0 mend ...
- orjudge x == 0 mend ...
- orjudge mend ...
- While loop: lest i < 5 { ... }
judge x > 0 mend
chant "positive"
orjudge x == 0 mend
chant "zero"
orjudge mend
chant "negative"
Functions
- Define:
- Return:
- Call:
forge add(a, b) {
mend a + b
}
mend result
chant add(2, 3)
Importing External Files
Importing: summon "[filename]"
summon "stdlib.vase"
chant commune(3, 4) # 7.0
Examples
Conditional and loops:
wield n 5
judge n <= 1 mend
chant "trivial"
orjudge mend
wield i 0
lest i < n {
chant i
i = i + 1
}