Skip to content

Protocols and Bindings

Protocols are the top-level executable units in Culsma.

Protocols

A protocol has a name and a statement body.

text
protocol PublicMinimal {
    let target = tube(label = "Target", capacity = 100uL);
}

Culsma also supports parameters and explicit returns:

text
protocol Prepare(sample, volume = 10uL) returns (output) {
    let output = tube(label = "Output");
    return output;
}

The general shape is:

text
protocol Name(optional_params) returns (optional_names) {
    statements...
}

Protocol names are case-sensitive identifiers.

Parameters

Protocol parameters are declared in the protocol header:

text
protocol Prepare(sample, volume = 10uL) {
    ...
}

Parameters may have defaults. When another protocol calls a parameterized protocol, named arguments bind to parameter names.

text
Module.Prepare(sample = source, volume = 5uL);

Missing, unknown, duplicate, or redeclared call arguments are plan-stage diagnostics because call-frame expansion happens while building the plan.

Local Bindings

let creates a new protocol-local binding.

text
let source = tube(label = "Source", capacity = 100uL);

Later statements in the same protocol can refer to source.

text
let target = tube(label = "Target", capacity = 100uL);
target << [source:5uL];

let is local to the protocol body. It does not define a global material namespace and does not automatically leak into called protocols.

Assignment

Assignment updates an existing local binding:

text
x = 10uL;

Assignment is intentionally narrow. It updates protocol-local values; it does not mutate container material state. Material movement is written with <<.

Assignment allows:

  • booleans
  • integers
  • text
  • quantities
  • restricted result-member paths such as data_ref.result.field

It does not allow assignment to container refs, group refs, general indexed targets, or arbitrary object fields.

Returns

A protocol can return an expression:

text
return output;

It can also use named return bindings:

text
return output = output_tube;

Returning a container returns a container reference payload. It does not collapse the result to a string name or a derived report row.

Cross-Protocol Calls

The clearer form for calling another protocol is:

text
Module.ProtocolName(arg = value);

The referenced protocol is expanded into concrete plan steps. Reference errors and cycles are reported by plan diagnostics.

Source Includes and Imports

Culsma source files may use top-level loading declarations:

text
include "path/to/file.culs";
import StdlibModule;

include loads source files. import resolves library modules. The minimal examples stay single-file; multi-file workflows can be introduced separately.

Released under the Apache-2.0 license.