Backolon

A tiny, homoiconic language where syntax is defined through pattern matching and control flow is continuation-based.

x := 42

double := [n] => n * 2

list := [1, 2, 3] + [4, 5]

if (#list > 5) "many" "few"

Homoiconic

Expressions are structured data, so macros and syntax extensions stay concise and readable.

Keywordless

Operators and control flow are ordinary functions rather than reserved keywords.

Self-Extensible

coming soon!

Define a new syntax, and then immediately use it in the same file.

First-class Continuations

return is just a variable holding a continuation, making nonlocal jumps, backtracking, coroutines, and cooperative multitasking easy.

JS/TS Embedding

Designed to be embedded in JavaScript applications for seamless scripting. You can use the provided FFI module, or create your own native functions.

Why Backolon?

Backolon's extensible syntax makes it perfect for building domain-specific languages, such as configuration files, while also allowing full Turing-complete functions where traditional syntax falls short.

How it works

Parsing

Backolon does not discard any token, meaning you can make whitespace significant or not as you desire, or even introspect and parse the contents of comments.

Lambdas

Parameters can be lazy, preventing normal evaluation and allowing block bodies to be run once, not at all, or multiple times, as determined by what they're passed to.

Patterns

Syntax is defined through structural patterns that match

Runtime

Every lambda receives a built-in return continuation, so return, break, and generators are ordinary values that can be passed around and stored.

Embed from JavaScript

import * as Backolon from "@r47onfire/backolon";

const scheduler = new Backolon.Scheduler([
    Backolon.BUILTINS_MODULE,
    Backolon.FFI_MODULE
], console.log);

const task = scheduler.startTask(0, "x := 1", null, Backolon.UNKNOWN_LOCATION.file);
scheduler.stepUntilSuspended();
console.log(task.result);