Expressions
Expressions are the combination of variables, operands, and operators. Expressions are processed based on the operator's precedence.
Syntax
expression-statement
:
expression
;
expression
:
assignement-expression
Assignement Expressions
In assignment, the type of the right-hand value is converted to the type of the left-hand value, and the value is stored in the left operand after the assignment has taken place.
Syntax
assignement-expression
:
binary-expression
identifier
assignment-operator
assignement-expression
unary-expression
function-call
Example
Binary Expressions
A binary expression contains two operands separated by one operator.
Syntax
binary-expression
:
number
binary-operator
( expression
| number
)
Example
Unary Expressions
Syntax
unary-expression
:
identifier
unary-operator
Example
Last updated