Language Overview
Syntax summary, keywords, and literals for the Tish language.
Syntax Summary
Keywords
fn— function declaration (replacesfunction;functionalso 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,typeoftrue,false,null
Literals
- Numbers:
1,1.5,0.5 - Strings:
"hello",'world'(escapes:\n,\r,\t,\\,\",\') —.lengthreturns character count - Booleans:
true,false - Null:
null - Arrays:
[1, 2, 3]—.lengthreturns element count - Objects:
{ x: 1, y: 2 }(plain objects, fixed keys at parse time)
Operators
Control Flow
if (cond) stmt/if (cond) stmt else stmtwhile (cond) stmt/do stmt while (cond)for (init; cond; update) stmt— C-stylefor (let x of arr)— iterate arrays and stringsfor (const x of arr)— iterate with immutable bindingswitch (expr) { case val: stmt... default: stmt }break,continue,return exprthrow expr/try stmt catch (e) stmttypeof expr— returns"number","string","boolean","null","object","function"(Tish uses"null"for null; JS uses"object")void expr— evaluates expr, returnsnull(Tish uses null instead of JSundefined)- Postfix
++/--on identifiers
Blocks: { stmt; stmt } or indentation (tab/space).
Semantics
- Block scope: Variables declared with
let/constare block-scoped. No hoisting. - Immutability:
constbindings 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
- Tish vs JavaScript — Differences and additions from JavaScript
- Syntax — Full syntax reference
- Type Annotations — Optional TypeScript-style types