SudoLang language
Pseudolanguage whose runtime is the model: typed interfaces, English constraints, and a pipe operator make a prompt read as a program, while most functions are inferred rather than written.
Overview
SudoLang is a pseudolanguage for programs a language model runs itself: a declarative mix of English, interfaces, functions, and constraints. It exists because pseudocode prompts outperform prose ones; an AI model interprets it unaided, so the specification is optional.
Code
count = 0 // assignment
count += 1 // compound operators exist
price = 42.5 * 2 // math operators consume numbers
name = "Echo"
"Hello, $name" // template-string interpolation
1..3 // inclusive range: 1, 2, 3
[foo, bar] = [1, 2] // array destructuring
{ foo, bar } = { foo: 1, bar: 2 } // object destructuring
label = match (shape) {
case { type: "circle", radius } => "radius is $radius";
case { type: "rectangle", width, height } => "${width}x${height}";
default => "Unknown shape",
};
function greet(name); // body inferred by the model
greet("Echo") // "Hello, Echo"
f = x => x + 1 // a function value
g = x => x * 2
h = f |> g // composition: f's output feeds g
h(20) // 42
interface Employee {
minimumSalary = $100,000
salary
constraint SalaryFloor {
every employee's salary is at least $minimumSalary
}
}
joe = employee({ name: "Joe", salary: 110,000 })
minimumSalary = $120,000 // solver: joe.salary becomes 120,000
|> to compose them, then the signature feature — an interface whose English
constraint makes the model repair state when a floor moves.Distinctive traits
- Constraints are English declarations the model keeps true, so an inferred solver repairs dependent values instead of requiring update code.
- Referential omnipotence: unnamed functions are inferred on demand, so
sortorlogexist with no declaration and no body. - Constraints follow Sketchpad's propagate-on-edit model, which Elliott cites as the inspiration.
- The pipe operator composes left to right, and Markdown preambles are executed as context.
- The spec ships its linter as a SudoLang program, so style conformance is model behaviour, not a compiler check.
Status
Specification v2.0 and an MIT-licensed VS Code extension live in the
project repository; no separate compiler
or runtime exists. Documentation is articles, examples, and an O'Reilly overview,
and transpile handles transpilation to conventional languages.
History
Created in 2023 by prompting GPT-4 to write the specification itself, after Jake Brukhman's Jargon suggested formalising a pseudolanguage syntax; Elliott then asked for a rename to SudoLang and added the pipe operator. The published specification now stands at version 2.0.
Sources & references
- Official sitegithub.com
- SudoLang v2.0 — language specificationgithub.com
- Unlocking the Power of AI Driven Development with SudoLang (Eric Elliott, O'Reilly Radar, 2024)oreilly.com
- Prompting with Pseudo-Code Instructions (Mishra et al., EMNLP 2023)arxiv.org
- SudoLang: A Powerful Pseudocode Programming Language for LLMs (April 2023 announcement)medium.com