beta-2.0.0

TON618

A small, fast, friendly programming language — written in C++, shipped as one binary.

Write a .ton file and run it. Classes, arrow functions, f-strings, ranges, a standard library, an HTTP server, a debugger and a REPL — with no dependencies, on Linux, Windows and Android (Termux).

leaderboard.ton
ton.class Player {
    ton.int score = 0
    ton.function init(name) { self.name = name }
    ton.function add(points) {
        self.score += points
        return self
    }
}

ton.let players = ["kuro", "rusher", "natlep"].map(n => Player(n))
players[0].add(30).add(12)
players[2].add(25)

for p in players.sorted(p => -p.score) {
    print(f"{p.name.padEnd(8)} {p.score}")
}

Install

Linux / Termux
curl -fsSL https://raw.githubusercontent.com/kurodaki-dev/ton618/main/scripts/install.sh | bash
Windows
powershell -c "irm https://raw.githubusercontent.com/kurodaki-dev/ton618/main/scripts/install.ps1 | iex"

Then run a script, or type ton618 alone for the interactive REPL.

ton618 hello.ton
ton618                 # REPL
ton618 -e 'print(2 ** 10)'
ton618 --update

What you get

Readable

Declarations say what they hold: ton.int, ton.string, ton.let, ton.const… and errors point at the exact line.

Object-oriented

Classes with fields, methods, init, inheritance and super — plus method syntax on every value: "hi".upper().

Functional

Arrow functions, map/filter/reduce, the pipe operator |>, destructuring, ranges and slices.

Batteries included

Twelve built-in modules: files, HTTP client, JSON, regex, time, random, encoding, paths, strings, math, tensors…

Web-ready

A built-in HTTP server with routes and URL parameters, and an html type for pages — no framework needed.

One binary

No runtime to install: precompiled for Linux, Windows and Termux, with --update, a module installer, a REPL and a debugger.