Quidra 0.3.0 · statically typed · native via LLVM · MIT

Quidra Maximum Meaning Per Token

A statically typed, natively compiled general-purpose language for humans and language models. Quidra keeps ordinary code familiar and compact, while making the distinctions that affect correctness explicit.

hero.qui
int factorial(int n)
    if n <= 1
        return 1
    else
        return n * factorial(n - 1)

print(factorial(5))
quidra run hero.qui
120
  1. int factorial(int n) Types stay explicit where they carry meaning: this function takes an int and returns an int.
  2. if n <= 1 Indentation defines the block. There are no braces or semicolons to carry around.
  3. print(factorial(5)) Top-level code can run directly, while the file still compiles through LLVM to native machine code.

01 / semantic compression

Simple where it can be. Explicit where it matters.

Maximum Meaning Per Token is not code golf and it is not extra syntax for its own sake. Quidra removes ceremony the compiler can recover safely, then keeps the few tokens that actually change meaning.

int count = 3
a typed binding with familiar declaration syntax
auto name = "Quidra"
infer a type when the initializer makes it unambiguous
for value in values
iterate directly over values
Point(3.0, 4.0)
construct a value by calling its type
=
ordinary assignment has independent value semantics
&x
observable aliasing is requested explicitly
T(value)
representation changes are explicit
and / or / not
boolean logic uses readable words

The deeper safety rules stay out of ordinary code until they matter: copies remain independent, aliasing is requested explicitly, representation changes are written down, and visible names cannot be silently shadowed.

02 / design laws

Why Quidra

Ordinary code should look ordinary. Quidra becomes explicit exactly where hidden behavior would make a program harder to reason about: value versus storage, write authority, initialization, representation and name resolution.

  1. 01

    Values are the default; storage is explicit.

    Ordinary = means an independent value. Observable aliasing is written with &: a T & path can write, a const T & path can only observe. The implementation may share storage or copy on write only when the difference cannot be observed.

    values.qui
    int[] a = [1, 2, 3]
    int[] b = a
    b[0] = 9
    print(a[0])
    print(b[0])
    
    int x = 1
    int &writer = &x
    const int &view = &x
    writer = 5
    print(view)
    output
    1
    9
    5
  2. 02

    Authority is part of the call.

    A reference parameter makes caller-owned storage access explicit, and the parameter decides whether that path may write. The checker tracks what a call requires to be initialized and what it guarantees afterwards, so a writable parameter can safely initialize storage.

    authority.qui
    void inspect(const int &value)
        print(value)
    
    void initialize(int &value)
        value = 7
    
    int value
    initialize(&value)
    inspect(&value)
    output
    7
  3. 03

    State facts are tracked, not guessed.

    Uninitialized does not mean zero, none or a hidden default. Definite initialization is followed through branches, loops, references, fields, calls and returns; a class may be intentionally partial, and reading the missing part is rejected before the program runs.

    uninitialized.qui
    int x
    print(x)
    quidra check uninitialized.qui
    uninitialized.qui:2:7: error[UNINITIALIZED] Binding 'x' may be uninitialized.
    1 error(s) generated.
  4. 04

    Representation changes are explicit.

    An already-typed numeric value never changes representation implicitly, even when the conversion would be lossless. Casts use the destination type and integer narrowing is range checked. Floating-point to integer is not a generic cast, because the rounding is the meaning: say math.round, math.floor, math.ceil or math.trunc.

    representation.qui
    int value = 100
    int8 small = int8(value)
    float ratio = float(value) / 3.0
    int rounded = math.round(ratio)
    print(small)
    print(rounded)
    output
    100
    33
  5. 05

    Name resolution is monotonic.

    Reserved names are never reusable, visible names are never shadowable, and otherwise names may be reused in disjoint scopes. Adding code near an existing reference can never silently change what that reference means, for a person or for a model editing the file.

    names.qui
    int local_value()
        int x = 5
        return x
    
    int x = 7
    print(local_value() + x)
    output
    12

03 / the language

Start familiar. Go as deep as you need.

Begin with bindings, functions, classes and iteration; reach for references, tensors or explicit errors only when the program needs them. Every example below is checked, canonically formatted and run with Quidra 0.3.0 before it is published.

Bindings, values and loops

Typed and auto bindings, string interpolation, an int[] copy that stays independent after mutation, a for loop over an array and over range() and an if/elif/else chain.

basics.qui
int count = 3
auto name = "Quidra"
print("Hello, {name}")

int[] original = [1, 2, 3]
int[] copy = original
copy[0] = 9
print("original[0] = {original[0]}, copy[0] = {copy[0]}")

int total = 0
for value in original
    total += value
print("total = {total}")

for i in range(0, count)
    if i == 0
        print("first")
    elif i < count - 1
        print("middle")
    else
        print("last")
output
Hello, Quidra
original[0] = 1, copy[0] = 9
total = 6
first
middle
last

Defaults, names and generics

A default parameter, a call with named arguments and a constrained generic T largest<T: ordered>(T[] values) whose type argument is inferred from typed int[] and float[] variables.

functions.qui
int add(int a, int b = 1)
    return a + b

bool within(int value, int minimum, int maximum)
    return value >= minimum and value <= maximum

T largest<T: ordered>(T[] values)
    T best = values[0]
    for value in values
        if value > best
            best = value
    return best

print(add(41))
print(add(a = 40, b = 2))
print(within(50, minimum = 0, maximum = 100))
int[] scores = [3, 9, 4]
print(largest(scores))
float[] readings = [2.5, 1.5]
print(largest(readings))
output
42
42
true
9
2.5

Classes with value semantics

A class with fields, a construct, a public and a private method, an independent copy via =, an explicit Point &alias that writes through and value equality with ==.

classes.qui
class Point
    int x
    int y

    construct(int x_value, int y_value)
        x = x_value
        y = y_value

    private int sum()
        return x + y

    string describe()
        return "({x}, {y}) sum {sum()}"

Point a = Point(1, 2)
Point b = a
b.x = 9
Point &alias = &a
alias.y = 5
print(a.describe())
print(b.describe())
print("{a == b} {a == Point(1, 5)}")
output
(1, 5) sum 6
(9, 2) sum 11
false true

Write authority at the call

const int[] & versus int[] & parameters called with &data: the caller always writes & and the parameter declaration decides whether the path may write.

references.qui
void inspect(const int[] &values)
    int total = 0
    for value in values
        total += value
    print("total {total}")

void double_all(int[] &values)
    for &value in values
        value = value * 2

int[] data = [1, 2, 3]
// The caller writes & at every call; the parameter decides read-only or read/write.
inspect(&data)
double_all(&data)
inspect(&data)
print(data[2])
output
total 6
total 12
6

Tensors with shape contracts

Exact-rank tensor<float32><3, _, _> bindings, strict singleton broadcasting, .item() and .shape(), plus linear.matmul and stats.mean on 2-D tensors.

tensors.qui
tensor<float32><3, _, _> pixels = tensor.zeros<float32>([3, 64, 64])
tensor<float32><1, _, _> bias = tensor.ones<float32>([1, 64, 64])
tensor<float32><3, _, _> shifted = pixels + bias
float32 sample = shifted[0, 10, 20].item()
print(sample)
int[] shape = shifted.shape()
print(shape[0])
tensor<float32> a = tensor.ones([2, 3])
tensor<float32> b = tensor.ones([3, 2])
tensor<float32> c = linear.matmul(a, b)
print(c[0, 0].item())
print(stats.mean(c))
output
1.0
3
3.0
3.0

Declarative command line

One cli block declares a required positional argument(), an int option(default = 1) and a bool flag(); field names are the command-line names.

cli.qui
cli args
    string source = argument()
    int count = option(default = 1)
    bool verbose = flag()

print(args.source)
print(args.count)
print(args.verbose)
quidra run cli.qui -- input.txt --count 3 --verbose
input.txt
3
true

Errors and match

int | error is the whole failure story: try propagates the parse error, error(...) creates one and an exhaustive match handles success and failure without exceptions.

errors.qui
int | error parse_score(string text)
    int value = try int.parse(text)
    if value > 100
        return error("score above 100: {value}")
    return value

string[] inputs = ["42", "500", "abc"]
for text in inputs
    match parse_score(text)
        int value
            print("score {value}")
        error problem
            print("rejected: {problem}")
output
score 42
rejected: score above 100: 500
rejected: numeric parse failed

04 / native by construction

Meaning preserved through native compilation

Semantic compression is a source-language goal, not a request for a lightweight implementation. Quidra makes meaning explicit and statically resolved first, then carries those decisions through a typed pipeline into machine code. Later stages never rediscover meaning from source spelling.

  • The compiler is written in C++20. Native code is produced through LLVM IR and Clang, optimized at -O3 without fast-math.
  • Runtime safety stays on: integer overflow at every width, division by zero, array and bin bounds, allocation sizes and out-of-range casts are all checked. A runtime safety failure terminates deterministically with status 101.
  • The REPL lowers each submission to LLVM IR and executes it with ORC JIT; nothing is interpreted.
  • Linux, macOS and Windows are supported. GPU placement is explicit through the cuda, hip and metal backends, and there is never an implicit fallback to the CPU.
  1. 01Quidra source
  2. 02AST
  3. 03module resolution
  4. 04generic specialization
  5. 05static checking, effect analysis, call resolution
  6. 06typed Quidra IR
  7. 07LLVM IR
  8. 08native machine code

05 / for machines too

A compiler you can call

LLM-friendliness is not only surface syntax. The compiler exposes its diagnostics, its structural view of a program and a revision-checked patch operation, so a tool's edit is closer to a checked transaction than to a blind text replacement.

  • quidra check --json reports diagnostics with stable codes and exact spans.
  • quidra inspect exposes nodes with ids, spans, content hashes, inferred types and storage-effect summaries; flags trim the output to what a task needs.
  • quidra patch applies an edit keyed by node id and hash, rejects stale revisions and overlapping edits, and accepts the result only after it passes the compiler.
  • quidra lsp serves diagnostics and formatting over standard LSP stdio framing.
Compiler as a tool
quidra check program.qui --json
quidra fmt program.qui --check
quidra inspect program.qui --no-source --kind call --depth 3
quidra patch program.qui change.json --write
quidra lsp
uninitialized.qui
int x
print(x)
quidra check uninitialized.qui --json
{"ok":false,"truncated":false,"diagnostics":[{"code":"UNINITIALIZED","message":"Binding 'x' may be uninitialized.","file":"uninitialized.qui","span":{"start":{"line":2,"column":7},"end":{"line":2,"column":8}}}]}

06 / measured

Quidra publishes its own benchmark, including where it loses.

Ten languages, five independent evaluations, one frozen methodology. Every ranking, score and per-requirement result of run 2026-09-27-38b7137-gh31 is committed as data in the compiler repository. Quidra 0.3.0, measured at snapshot 38b7137, places:

  1. Semantic Compression 2nd of 10 score 77.52
  2. LLM Learnability 10th of 10 score 71.97
  3. Language Quality 4th of 10 score 66.13
  4. Ecosystem 10th of 10 score 32.50
  5. LLM Proficiency 10th of 10 score 4.91

Read the full results and how they were measured

07 / ecosystem

A small, explicit library boundary

The standard namespaces are always visible and never imported. Tensors, image and video I/O and the neural autodiff foundation are built in; layers and computer vision ship as ordinary source packages installed from immutable release tags.

  • quidra-lang/quidra Core The compiler, native runtime, REPL, language server and standard namespaces. C++20 over LLVM, MIT licensed, released from immutable tags with archives for Linux, macOS and Windows.
  • quidra-lang/playground Playground The compiler frontend compiled to WebAssembly and served as a static page. Check, format, lower to IR, inspect and patch in the browser; nothing leaves the tab.
  • quidra-lang/vision Vision import vision. Image processing on rank-3 CHW tensors: crop, resize, flips and rotations, grayscale, threshold, blur, filter, dilate and erode. Invalid shapes or parameters return error and are never reinterpreted.
  • quidra-lang/dnn DNN import dnn. Layers and optimizers as ordinary classes whose constructors can fail, plus activation and loss functions, over the neural autodiff foundation. The execution mode is chosen explicitly with dnn.mode.fast() or dnn.mode.deterministic().

08 / try it

The real compiler frontend, in your browser

The Quidra Playground runs quidra_core compiled to WebAssembly. Check, format, lower to typed IR, inspect and patch happen on your machine; the source never leaves the tab, and it works offline once loaded. It has no Run button by design: execution needs the native toolchain, and a second execution engine that behaved differently would be worse than none.

  • Check type-checks and reports the compiler's own diagnostics, with codes and exact spans.
  • Format rewrites the source with the same formatter quidra fmt uses.
  • IR lowers a checked program to typed Quidra IR.
  • Inspect shows node ids, kinds, spans, content hashes and inferred types.
  • Patch applies a structured edit and refuses any result that would not compile.

09 / get started

Install and run

Download the release archive for your platform, put quidra on your PATH, and make sure Clang 15 or newer is installed for native code generation. Then run a file directly, or build a persistent executable.

Full installation guide, REPL and tooling
Debian and Ubuntu
sudo apt-get install ./quidra-linux-amd64.deb
quidra --version
hello.qui
print("Hello from Quidra")
quidra hello.qui
Hello from Quidra