Language reference

This section documents all Quadrate keywords and built-in instructions.

Quick navigation

Types

Quadrate has four basic types:

Type Description Example
i64 64-bit signed integer 42, -17
f64 64-bit floating-point 3.14, -0.5
str String "hello"
ptr Pointer Struct instances, arrays

Stack signatures

Function signatures use (inputs -- outputs) notation:

fn add(a:i64 b:i64 -- sum:i64) { + }
  • Before --: Values consumed from stack (bottom to top)
  • After --: Values produced on stack (bottom to top)

Fallible functions

Functions that can fail are marked with !:

fn divide(a:i64 b:i64 -- result:i64)! {
    // Can signal error
}

Call with if-else to handle errors:

10 2 divide if {
    // success
} else {
    drop2  // error
}