Hades is a programming language created by Toby Paradise as a passion project. It combines the familiar curly-brace syntax of C-family languages with static type hints and an interpreter written entirely in Python. Whether you want to explore language internals, experiment with a clean scripting syntax, or study how interpreters are built, Hades offers a focused and readable foundation.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ToberlerOhn/hades/llms.txt
Use this file to discover all available pages before exploring further.
What Is Hades?
Hades is an interpreted, statically-typed language with C-style syntax. Source files use the.hds (primary) or .hd (alternate) extension and are executed by passing them directly to the Python-based runtime:
Hades is a passion project and an evolving language. Some advanced features (such as classes and structs) are defined in the grammar but may be partially implemented in the current interpreter.
Key Language Features
Type System
Hades variables must be declared with a type hint. The following primitive and complex types are supported:| Type hint | Description | Example literal |
|---|---|---|
int | Integer number | 42 |
float | Floating-point number | 3.14 |
bool | Boolean value | TRUE, FALSE |
str | String | 'hello' |
list | Mutable ordered sequence | [1, 2, 3] |
nothing | Absence of a value (like null) | (no initializer needed) |
nothing:
Functions and Closures
Functions are declared with thefunc keyword, typed parameter list, and a => ReturnType annotation. The => symbol is also used as the return statement inside the body:
Classes
Classes act as constructors or templates for objects. They support three kinds of members:creator— an initializer method called automatically when an instance is created (named identically to the class).method— a regular instance method.operator— overloads a built-in operator for instances of the class.
my. is used to reference instance variables and methods (similar to this or self in other languages):
Structs
Structs aggregate multiple named fields of potentially different types into a single value. They are defined as a template and instantiated separately, either positionally or by name:Lists and Records
Hades provides two sequence types:list— a mutable sequence accessed with the->index operator (scores->0). Thelisttype hint is fully implemented.record— an immutable sequence defined with double-quoted comma-separated values ("a, b, c"), accessed withrecord"index". Attempting to mutate a record raises aTypeError. Records are described in the language grammar but do not yet have a type-hint token in the interpreter; record syntax is planned for a future release.
Control Flow
Hades supports a full suite of control flow constructs:| Construct | Syntax |
|---|---|
| Conditional | if (cond) { } else if (cond) { } else { } |
| While loop | while (cond) { } |
| Do-while loop | do { } while (cond); |
| C-style for loop | for (i: int = 0; i < n; i++) { } |
| For-in loop | for (x: int; x in list) { } |
break (exit a loop), next (skip to the next iteration), and _goTo label (jump to a named label), but these keywords are not yet tokenised or handled by the interpreter — they are planned for a future release.
Built-in Functions
The interpreter ships with three built-in functions:| Function | Signature | Description |
|---|---|---|
print | print(a, b, ...) | Prints all arguments concatenated with no separator |
type | type(value) | Returns the Hades type name of a value as a string |
len | len(value) | Returns the length of a str or list |
The Interpreter Pipeline
Every.hds file passes through three stages before any output is produced:
Lexer
The Lexer (
modules/lexer.py) reads raw source text character-by-character and produces a flat list of typed Token objects — keywords, identifiers, literals, operators, and punctuation.Parser
The Parser (
modules/parser.py) consumes the token stream and builds an Abstract Syntax Tree (AST) composed of typed node objects (e.g. VarDeclNode, FuncNode, IfNode). Structural errors such as mismatched brackets or missing semicolons are raised here as SyntaxError.-v / --verbose flag to print the raw token list and AST between the parse and interpret stages — useful for debugging or learning how the pipeline works:
VS Code Extension
The repository includes a VS Code extension in thehades-language/ directory (publisher: tobyp, display name: Hades Language Support). It provides syntax highlighting for .hds and .hd files. See the Installation guide for instructions on installing it as a local extension.
Where to Go Next
Quickstart
Write and run your first Hades program in minutes.
Variables & Types
Deep dive into type hints, declarations, and truthiness rules.
Functions
Learn closures, return types, and function definitions.
Built-in Reference
Complete reference for
print, type, and len.