Skip to content

TovaA Modern Programming Language

Clean syntax. Pattern matching. Result types. High performance. From scripts to full-stack web — one language, one toolchain.

The Language

Tova is a general-purpose programming language. You can write scripts, CLI tools, data pipelines, AI applications, and full-stack web apps -- all in one language with one toolchain.

Pattern Matching

tova
fn describe(shape) {
  match shape {
    Circle(r)      => "circle with area {3.14159 * r * r}"
    Rect(w, h)     => "rectangle {w}x{h}"
    Triangle(b, h) => "triangle with area {0.5 * b * h}"
  }
}

match args() {
  ["add", name]      => add_task(name)
  ["done", id]       => complete_task(to_int(id))
  ["list"]           => list_tasks() |> each(fn(t) print(t))
  _                  => print("Usage: tasks <add|done|list>")
}

The compiler checks exhaustiveness and warns on uncovered variants.

Pipes & Functional Composition

tova
result = data
  |> filter(fn(x) x > 0)
  |> map(fn(x) x * 2)
  |> sort_by(.value)
  |> take(10)
  |> sum()

Error Handling Without Exceptions

tova
fn load_config(path) {
  content = read_file(path)?            // Early return on Err
  config = parse_json(content)?
  Ok(config)
}

// Chain maps -- the compiler fuses them at compile time (10x faster)
value = Ok(42)
  .map(fn(x) x * 2)
  .map(fn(x) x + 1)
  .unwrap()

Types, Generics & Derive

tova
type Shape {
  Circle(radius: Float)
  Rect(width: Float, height: Float)
  Triangle(base: Float, height: Float)
} derive [Eq, Show, JSON]

interface Printable {
  fn to_string() -> String
}

Scripting & Data

Tova works without web blocks. Scripts, CLI tools, data pipelines, AI apps:

tova
// Data pipeline with pipes
data = read("sales.csv")
  |> filter(fn(row) row.revenue > 1000)
  |> sort_by(.region)
  |> group_by(.region, fn(rows) {
    { total: sum_by(rows, .revenue), count: len(rows) }
  })

write(data, "summary.json")
tova
// AI integration built in
response = ask("Summarize this document", provider: "anthropic")
embeddings = embed(texts, provider: "openai")
category = classify(text, ["positive", "negative", "neutral"])

Performance

Tova is a high-level language that generates high-performance code. The compiler applies automatic optimizations at compile time, and performance decorators let you opt in to native-speed execution for hot paths.

FeatureWhat it doesImpact
Result.map chain fusionOk(v).map(f).map(g) compiles to Ok(g(f(v)))10x faster (zero allocation)
Array fill detectionPush loops become new Array(n).fill(val)3x faster
Boolean fill upgradeBoolean arrays become Uint8ArrayContiguous memory
Range-to-for rewritefor i in range(n) becomes a C-style loopNo array allocation
@wasm decoratorCompiles to WebAssembly binaryNative WASM speed
@fast decoratorCoerces arrays to TypedArrays97ms dot product on 1M elements
parallel_mapPersistent worker pool across cores3.5x speedup on 8 cores
Radix sort FFIO(n) sort for numeric arrays via Rust FFISort 1M in 27ms
HTTP fast modeSync handlers, direct dispatch108K req/s

See the full performance guide.

Compile-Time Security

The security {} block centralizes your entire security policy in one place. The compiler generates all enforcement code -- zero runtime dependencies.

tova
security {
  auth jwt { secret: env("JWT_SECRET"), expires: 86400 }

  role Admin { can: [manage_users, view_analytics] }
  role User  { can: [view_profile, edit_profile] }

  protect "/api/admin/*" { require: Admin }
  protect "/api/*" { require: authenticated }

  sensitive User.password { never_expose: true }
  sensitive User.email { visible_to: [Admin, "self"] }

  cors { origins: ["https://myapp.com"], credentials: true }
  csp { default_src: ["self"], script_src: ["self"] }
  rate_limit { max: 1000, window: 3600 }
  csrf { enabled: true, exempt: ["/api/webhooks/*"] }
  audit { events: [login, logout, manage_users], store: "audit_log" }
}

From this, the compiler generates JWT validation, role checking, route middleware, field sanitization, CSRF tokens, rate limit tracking, CSP headers, and audit logging. Compile-time warnings catch undefined roles, hardcoded secrets, and CORS wildcards before your code ever runs. Learn more.

Full-Stack Web

When you need a web application, Tova's block model lets you write server and client code in one file:

tova
shared {
  type Todo { id: Int, text: String, done: Bool }
}

server {
  var todos = []

  fn all_todos() -> [Todo] { todos }

  fn add_todo(text: String) -> Todo {
    t = Todo(len(todos) + 1, text, false)
    todos = [...todos, t]
    t
  }
}

browser {
  state todos = []
  state draft = ""

  effect { todos = server.all_todos() }

  component App() {
    <div>
      <input value={draft} on:input={fn(e) draft = e.target.value} />
      <button on:click={fn() {
        server.add_todo(draft)
        draft = ""
        todos = server.all_todos()
      }}>"Add"</button>
      <ul>for t in todos { <li>"{t.text}"</li> }</ul>
    </div>
  }
}

server.add_todo(draft) is a compile-time RPC call. The compiler generates the HTTP endpoint, the fetch call, the serialization, and the async wrapping. You never write networking code.

Developer Experience

  • LSP server with diagnostics, completion, go-to-definition, hover, and signature help
  • VS Code extension with syntax highlighting and LSP integration
  • REPL with multi-line input and stdlib context
  • Dev server with hot reload on save
  • Production build with bundling, content hashing, and minification
  • Rich error messages with source context, carets, and suggestions
  • 6,700+ tests across 85 test files

Get Started

bash
curl -fsSL https://raw.githubusercontent.com/tova-lang/tova-lang/main/install.sh | sh
tova new my-app
cd my-app && tova dev

Installation guide | 10-minute tour | Tutorial | Why Tova?

Released under the MIT License.