Lossless einops syntax trees #
The AST preserves grouping, unit axes, anonymous-axis occurrences, and source
locations. This is more informative than the reference implementation's
internal ParsedExpression, which erases unit axes while parsing.
An elementary axis in a transformation expression.
Anonymous axes carry an occurrence number because two textual occurrences of the same numeral denote distinct axes in einops.
- named
(name : String)
: Axis
A logical axis identified by the user's name.
- anonymous
(value occurrence : Nat)
: Axis
A numeric axis, distinguished by its occurrence in the source pattern.
- unit : Axis
A length-one axis written as
1. - ellipsis : Axis
The
...axis that stands for zero or more physical dimensions.
Instances For
Instances For
Instances For
Instances For
Unit axes disappear from the elementary-axis sequence.
Instances For
Whether this composition contains an ellipsis.
Instances For
One side of a transformation or einsum pattern.
- axes : List CompositeAxis
Top-level physical axes in source order.
- span : Span
Source range covering the complete expression.
Instances For
Instances For
Instances For
Elementary axes after removing syntactic unit axes.
Instances For
Named axes in source order, including repeated occurrences when allowed.
Instances For
The number of ellipses in an expression.
Instances For
Whether an ellipsis occurs inside parentheses.
Instances For
Whether an expression contains a genuine composite axis.
Instances For
The shared syntax of rearrange, repeat, and reduce.
- left : Expression
Input-side expression.
- arrow : Span
Source range of the
->token. - right : Expression
Output-side expression.
- span : Span
Source range covering the complete transformation pattern.
Instances For
Instances For
Instances For
Instances For
Instances For
The multi-input grammar used by einsum.
- inputs : List Expression
Comma-separated operand expressions in source order.
- arrow : Span
Source range of the
->token. - output : Expression
Output expression following the arrow.
- span : Span
Source range covering the complete einsum pattern.