Skip to content

Syntax Overview

Syntax Overview

Thagore uses Python-style indentation for blocks. Every block header ends with : and the body is indented with 2 spaces.

Key rules

  • 2-space indentation — tabs are rejected, and indentation must be a multiple of 2 spaces
  • No semicolons — each statement is one line
  • Conditions require parenthesesif (x > 0): and while (x > 0):
  • Comments use #
  • File extension is .tg

Minimal program

func main() -> i32:
println("Hello, Thagore!")
return 0

Top-level forms

A source file contains top-level declarations only. There are no bare executable statements outside functions.

import std.math as math
const LIMIT: i32 = 10
struct Point:
x: i32
y: i32
func distance(point: Point) -> i32:
return math.abs(point.x) + math.abs(point.y)
func main() -> i32:
return 0

Syntax topics