Quadrate
A stack-based concatenative programming language with static typing and LLVM compilation.
Quadrate is under active development. Language syntax and standard library interfaces may change in future releases.
fn main() {
"Hello, World!" print nl
}
Quadrate is a concatenative language where data flows through a stack. Operations consume values from the stack and produce new values. Function signatures explicitly declare stack effects, enabling compile-time validation.
Core concepts
In Quadrate, you write operations in postfix notation:
a b +
Values are pushed onto a stack, then operations consume them. The compiler validates all stack operations at compile time.
fn factorial(n:i64 -- result:i64) {
dup 1 <= if {
drop
1
} else {
dup -- factorial *
}
}
fn main() {
5 factorial print nl // 120
}
quad run factorial.qd
Key features
Explicit stack effects. Function signatures declare what they consume and produce: (inputs -- outputs). The compiler validates all stack operations.
Static type checking. Stack types are validated at compile time. Type mismatches are caught before execution.
Native code generation. LLVM backend produces optimized native binaries. No interpreter or VM overhead.
Structured error handling. Fallible functions are marked with ! and must be explicitly handled at call sites. No exceptions.
Get started
New to Quadrate? Start here:
- Install Quadrate - Get the toolchain running
- Hello World - Write your first program
- Learn the Stack - Understand stack-based evaluation
Or dive into the Learn section for a complete tutorial from basics to advanced topics.
The toolchain
Quadrate comes with everything you need:
| Tool | What it does |
|---|---|
quad |
Main CLI - run, build, test, format in one command |
quadc |
Compiler - turns .qd files into executables |
quadfmt |
Formatter - keeps your code consistent |
quadlint |
Linter - catches common mistakes |
quadlsp |
Language server - IDE integration |
quadrepl |
REPL - experiment interactively |
quadpm |
Package manager - manage dependencies |
Command-line arguments
Reading command-line arguments:
use str
fn main() {
read -> argc
argc 0 == if {
"Usage: greet <name>" print nl
} else {
-> name
"Hello, " name str::concat "!" str::concat print nl
}
}
quad run greet.qd -- Millie
Learn more
- Standard Library - Strings, I/O, math, threading, and more
- Language Reference - All keywords and built-in operations
- About Quadrate - Design philosophy and links
License
Quadrate is free software under the GPL-3.0 License.