The .prisma ASCII format

The ASCII encoding

.prisma is the human-authorable encoding of a Document — a USDA-flavoured ASCII format (as opposed to the binary one) that is diff-clean and stable, the form you write by hand and commit to git. It is one of Core's two native encodings; the other is the .prism binary. They carry the same Document and convert losslessly either way.

Every file begins with a version header, then nests prims with braces:

#prisma 3.0
def group "world" {
    def object "ball" {
        float3 position = (0, 1, 0)
        float  radius   = 1.5
        float3 albedo   = (1, 1, 1)
        albedo.connect  = </world/mat.out>
    }
}

The grammar, briefly

Stable and diff-clean

The serializer sorts deterministically, so two saves of the same Document produce byte-identical files and a real change produces a small, readable diff. That is a deliberate property: .prisma is meant to live in version control, be reviewed in a pull request, and merge sanely. Values are self-describing (the dtype and shape travel with the data), so a .prisma file needs no external schema to be read correctly.

Parsing, with located errors

deserialize accepts an optional ParseError* that is filled with a file-absolute line:column and a message on failure — the same diagnosis the CLI's check surfaces:

ParseError err;
auto doc = deserialize(text, &err);
if (!doc) fprintf(stderr, "%zu:%zu: %s\n", err.line, err.column, err.message.c_str());
$ prism check broken.prisma
broken.prisma:4:18: error: invalid value for its declared type

Encoding is detected by content, never by suffix, so a mislabelled file still loads. When you want compactness or large numeric arrays instead of readability, reach for the binary format.