internal library
What a host language built on the expression language reads: the recursive-descent ExpressionParser it extends, the ExpressionTokens it walks, and the operator arithmetic every evaluator of the language shares (applyExpressionOperator, broadcastExpressionArguments).
For the engine's own packages; not covered by semver for
applications. flutter3d_core's material language extends the parser
and evaluates through the shared arithmetic, so the two read and compute
the same language. The parser's hooks, its cursor and its token kinds
follow the grammar, and a minor that grows the grammar may change them.
An application reads expressions through parseExpression and the
types package:flutter3d_foundation/flutter3d_foundation.dart names.
This is a library of its own rather than src/ imports so that what the
core depends on is in the API snapshot, and a change shows in review.
Outside semver, and safe because of how the engine depends on it. The
engine's packages ask for each other within one minor
('>=1.0.0 <1.1.0'), so a foundation 1.1 that changes the parser never
resolves under a core 1.0 built against the parser before it. The API
classifier reads a change here as a minor's (CONTRIBUTING, "The API is a
snapshot").
flutter3d_physics_native compiles laws and probes' expressions to the
internal bytecode (ExpressionBytecode) its C interpreter runs, so the
core evaluates them without Dart; the format stays internal in 1.0 and
carries its version in its header.
Classes
- ExpressionBytecode
- A compiled program: straight-line instructions over lanes of doubles.
- ExpressionBytecodeInput
- One input of a program: a variable's name, the lanes the host writes it into, and its type.
- ExpressionParser
- The parser: a cursor over tokens, the expression grammar, and two hooks a host language overrides.
- ExpressionToken
- One token of a source.
Constants
- expressionBytecodeVersion → const int
- The version of the bytecode format this build writes and reads.
-
expressionOperators
→ const List<
String> - Every binary operator, loosest-binding first within each group.
Functions
-
applyExpressionOperator(
String op, List< double> a, List<double> b) → List<double> - A binary operator on two values, with GLSL's broadcasting: a one-component value beside a wider one is spread across it.
-
broadcastExpressionArguments(
List< List< arguments, ExpressionBuiltin builtin) → List<double> >List< double> > - Spreads a one-component argument across the widest one, for the builtins that take a float beside a vector.
-
tokenizeExpression(
String source, {ExpressionSyntax syntax = ExpressionSyntax.standard}) → List< ExpressionToken> -
sourceas tokens, ending with one of kindend.
Exceptions / Errors
- ExpressionBytecodeException
- Thrown by ExpressionBytecode.verify and ExpressionBytecode.decode for a program that is not well formed, or whose units do not add up: bytes that are not what they claim to be, so a Flutter3dFormatException.