Enum rtlola_hir::hir::ExpressionKind
source · pub enum ExpressionKind {
LoadConstant(Constant),
ArithLog(ArithLogOp, Vec<Expression>),
StreamAccess(StreamReference, StreamAccessKind, Vec<Expression>),
ParameterAccess(StreamReference, usize),
Ite {
condition: Box<Expression>,
consequence: Box<Expression>,
alternative: Box<Expression>,
},
Tuple(Vec<Expression>),
TupleAccess(Box<Expression>, usize),
Function(FnExprKind),
Widen(WidenExprKind),
Default {
expr: Box<Expression>,
default: Box<Expression>,
},
}
Expand description
The kinds of an Expression of the RtLolaHir.
Variants§
LoadConstant(Constant)
Loading a Constant
ArithLog(ArithLogOp, Vec<Expression>)
Applying arithmetic or logic operation
The first argument contains the operator of type ArithLogOp, the second arguments contains the arguments of the operation, which are Expressions. The vectors is structured as: Unary: 1st argument -> operand Binary: 1st argument -> lhs, 2nd argument -> rhs n-ary: kth argument -> kth operand
StreamAccess(StreamReference, StreamAccessKind, Vec<Expression>)
Accessing another stream
A stream access has the following arguments:
- the StreamReference of the stream that is accessed
- the StreamAccessKind of the stream access, e.g. an offset access
- the argmuents for parametrized stream accesses. This vector is empty if the stream that is accessed is not parametrized.
ParameterAccess(StreamReference, usize)
Accessing the n’th parameter of a parameterized stream
This kind represents the access of a parameterized stream. For this, we use the folloing arguments:
- the first argument contains the StreamReference of the parametrized stream that is accessed
- the second argument contains the index of the parameter.
Ite
Fields
condition: Box<Expression>
The condition of the if-then-else expression.
consequence: Box<Expression>
The consequence of the if-then-else expression.
alternative: Box<Expression>
The alternative of the if-then-else expression.
An if-then-else expression
If the condition evaluates to true, the consequence is executed otherwise the alternative. All arguments are an Expression.
Tuple(Vec<Expression>)
A tuple expression.
TupleAccess(Box<Expression>, usize)
Represents an access to a tuple element
The second argument indicates the index of the accessed element, while the first produces the accessed tuple.
Function(FnExprKind)
A function call with its monomorphic type
Widen(WidenExprKind)
A function call to widen the type of an Expression
Default
Fields
expr: Box<Expression>
The expression that results in an optional value
default: Box<Expression>
An infallible expression providing a default value of expr
evaluates to None
Represents the transformation of an optional value into a “normal” one
Trait Implementations§
source§impl Clone for ExpressionKind
impl Clone for ExpressionKind
source§fn clone(&self) -> ExpressionKind
fn clone(&self) -> ExpressionKind
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more