Skip to main content

Module lang

Module lang 

Source
Expand description

The Dotloom expression language used by plugin model definitions.

Expressions are parsed and type-checked (with physical dimensions) when a type definition is registered, then lowered to dotloom_constraints::Expr trees whose variables are symbolic leaves (properties, anchors of referenced entities, time-axis constants). The same compiled form is evaluated numerically for drawing and instantiated with solver variables for constraint solving, so the browser and native builds share one semantics. There is no eval and no callback into host code.

expr    := term (('+' | '-') term)*
term    := unary (('*' | '/') unary)*
unary   := '-' unary | postfix
postfix := primary ('.' ident)*
primary := number[unit] | ident | ident '(' args ')' | '(' expr ')'

Units on literals: mm cm m in ft deg rad ms s min h d. Values: scalars with a dimension, and 2D vectors (lowered to component pairs).

Structs§

Compiled
A compiled scalar or vector expression over Leaf inputs.
Scope
Names visible to an expression.

Enums§

Ast
Parsed expression.
Axis
Vector component.
Binding
What a name means while type-checking.
LangError
Errors from parsing or type-checking expressions.
Leaf
External inputs of compiled expressions.
Ty
Value type.

Functions§

compile
Parse, type-check and lower src in scope.
compile_as
Compile and require a type.
parse
Parse an expression.