Previous: extern data, Up: Types and Expressions [Contents][Index]
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-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-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-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.