Running a script

ton618 path/to/script.ton

Options:

FlagEffect
--debugStart in step-by-step debug mode
--break=<line>Add a breakpoint at a given line (repeatable)
-h, --helpShow usage
-v, --versionPrint the version, auto-detected platform (linux/termux/windows/macos), and architecture
--update [version]Re-download the binary matching this platform from GitHub Releases and replace the running one — the latest release if version (a release tag) is omitted
--uninstall-tonRemove this ton618 install: the binary, its PATH entry, and the current directory's ./modules/ folder (every module previously fetched with install there)

Two more commands, used as ton618 <command> <module> rather than as a flag on a script:

CommandEffect
install <module>Fetch <module> from the TON618 module registry and download its code into ./modules/
uninstall <module>Remove ./modules/<module>.ton (undoes install)

Anything after the script path that isn't one of these flags is passed through to the script itself, readable via sys_args() (see ton.sys).

Example:

ton618 exemples/test.ton --break=10 --break=20
ton618 --update             # update to the latest release
ton618 --update beta-1.0.1  # pin to a specific release tag
ton618 install stringutils   # fetch a module from the registry
ton618 uninstall stringutils # remove it again

The interactive REPL — run ton618 with no arguments (or ton618 repl) to get a prompt where every line runs immediately and the value of an expression is printed back. Unclosed (, [ or { continue on the next line, so you can type a whole function. .vars lists what you defined, .exit (or Ctrl-D) quits.

$ ton618
TON618 beta-2.0.0 (linux/x86_64)
ton> ton.let nums = [3, 1, 2]
ton> nums.sorted().map(n => n * 10)
[10, 20, 30]
ton> f"{len(nums)} items"
"3 items"

One-liners — ton618 -e 'print(2 ** 10)' runs a snippet without creating a file.

Error reports — an uncaught error prints the message, the offending source line, a "did you mean" suggestion for a misspelled name, and — when it happened inside function calls — a short traceback:

Error at line 2: Division by zero.
  --> calc.ton:2
   2 | return a / b
Traceback (most recent call last):
  line 9: called compute()
  line 5: called divide()
  line 2: error raised here

Edit this page on GitHub