Previous: , Up: Types and Expressions   [Contents][Index]


10.3.6 Expressions

Expressions in Dezyne are strictly typed.

expression ::= bool-expression | data-expression | enum-expression
                | integer-expression

Note: The well-formedness check (See Well-formedness) verifies that expressions are of the correct type.

Bool Expressions

bool-expression ::= bool-literal
                     | bool-variable
                     | action
                     | call
                     | field-test
                     | "!" bool-expression
                     | "(" bool-expression ")"
                     | bool-expression bool-operator bool-expression
                     | int-expression comparison-operator int-expression
bool-variable   ::= identifier | port "." identifier
bool-literal    ::= "false" | "true"
field-test      ::= enum-variable "." enum-field
enum-variable   ::= identifier | port "." identifier
bool-operator   ::= "==" | "!=" | "&&" | "||"
comparison-operator
                ::= "==" | "!=" | "<" | "<=" | ">" | ">="

where action and call are of type bool.

Enum Expressions

enum-expression ::= enum-literal
                     | enum-variable
                     | action
                     | call
enum-literal    ::= enum "." field
enum-variable   ::= identifier | port "." identifier

where action and call are of the correct enum type.

Int Expressions

int-expression  ::= int-literal
                      | subint-variable
                      | action
                      | call
                      | "-" int-expression
                      | "(" int-expression ")"
                      | int-expression int-operator int-expression
subint-variable ::= identifier | port "." identifier
int-literal     ::= "-"? [0-9]+
int-operator    ::= "+" | "-"

where action and call are of a subint type.