Syntax
Synsema reads like prose. Blocks are defined by indentation (4 spaces or 1 tab) — there are no curly braces.
Coming from Python? Read Python → Synsema — the translation table first — it maps the Python reflexes to these forms and flags the semantic traps (doctested).
-- Doc example: core syntax. Universal code; English comments.
intent: "doc example: variables, operators, pipe, inline conditional"
task double(n)
give n * 2
print("5 |> double = " + text(5 |> double)) -- run shows: 5 |> double = 10
test "let / set / arithmetic"
let x be 10
set x to x + 5
assert_eq(x, 15)
assert_eq(10 % 3, 1)
test "comparison + boolean logic"
assert(1 < 2 and 2 <= 2)
assert(true or false)
assert(not false)
test "pipe is unary application: x |> f == f(x)"
assert_eq(5 |> double, 10)
test "inline conditional is an expression"
let label be when 80 >= 50 then "pass" otherwise "fail"
assert_eq(label, "pass")
Variables
let name be value introduces a binding; set name to value reassigns it.
Operators
- Arithmetic:
+-/%. Division is always float* (10 / 3→3.333…). - Comparison:
==!=<><=>=. - Logic:
andornot. ⚠️and/ordo not short-circuit — both sides always evaluate. The boolean result is correct, butcontains(m, "k") and m["k"] == 1still errors withMap has no key 'k'when the key is absent (the index runs even thoughcontainssaid no). Guard with a nestedwheninstead, and never rely onorto skip a side effect. - Pipe
|>is unary application:x |> fmeansf(x)(wherefis a task name or a one-argument lambda). For multiple args, wrap it:xs |> ((v) => f(v, extra)).
Inline conditional
when cond then a otherwise b is an expression (usable inside let, a map, or a call), distinct from the when block statement.
Strings
"..."/'...'— single-line, with escapes (\n,\t,\"). A literal newline inside is an error.- `
...— multiline + interpolation:Hello {name}evaluates{expr}`. Ideal for SQL/HTML.
Comments
-- a comment runs to end of line.