Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Language structure

Manifold DSL source is a sequence of top-level declarations. Whitespace separates entries. Blocks do not use semicolons, and lists do not use commas. Function arguments are the exception: commas separate arguments inside parentheses.

condition readiness [not_ready ready]

entity "van-110" {
    traits [vehicle van]
}

The current lexer does not support comments. A comment marker such as # or // produces an unknown-token diagnostic.

Identifiers and identities

An identifier starts with an ASCII letter or underscore. Later characters can also be digits.

vehicle
payload_mass
ready_2

Conditions and mutation roles use identifiers. Entities, mutations, and tasks use quoted string identities.

condition readiness [ready]
entity "van-110" {}
mutation "transport-payload" {}
task "deliver-cargo-42" {}

Quoted strings support \", \\, \n, \r, and \t. Other escape sequences fail during resolution.

Numbers and quantities

Numbers contain digits and can have a decimal fraction. A leading sign is a unary operator rather than part of the number token.

0
59.3293
-18.0686

A quantity is a number, whitespace, and a unit. A compound unit can contain slash-separated identifier segments without spaces around the slash.

800 kg
0.08 l/km
70 km/h

The resolver currently preserves the number and unit text. It does not convert units or check dimensional compatibility.

Blocks and lists

Curly braces contain named sections or expressions. Square brackets contain identifiers or reference paths, depending on the section.

entity "cargo-42" {
    properties {
        mass = 120 kg
    }

    traits [cargo]
}

Whitespace is sufficient between entries. Formatting is not yet canonical, and no formatter is provided.

Declaration order

The resolver first collects all top-level identities, then resolves declaration bodies. Forward entity references therefore work within one source file:

entity "cargo" {
    properties {
        located_at = @"depot".properties.located_at
    }
}

entity "depot" {
    properties {
        located_at = location(59.3293, 18.0686)
    }
}

Every condition, entity, mutation, and task identity must be unique within the file. It must also be absent from any base context supplied to the resolver.