Grammar Reference¶
Note
The information on this page is mostly relevant to advanced users and developers.
Embedded Domain-Specific Language (eDSL) for Tensor Expressions¶
As we have seen earlier, a FunFact tensor expressions (tsrex) can be expressed using a hybrid of:
- index notations that extends the Einstein summation convention, and
- NumPy-style operations.
This expression system essentially implements a domain-specific language (eDSL) embedded in Python. The formal grammar for this eDSL is:
- An elementwise function evaluation of a tensor expression yields a new tensor expression.
- Binary operations between two tensor expressions yields a new tensor expression.
- Unary operations on a tensor expression yields a new tensor expression.
- An index notation is by itself a tensor expression.
- A tensor is by itself a tensor expression.
- A literal value is by itself a tensor expression.