Types that stay out of the way
int, string, bool, List<T>, Map<K, V>, tuples, function types and T? are all resolved before a single instruction is emitted. A type error arrives as a diagnostic with a line and a column, not as a surprise at runtime.
PickleScript .pkl
PickleScript has pattern matching, generics, classes and a garbage collected heap. Newlines end statements, so there are no semicolons to keep track of. The compiler that reads all of it, the x86-64 backend it emits through and the linker that produces the executable are themselves written in PickleScript.
module hello
fn main() {
let name = "world"
print("Hello, {name}!")
}$ pickle run hello.pkl
Hello, world!
The language
int, string, bool, List<T>, Map<K, V>, tuples, function types and T? are all resolved before a single instruction is emitted. A type error arrives as a diagnostic with a line and a column, not as a surprise at runtime.
Options, tuples and enum payloads come apart with match. Case some(v), case (a, b), literal alternatives, guards and a catch-all when the type says one is needed. Comparing an option against none is not the pattern to reach for.
A class has reference semantics and single inheritance, a struct copies on assignment, an enum is a closed sum whose payload is only readable inside match, and an interface is a nominal contract you test with is, as and as?.
Generic functions and interfaces are monomorphized per concrete type list. Type arguments are inferred when the arguments pin them, and you write fn<int> when the generic is used as a value.
Most code never mentions memory. Mark a class #[manualAlloc] and it frees its own owned fields, or step into an unsafe block when you want alloc, free and raw pointer access on purpose.
pickle run, build, test, lex and explain. The test runner picks up every *_test.pkl file in the project, and explain looks up any diagnostic code, including the ones that tell you a shape is not lowered yet.
Examples
An optional is none or some(value), and match is how you take it apart. The same form destructures tuples, and the compiler asks for a catch-all when a type can fail to match.
// an option is none or some(value)
fn describe(token: string?) -> string {
match (token) {
case some(value) -> "found {value}"
case none -> "no token"
}
}
// tuples destructure the same way
fn label(pair: (int, string)) -> string {
match (pair) {
case (count, name) -> "{count} {name}"
}
}
fn main() {
print(describe(some("abc123")))
print(describe(none))
print(label((3, "apples")))
}Output
$ pickle run options.pklfound abc123no token3 apples
What to notice
The toolchain
Where it stands
Libraries are published through the PickleScript package registry on this site, with a security scan on every submission. It is a useful tool, and the language itself does not depend on it.
Questions
Both paths end up as machine code. pickle run uses a JIT so you can iterate quickly, and pickle build compiles ahead of time into a native executable. The test battery checks that the two paths agree on every tracked program. The backend that replaces the current one is already written in PickleScript.
No. A PickleScript program builds into a normal executable that runs on its own. The runtime is linked into the binary rather than installed next to it.
The collector handles nearly everything. When you want to own lifetimes yourself, #[manualAlloc] on a class frees its owned fields recursively, and an unsafe block gives you alloc, free and pointer access when you ask for it explicitly.
Yes. The compiler, its x86-64 backend and its PE linker are written in PickleScript. The one thing still to change is which build you get: the shipped CLI runs the reference build until the switchover lands, and that reference build is what goes away when it does.
There is no packaged installer yet, so build the workspace from source for now. The documentation walks you through checking, running and building your first file.
Documentation
The language reference covers lexical rules, types, control flow, classes, collections and the CLI. Read it in order the first time, then use it as a reference.
The compiler, the runtime and this site live on GitHub. Issues, diagnostics that do not make sense and patches are all welcome.
Written in itself
The compiler, the x86-64 backend and the linker are PickleScript.
.pkl
The extension on every PickleScript source file.
pickle test
The built-in runner finds every *_test.pkl in the project.