>Tish
HomeDocs

Language Overview

Syntax summary, keywords, and literals for the Tish language.

Syntax Summary

Keywords

  • fn — function declaration (replaces function; function also supported)
  • let — mutable variable declaration (block-scoped)
  • const — immutable variable declaration (block-scoped, error on reassignment)
  • if, else, while, for, return, break, continue, switch, case, default, do, throw, try, catch, typeof
  • true, false, null

Literals

  • Numbers: 1, 1.5, 0.5
  • Strings: "hello", 'world' (escapes: \n, \r, \t, \\, \", \') — .length returns character count
  • Booleans: true, false
  • Null: null
  • Arrays: [1, 2, 3].length returns element count
  • Objects: { x: 1, y: 2 } (plain objects, fixed keys at parse time)

Operators

OpMeaning
+Add (numbers) / concat (strings)
- * / % **Arithmetic (** = exponentiation)
& | ^ ~ << >>Bitwise (32-bit integer semantics)
=== !==Strict equality (no coercion)
< <= > >=Comparison
&& || !Logical
? :Conditional (ternary)
??Nullish coalescing
?.Optional chaining

Control Flow

  • if (cond) stmt / if (cond) stmt else stmt
  • while (cond) stmt / do stmt while (cond)
  • for (init; cond; update) stmt — C-style
  • for (let x of arr) — iterate arrays and strings
  • for (const x of arr) — iterate with immutable binding
  • switch (expr) { case val: stmt... default: stmt }
  • break, continue, return expr
  • throw expr / try stmt catch (e) stmt
  • typeof expr — returns "number", "string", "boolean", "null", "object", "function" (Tish uses "null" for null; JS uses "object")
  • void expr — evaluates expr, returns null (Tish uses null instead of JS undefined)
  • Postfix ++ / -- on identifiers

Blocks: { stmt; stmt } or indentation (tab/space).

Semantics

  • Block scope: Variables declared with let/const are block-scoped. No hoisting.
  • Immutability: const bindings cannot be reassigned (like JavaScript).
  • Strict equality only: === / !==; no loose coercion.
  • No this: Use explicit parameters.
  • No prototypes: Plain objects and arrays; fixed shapes.
  • Closures: Functions capture by name; lexical scope.

Next