We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Tempestissimo

From Esolang
Jump to navigation Jump to search

Tempestissimo (pronounciation: [ˌtempes'tisːimə], means "most stormy" in Italian) is yet another programming language designed by PSTF.

Its main inspiration comes from the same author's FlamePL and the StormLang he co-created with None1 and islptng.

Identity & Philosophy

Tempestissimo (Italian: "most tempestuous") is a dynamically-typed, garbage-collected, object-oriented scripting language with:

  • Exact numeric tower — unbounded integers, 30-digit fixed-scale decimals (no binary floats anywhere), and complex numbers built on top of decimals.
  • Readable word-logic — and / or / not / xor for boolean logic; symbolic & | ` ~ << >> reserved strictly for bitwise work. No duplicated symbols anywhere.
  • Arrow assignment — <- binds, = compares. Ambiguity between the two is structurally impossible.
  • Closures, lambdas, recursion, classes — Smalltalk-style message ergonomics with a Python-sized surface area.
  • Batteries included — math, string, os, time, random, io, json.

Design motto: "Accuratio ubi refert, expressio ubique alibi."

Syntax Handbook

Lexical Structures

1. Comments

# The interpreter will automatically ignore lines that start with a hash,
#* Or texts wrapped in hash-asterisk pair. *#

2. Identifier

A valid identifier can be matched by the regular expression [A-Za-z_][A-Za-z0-9_]*. The letters don't have to be Latin letters—they can be Greek, Cyrillic, Armenian, Georgian Mkhedruli, Georgian Asomtavruli, Old Norse, or even Chinese characters, Japanese kana, Korean Hangul, Vietnamese Nôm, and even Egyptian hieroglyphs, as long as they are letters and not special symbols.

3. Keywords

let const fn class extends static operator
if elif else while for in break continue return
try catch finally throw
import from as
true false null
and or not xor
this super
is
match case default

4. The arrow-disambiguition rule

The lexer emits ARROW for <-. Therefore a < -1 must be written with a space: a < -1. a<-1 is a syntax error (a assigned 1). The parser reports a friendly hint when this happens.

5. Literal Examples

Integer

42
-7
1_145_141_919_810
0x0000007F
0o77777777
0b11111111

Decimal

3.1415926
0.00001
-35.2352
5.1E-5
7.0

Boolean

True/False

Null

Null

String

"hi"
'hi'
"""multi\nline"""
f"x={x}"
r"raw\path"

List

Anything seperated by commas and enclosed by brackets.

Dictionary

Anything in the form of k: v seperated by commas and enclosed by braces.

Pair

Must two things seperated by commas and enclosed by parentheses. Format: (1st, 2nd)

(a, b) is the only parenthesised literal — it is an OrderedPair. Arity ≠ 2 inside bare parens is a syntax error; use a list for n-tuples. Multiple returns are packed into a Pair.

6. Statement termination

Newline-terminated. Semicolon is legal as a separator but never required.

Type System

Dynamic, with nominal classes for user types and a fixed built-in tower:

Int  →  Dec  →  Complex          (numeric promotion order)
Bool, Null, String, List, Dict, Pair
Function, Class, Instance, Module, BoundMethod
Exception (hierarchy root)

1. Type Names

Type	Description
Int	Arbitrary-precision signed integer
Dec	Fixed-scale decimal: 30 digits after the point, unbounded integer part, rounding mode HALF_EVEN by default
Complex	real: Dec, imag: Dec
String	Immutable UTF-8
List	Mutable, heterogeneous
Dict	Mutable, insertion-ordered, hashable keys (Int, Dec, String, Bool, Null, Pair of hashables)
Pair	Immutable 2-tuple; .first, .second

2. Numeric semantics (the important part)

  1. No binary floats exist in the language. 1.1 + 2.2 = 3.3 is exactly true.
  2. Int op Int → Int for + - * // % ^(non-negative exponent).
  3. Any Dec operand promotes the result to Dec.
  4. / always yields Dec. Division rounds to 30 fractional digits.
  5. // floor division → Int (or Dec if either operand is Dec).
  6. Irrational/transcendental results from math lib return Dec rounded to 30 places.
  7. Precision is a runtime setting: math.set_precision(30) — default and documented value is 30.
  8. Complex arithmetic promotes real/imag to Dec.

3. Truthiness

The Boolean value False, integer 0, float 0.0, complex number 0+0i, None, empty string, empty list, empty dictionary, and the tuple (0, 0) are all falsy values; everything else is truthy.

Operators

1. Assignment and Equality

let a <- 5
if a = 5 {...}
x <- y <- 0
x += 1          (syntax sugar, simplification for x <- x + 1.)

2. Logical VS Bitwise

and	&
or	|
not	~
xor	`
*2^	<<
/2^	>>

and/or willl short-circuit, while xor will not. Bitwise operators accept Int only (and Bool for "& | ^ ~", treated as 1-bit).

3. Precedence (Low → High)

  1. or (left)
  2. xor (left)
  3. and (left)
  4. not (unary)
  5. Comparisons (=, !=, <, >=, >, <=, is, in) (left)
  6. | (left)
  7. ` (left)
  8. & (left)
  9. << and >> (left)
  10. Additive (+, -) (left)
  11. Multiplicative (*, //, /, %) (left)
  12. Signs and ~ (unary)
  13. ^ (right)
  14. Parenthese for call, bracket for index, and dot for member (left).

Statements

1. Binding

let x <- 10
let (a, b) <- (1, 2)        # pair destructuring
const PI_ISH <- 3.14159     # reassignment is a runtime error

Block-scoped. Shadowing is allowed.

2. Control Flow

if cond { ... } elif other { ... } else { ... }

while cond { ... }

for x in [1, 2, 3] { ... }
for (k, v) in {"a": 1}.items() { ... }
for i in range(0, 10, 2) { ... }

break / continue

match value {
  case 1        { ... }
  case (a, b)   { ... }          # pair pattern
  case [x, y]   { ... }          # list pattern
  case default  { ... }
}

3. Errors

Error Handling

try {
  throw Error("boom")
} catch e {
  print(e.message)
} finally {
  print("cleanup")
}

Error Hierarchy

Built-in hierarchy: Exception → RuntimeError, TypeError, ValueError, KeyError, IndexError, MathError, IOError, AssertionError. User classes may extends Exception.

4. Functions, Closures, Lambdas

fn add(a, b) { return a + b }

fn add(a: Int, b: Int): Int { return a + b }   # optional annotations

# expression lambda
let double <- fn (x) -> x * 2

# block lambda
let safe <- fn (x) {
  if x < 0 { return 0 }
  return x
}

# default & variadic
fn greet(name, greeting <- "Hello") { ... }
fn total(*nums) { ... }

# closures mutate captured bindings
fn counter() {
  let n <- 0
  return fn () { n <- n + 1; return n }
}
let c <- counter()
c()   # 1
c()   # 2

Recursion is natural: the function name is bound before the body runs, so fact(n) sees itself. Tail calls are not guaranteed optimized in Beta.

5. OOP

class Animal {
  let name                        # field declaration

  fn init(name) { this.name <- name }
  fn speak()    { return "..." }

  static fn kingdom() { return "Animalia" }
}

class Dog extends Animal {
  fn init(name, breed) {
    super.init(name)
    this.breed <- breed
  }
  fn speak() { return "Woof" }
}

let d <- Dog("Rex", "Corgi")
print(d.speak())        # Woof
print(d is Animal)      # true
  • Single inheritance only; super refers to the parent class.
  • this is implicit in method bodies.
  • Instantiation is by calling the class. No new keyword.
  • Fields must be declared with let in the class body (or created in init).

6. Operator overloading

class Vec {
  let x
  let y
  fn init(x, y) { this.x <- x; this.y <- y }

  operator +(o)  { return Vec(this.x + o.x, this.y + o.y) }
  operator =(o)  { return this.x = o.x and this.y = o.y }
  operator -( )  { return Vec(-this.x, -this.y) }     # unary
  operator [](i){ if i = 0 { return this.x } return this.y }
  fn __repr__()  { return f"Vec({this.x}, {this.y})" }
}

7. Collections in Practice

let xs <- [1, 2, 3]
xs.append(4)
xs[0]        # 1
xs[-1]       # 4
xs[1:3]      # [2, 3]

let d <- {"a": 1}
d["b"] <- 2
d.get("z", 0)
d.keys() / d.values() / d.items()

let p <- (1, "one")
p.first      # 1
p.second     # "one"

Modules

import math
from string import upper, join
import os as operating_system

Modules are objects; a user module is just a .tst file whose top-level let/fn/class bindings become its exports. Search path: current directory, TEMPESTISSIMO_PATH, then stdlib.

Standard Library (Beta scope)

math

pi, e, tau, I, inf, abs, sign, floor, ceil, round, trunc, min, max, clamp, sum, sqrt, cbrt, isqrt, hypot, pow, exp, ln, log2, log10, sin cos tan asin acos atan atan2 and hyperbolic variants, degrees, radians, gcd, lcm, factorial, comb, perm, isprime, primes(n), set_precision, get_precision, complex(re, im), real(z), imag(z), conj(z), arg(z), abs_complex(z)

string

string.format, join, split, strip, upper, lower, title, replace, find, startswith, endswith, repeat, pad_left, pad_right, chars, etoc, ctoe, is_digit, is_alpha, is_space, to_int, to_dec

os

name, platform, args, getcwd, chdir, listdir, mkdir, makedirs, rmdir, remove, rename, exists, isfile, isdir, stat, getenv, setenv, exit, environ (dict-like), path submodule (join, split, dirname, basename, ext, abspath, normpath)

time

now() → DateTime, time() → Dec seconds, monotonic(), sleep(sec), perf_counter(), format(dt, fmt), parse(s, fmt), year/month/day/hour/minute/second(dt), timezone()

random

seed, random, randint, randrange, choice, choices, shuffle, sample, uniform, gauss, normal, uuid4

io

print, input, read_file, write_file, append_file, read_lines, open (file object with read, write, close, lines), stdout, stderr, stdin

json

parse, stringify, pretty

Core builtins (no import)

print, input, len, range, str, int, dec, bool, list, dict, pair, type, isinstance, repr, abs, min, max, sum, sorted, reversed, enumerate, zip, map, filter, any, all, hash, id, iter, next, assert, error, exit

REPL Preview

$ tempestissimo
Tempestissimo <version>  ·  type :help for commands
>>> 1/3
0.333333333333333333333333333333
>>> let xs <- [1,2,3]
>>> xs.map(fn(x) -> x^2)
[1, 4, 9]
>>> _
[1, 4, 9]

Features:

  • Persistent environment across lines.
  • Multi-line continuation via brace/paren balance detection and a trailing \.
  • _ holds the last successful result.
  • readline history (~/.tempestissimo_history).
  • Commands: :help, :quit, :load FILE, :reset, :vars, :type EXPR, :ast EXPR, :time EXPR.
  • Errors print a caret diagnostic and never kill the session.

Visual IDLE

Tkinter application (idle/), launched with tempestissimo --idle [FILE]:

  • Editor pane — syntax highlighting (keywords, numbers, strings, operators, comments), line numbers, auto-indent, bracket matching, tab = 4 spaces.
  • Toolbar — New / Open / Save / Run / Stop / Step (future) / Clear.
  • Output console — stdout/stderr of the run, color-coded, click-to-jump to the erroring line.
  • Embedded REPL pane — same session environment as the last run.
  • Inspector pane — live list of global variables with type and repr, refreshed after each run.
  • Menu: File, Edit, Run, View (toggle panes), Help (language reference).

Run executes in a worker thread so Stop can interrupt; the interpreter exposes a cooperative interrupt() hook.

Error Reporting Standard

Every error carries message, file, line, column, and a source excerpt:

ValueError: cannot convert "abc" to Int
  --> script.tst:12:15
   |
12 | let n <- int("abc")
   |              ^^^^^

Implementation Architecture

tempestissimo/
├── __init__.py
├── __main__.py            # CLI: run file / REPL / --idle
├── tokens.py              # Token kinds, Token dataclass
├── lexer.py               # Source → [Token], handles <- vs < -
├── ast_nodes.py           # One dataclass per AST node
├── parser.py              # Recursive descent (Pratt for expressions)
├── resolver.py            # Scopes, closures, free-variable analysis
├── environment.py         # Chained scope environments
├── interpreter.py         # Tree-walking evaluator (core loop only)
├── errors.py              # Exception hierarchy + diagnostics
├── values/
│   ├── __init__.py
│   ├── numbers.py         # Int / Dec (decimal module wrapper) / Complex + promotion
│   ├── strings.py
│   ├── collections.py     # List, Dict, Pair, slicing, hashing
│   ├── functions.py       # Function, Lambda, BoundMethod, closures
│   └── objects.py         # Class, Instance, inheritance, operator dispatch
├── builtins/
│   ├── __init__.py        # Registry; installs into global env
│   ├── core.py
│   ├── mathlib.py
│   ├── stringlib.py
│   ├── oslib.py
│   ├── timelib.py
│   ├── randomlib.py
│   ├── iolib.py
│   └── jsonlib.py
├── stdlib/                # Optional .tst source modules
├── repl.py
├── idle/
│   ├── __init__.py
│   ├── app.py             # Tk root, menus, layout
│   ├── editor.py          # Text widget + highlighting
│   ├── highlighter.py     # Token-based syntax coloring
│   ├── console.py         # Output + REPL panes
│   └── inspector.py
└── tests/
    ├── test_lexer.py
    ├── test_parser.py
    ├── test_numbers.py    # 30-digit decimal invariants
    ├── test_objects.py
    ├── test_stdlib.py
    └── programs/          # .tst golden-file tests

Implementation notes locked in now:

  • Implementation language: Python 3.11+ — it gives us native bignums, a correct decimal module for the 30-digit scale, and Tkinter for the IDLE, all without third-party dependencies.
  • Interpreter is a pure tree-walker in Beta; the AST → bytecode VM refactor is deferred and made possible by keeping all evaluation behind Interpreter.eval(node, env).
  • Every runtime value subclasses TValue with repr(), truthy(), equals(), and type_name() so the interpreter loop stays small.
  • Numeric promotion lives entirely in values/numbers.py — the interpreter never inspects numeric subtypes directly.

Interpreter

[1]

Welcome everyone to share their opinions!!!

See Also

Categories