Skip to content

Language Overview

Language Overview

Thagore is a statically typed compiled language with indentation-based blocks, nominal structs, compile-time generics, a native LLVM backend, and a package workflow built around drago. The current compiler also supports a browser interpreter for the playground, but the language reference on this page describes the source language itself.

A minimal program

func main():
println("Hello, Thagore!")

main can omit an explicit return type. In that case, the compiler infers void if the function has no explicit return value.

Files and modules

A Thagore source file is a sequence of top-level declarations:

  • import
  • const
  • let
  • struct
  • impl
  • func
  • intent
  • flow
  • extern func

Example:

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

Execution model

The native compiler pipeline is:

  1. lex source into tokens
  2. parse into an AST
  3. typecheck and resolve generics
  4. lower to IR
  5. emit LLVM IR, object code, and a native binary

The playground uses the same parser and typechecker, then executes through a tree-walking interpreter instead of LLVM code generation.

Current language surface

The current codebase supports:

AreaStatus
Indentation-based blocksshipped
i32, i64, f64, bool, str, void, ptrshipped
Top-level constshipped
Functions with inferred return typesshipped
Generic functions with Ordered, Eq, Numeric constraintsshipped
Structs and impl blocksshipped
Generic struct and generic impl surface syntaxparsed, but not fully available end to end
Imports, aliases, from ... import ..., include all, relative importsshipped
intent and flow syntaxshipped
Builtin print, println, eprint, eprintln, flushshipped
  • Syntax for indentation, comments, and operators
  • Types for primitive and composite types
  • Functions for return inference and generics
  • Imports for module resolution rules