The expression.py module#

Summary#

ExpressionTree

Provides the top-level abstract class for expression trees.

EmptyTreeError

Provides the exception for empty expression trees.

ExprSyntaxError

Provides the generic exception for syntax errors in expression trees.

TypeIdentifierError

Provides the exception for incorrect identifiers.

create_activate

Return the expression tree for the higher-order construct for activating with initial values.

create_activate_no_init

Return the expression tree for the higher-order construct for activating with default values.

create_binary

Return the expression tree for a binary operator.

create_call

Return the expression tree for a call to an operator.

create_case

Return the expression tree for the case operator.

create_change_ith

Return the expression tree for the with operator.

create_concat

Return the expression tree for the concat operator.

create_data_array

Return the expression tree for the data array operator.

create_data_struct

Return the expression tree for the data strictire operator.

create_fby

Return the expression tree for the init operator.

create_flatten

Return the expression tree for flattening a structured value.

create_fold

Return the expression tree for the higher-order construct for fold creation.

create_foldi

Return the expression tree for the higher-order construct for foldi creation.

create_foldw

Return the expression tree for the higher-order construct for foldw creation.

create_foldwi

Return the expression tree for the higher-order construct for foldwi creation.

create_higher_order_call

Return the expression tree for a call to an operator.

create_if

Return the expression tree for the if-then-else operator.

create_init

Return the expression tree for the init operator.

create_make

Return the expression tree for making a structured value.

create_map

Return the expression tree for the higher-order construct for map creation.

create_mapfold

Return the expression tree for the higher-order construct for mapfold creation.

create_mapfoldi

Return the expression tree for the higher-order construct for mapfoldi creation.

create_mapfoldw

Return the expression tree for the higher-order construct for mapfoldw creation.

create_mapfoldwi

Return the expression tree for the higher-order construct for mapfoldwi creation.

create_mapi

Return the expression tree for the higher-order construct for mapi creation.

create_mapw

Return the expression tree for the higher-order construct for mapw creation.

create_mapwi

Return the expression tree for the higher-order construct for mapdwi creation.

create_nary

Return the expression tree for a nary operator.

create_pre

Return the expression tree for the pre operator.

create_prj

Return the expression tree for the projection operator.

create_prj_dyn

Return the expression tree for the dynamic projection operator.

create_restart

Return the expression tree for the higher-order construct for restarting.

create_reverse

Return the expression tree for the reverse operator.

create_scalar_to_vector

Return the expression tree for the scalar-to-vector operator.

create_slice

Return the expression tree for the slice operator.

create_times

Return the expression tree for the times operator.

create_transpose

Return the expression tree for the transpose operator.

create_unary

Return the expression tree for a unary operator.

ET

Short name for an ExpressionTree instance to simplify the declarations.

EX

Extended expression tree to simplify use of the create functions.

LX

Extended lists of expression trees to simply the use of create functions.

Description#

Provides helpers for creating expression trees.

Expression trees are intermediate structures to declare any arbitrary complex expressions. They create the corresponding SCADE Suite expressions in the context of a model element, such as the right part of an equation or the default value of an output.

This module provides functions to create an expression tree for any expression of the Scade language, including higher-order constructs. Thus, the intermediate structures or classes defining the expression trees can be opaque.

Notes: The typing is relaxed in this module to ease the constructs.

  • ET is an alias for ExpressionTree to shorten the declarations.

  • EX, which stands for extended expression tree, is defined as follows:

    Union[bool, int, float, str, suite.ConstVar, suite.NamedType, ET]
    

    This enhances the usability of these functions by accepting some values, such as Python literals, string values, or SCADE Python objects, as valid expression trees.

  • LX, which stands for extended lists of expression trees, is defined as follows:

    Union[EX, List[EX]]
    

    When the expressions accept an arbitrary number of input flows, such as if-then-else or fby, you can provide either one expression tree or a list of expression trees.

Module detail#

ET#

Short name for an ExpressionTree instance to simplify the declarations.

EX#

Extended expression tree to simplify use of the create functions.

LX#

Extended lists of expression trees to simply the use of create functions.