- What is Coderive?
- Why Coderive?
- Getting Started
- Language Features
- Latest in src
- Validation Snapshot
- Demo Programs
- Web Playground
- License
- Contact
- Code of Conduct
Coderive is a modern programming language designed around three principles:
| Principle | What it means |
|---|---|
| Safe | Quantifier-first logic eliminates operator-precedence bugs; typed slots make multi-return values explicit |
| Fast | O(1) lazy arrays and formula-optimized loops handle data at any scale without materialising elements |
| Clear | Human-readable syntax — all[...], any[...], ~>, :: — reads like intent, not symbols |
Coderive features a fully hand-written, modular lexer-parser pipeline (no ANTLR), a recursive-descent parser with backtracking, and an O(1) range system that can represent a quintillion-element array in a few microseconds.
Built on mobile. Coderive was developed entirely on a phone — Java NIDE, Quickedit, Termux, and AI assistants (DeepSeek, Gemini). Serious language design knows no hardware limits.
No more && / || precedence headaches. Logic reads exactly like its intent.
# Traditional — what does this evaluate first?
if a && b || c && d { ... }
# Coderive — crystal clear
if any[all[a, b], all[c, d]] { ... }Use all[] for AND, any[] for OR, nest them freely:
if all[score >= 60, attempts <= maxAttempts] {
out("Passed!")
}
if role == any["admin", "moderator", "owner"] {
out("Access granted for {role}")
}Functions declare named return slots with :: and assign them with ~>(slot-returns). Call sites destructure them cleanly.
local divide(a: int, b: int)
:: quotient: float, remainder: int, status: text {
if b == 0 {
~> (0.0, 0, "division by zero")
}
~> (a / b, a % b, "ok")
}
# Destructure only what you need
q, r, s := [quotient, remainder, status]:divide(17, 5)
out("{17} ÷ 5 = {q} remainder {r} ({s})")Every step pattern you'll ever need, built into the language:
for i of 1 to 10 { ... } # count up
for i of 10 to 1 { ... } # auto-reverse
for i of 1 to 100 by 2 { ... } # additive step
for i of 1 to 64 by *2 { ... } # multiplicative (powers of 2)
for i of 64 to 1 by /2 { ... } # divisive (halving)
for i of 1..32#*2 { ... } # inline formula shorthandCreate a quintillion-element array instantly — no memory, no iteration:
huge : [text] = [0 to 1Qi] // 1 Quintillion elements, created in < 1 ms
// Loop body detected as a conditional formula — still O(1)
for i of huge {
if i % 2 == 0 { huge[i] = "even" }
else { huge[i] = "odd" }
}
out(huge[24000]) // → "even"
out(huge[24001]) // → "odd"Range indexing, negative indices, and lexicographic ranges all work out of the box:
slice := nums[-5 to -1] // last 5 elements
alphabet := ["a" to "z"] // 26-element letter range
letters := ["aa" to "zz"] // 676-element 2-letter range- Java 7 or later (Download Adoptium JDK)
- Linux, macOS, or Windows (WSL/Git Bash for the installer)
Clone the repo and run the installer. It will verify Java, install the runtime, and register the coderive command:
git clone https://github.com/coderive-lang/Coderive.git
cd Coderive
chmod +x install.sh && ./install.shAfter install, add ~/.local/bin to your PATH if prompted:
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrcThen run your first program:
coderive hello.codIf you prefer not to use the installer, run programs directly with Java:
java -cp docs/assets/Coderive.jar cod.runner.CommandRunner hello.codYou can alias this for convenience:
alias coderive='java -cp /path/to/Coderive.jar cod.runner.CommandRunner'Create hello.cod:
name := in(text, "What's your name? ")
out("Hello, {name}! 👋")
out("Welcome to Coderive.")Run it:
coderive hello.codWhat's your name? Ada
Hello, Ada! 👋
Welcome to Coderive.
# Type-inferred declaration
x := 42
name := "Coderive"
ratio := 3.14
# Explicit typed declaration
count: int = 0
label: text = "hello"
# Union types
value: int|float = 9.5
# Type aliases
NUMBER: type = int
num: NUMBER = 4out("Hello!") # print with newline
out("A", "B", "C") # each arg on its own line
outs("Loading") outs(".") outs(".") # print without newline
name := in(text, "Enter name: ") # prompt + read text
age := in(int, "Enter age: ") # prompt + read int
height := in(float) # read float (no prompt)if all[age >= 18, hasId] {
out("Welcome!")
} else if age >= 16 {
out("Almost there.")
} else {
out("Sorry, too young.")
}# Single-expression shorthand
local square(n: int) ~> (n * n)
# Multi-return slots
local stats(a: int, b: int, c: int)
:: total: int, average: float {
sum := a + b + c
~> (sum, sum / 3.0)
}
# Call and destructure
t, avg := [total, average]:stats(10, 20, 30)
out("Total: {t}, Average: {avg}")local greet(name: text, greeting: text = "Hello") :: msg: text {
~> (msg: "{greeting}, {name}!")
}
result := greet("Alice", _) # skip optional param — uses defaultpolicy Printable {
print() :: output: text
}
share Document with Printable {
title: text = "Untitled"
policy print() :: output: text {
~> (output: "Document: {this.title}")
}
share main() {
doc := Document()
msg := doc.print()
out(msg)
}
}report := |"
Name: Alice
Score: 98
Grade: A+
"|
out(report)| Suffix | Value |
|---|---|
1K |
1,000 |
1M |
1,000,000 |
1B |
1,000,000,000 |
1T |
1,000,000,000,000 |
1Q |
1,000,000,000,000,000 |
1Qi |
1,000,000,000,000,000,000 |
1e6 |
1,000,000 (scientific) |
Recent src/**/*.cod programs and std modules now showcase:
- Unsafe pointers and fixed buffers (
*<unsafe-type>,<unsafe-type>[n],&,*, pointer arithmetic) intest/unsafe/*. - Static imports for methods/fields in
test/staticimports*. - Lambda auto-currying forms like
\(a) \(b) ...plus classic tuple lambdas intest/lambda/*. - Union + runtime type checks via
int|textandisintest/typesliterals/*. - Range and formula optimizations across lazy arrays, multi-array dependencies, and recurrence tests.
- Expanded standard library coverage in
std/math,std/scimath, andstd/jsonwith comprehensive demo suites.
Current demo validation status from src/cod/demo/src/main/test:
CodP-TAC parity runner(cod.runner.CodPTACParityRunner, excluding*Invalid*.cod): 56/56 passed.- Direct
CommandRunnersweep for non-invalid demos: 49/49 passed (with required stdin fixtures for input-driven demos such asInteractive.cod,IO.cod, andParity.cod). JsonStandardLibraryComprehensive.codnow runs successfully in directCommandRunnermode with full text/object/unicode/invalid-case assertions enabled.
Checked invalid demos (*Invalid*.cod) confirm currently unsupported/invalid patterns:
- Reassigning constants after declaration.
- Declaring constants without initializer.
- Malformed self-call forms (
<~without call target/parentheses, or invalid level-call syntax in methods).
Runnable demos live in src/cod/demo/src/main/test/:
| Category | What it shows |
|---|---|
helloworld/ |
String interpolation, modules, static entry |
controlflow/ |
if/elif/else, skip, break, fin |
loop/ |
Loop patterns, benchmark (BMark.cod) |
lambda/ |
Lambdas, auto-currying, self-call |
lazyloop/ |
O(1) lazy arrays, formula-optimized loops |
array/ |
Array operations |
unsafe/ |
Unsafe pointers, borrow checker |
json/ |
JSON standard library |
Or try everything instantly in the Web Playground — no install required.
Try Coderive directly in your browser — no install required:
The playground gives you a full interactive editor with instant output, making it the fastest way to experiment with the language.
This project is licensed under the MIT License.
- 💬 GitHub Discussions — ask questions, share ideas
- 🐛 GitHub Issues — report bugs
- 🗣️ Discord — chat and community
- 📧 coderive.lang@gmail.com — code of conduct reports
This project follows the Contributor Covenant Code of Conduct. All participants must abide by its terms. Report violations to coderive.lang@gmail.com or via Discord.
All participants should read the Contributing Guide to understand how to contribute to this project.
