Skip to content

5.1. Base Expressions#

Syntax#


Expression = (* variant: *) AssignmentExpression
| (* variant: *) ConditionalExpression
| (* variant: *) OrExpression
| (* variant: *) AndExpression
| (* variant: *) EqualityExpression
| (* variant: *) ComparisonExpression
| (* variant: *) BitwiseOrExpression
| (* variant: *) BitwiseXorExpression
| (* variant: *) BitwiseAndExpression
| (* variant: *) ShiftExpression
| (* variant: *) AdditiveExpression
| (* variant: *) MultiplicativeExpression
| (* variant: *) ExponentiationExpression
| (* variant: *) PostfixExpression
| (* variant: *) PrefixExpression
| (* variant: *) FunctionCallExpression
| (* variant: *) CallOptionsExpression
| (* variant: *) MemberAccessExpression
| (* variant: *) IndexAccessExpression
| (* variant: *) NewExpression
| (* variant: *) TupleExpression
| (* variant: *) TypeExpression (* Introduced in 0.5.3 *)
| (* variant: *) ArrayExpression
| (* variant: *) HexNumberExpression
| (* variant: *) DecimalNumberExpression
| (* variant: *) StringExpression
| (* variant: *) ElementaryType
| (* variant: *) PAYABLE_KEYWORD (* Introduced in 0.6.0 *)
| (* variant: *) TRUE_KEYWORD
| (* variant: *) FALSE_KEYWORD
| (* variant: *) IDENTIFIER;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) BAR_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) PLUS_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) MINUS_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) CARET_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) SLASH_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) PERCENT_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) AMPERSAND_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN_LESS_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AssignmentExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN_GREATER_THAN_EQUAL
(* right_operand: *) Expression;

(* Postfix unary operator *)
ConditionalExpression = (* operand: *) Expression
(* question_mark: *) QUESTION_MARK
(* true_expression: *) Expression
(* colon: *) COLON
(* false_expression: *) Expression;

(* Left-associative binary operator *)
OrExpression = (* left_operand: *) Expression
(* operator: *) BAR_BAR
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AndExpression = (* left_operand: *) Expression
(* operator: *) AMPERSAND_AMPERSAND
(* right_operand: *) Expression;

(* Left-associative binary operator *)
EqualityExpression = (* left_operand: *) Expression
(* operator: *) EQUAL_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
EqualityExpression = (* left_operand: *) Expression
(* operator: *) BANG_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ComparisonExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_EQUAL
(* right_operand: *) Expression;

(* Left-associative binary operator *)
BitwiseOrExpression = (* left_operand: *) Expression
(* operator: *) BAR
(* right_operand: *) Expression;

(* Left-associative binary operator *)
BitwiseXorExpression = (* left_operand: *) Expression
(* operator: *) CARET
(* right_operand: *) Expression;

(* Left-associative binary operator *)
BitwiseAndExpression = (* left_operand: *) Expression
(* operator: *) AMPERSAND
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ShiftExpression = (* left_operand: *) Expression
(* operator: *) LESS_THAN_LESS_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ShiftExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
ShiftExpression = (* left_operand: *) Expression
(* operator: *) GREATER_THAN_GREATER_THAN_GREATER_THAN
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AdditiveExpression = (* left_operand: *) Expression
(* operator: *) PLUS
(* right_operand: *) Expression;

(* Left-associative binary operator *)
AdditiveExpression = (* left_operand: *) Expression
(* operator: *) MINUS
(* right_operand: *) Expression;

(* Left-associative binary operator *)
MultiplicativeExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK
(* right_operand: *) Expression;

(* Left-associative binary operator *)
MultiplicativeExpression = (* left_operand: *) Expression
(* operator: *) SLASH
(* right_operand: *) Expression;

(* Left-associative binary operator *)
MultiplicativeExpression = (* left_operand: *) Expression
(* operator: *) PERCENT
(* right_operand: *) Expression;

(* Left-associative binary operator *)
(* Deprecated in 0.8.0 *)
ExponentiationExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK_ASTERISK
(* right_operand: *) Expression;

(* Right-associative binary operator *)
(* Introduced in 0.8.0 *)
ExponentiationExpression = (* left_operand: *) Expression
(* operator: *) ASTERISK_ASTERISK
(* right_operand: *) Expression;

(* Postfix unary operator *)
PostfixExpression = (* operand: *) Expression
(* operator: *) PLUS_PLUS;

(* Postfix unary operator *)
PostfixExpression = (* operand: *) Expression
(* operator: *) MINUS_MINUS;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) PLUS_PLUS
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) MINUS_MINUS
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) TILDE
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) BANG
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) MINUS
(* operand: *) Expression;

(* Prefix unary operator *)
(* Deprecated in 0.5.0 *)
PrefixExpression = (* operator: *) PLUS
(* operand: *) Expression;

(* Prefix unary operator *)
PrefixExpression = (* operator: *) DELETE_KEYWORD
(* operand: *) Expression;

(* Postfix unary operator *)
FunctionCallExpression = (* operand: *) Expression
(* arguments: *) ArgumentsDeclaration;

(* Postfix unary operator *)
(* Introduced in 0.6.2 *)
CallOptionsExpression = (* operand: *) Expression
(* open_brace: *) OPEN_BRACE
(* options: *) CallOptions
(* close_brace: *) CLOSE_BRACE;

(* Postfix unary operator *)
MemberAccessExpression = (* operand: *) Expression
(* period: *) PERIOD
(* member: *) IDENTIFIER;

(* Postfix unary operator *)
MemberAccessExpression = (* operand: *) Expression
(* period: *) PERIOD
(* member: *) ADDRESS_KEYWORD;

(* Postfix unary operator *)
IndexAccessExpression = (* operand: *) Expression
(* open_bracket: *) OPEN_BRACKET
(* start: *) Expression?
(* end: *) IndexAccessEnd?
(* close_bracket: *) CLOSE_BRACKET;

IndexAccessEnd = (* colon: *) COLON
(* end: *) Expression?;

Documentation#

Note

This section is under construction. You are more than welcome to contribute suggestions to our GitHub repository.