Module expression

Source
Expand description

This module contains the AST representation for expressions in the SAP language.

An expression is a combination of one or more values, variables, operators, and functions that evaluates to a single value. The AST nodes in this module represent the different types of expressions that are supported in the SAP language.

Expressions are used in the language to perform calculations, make decisions, and manipulate data. They can be used as standalone statements, or as part of larger expressions or statements.

Note: The Box type is used to indicate that the data enclosed is stored on the heap, rather than on the stack. This is necessary because otherwise the compiler needs to know the size of the expression at compile time, which is not possible for recursive data structures like the AST.

Structs§

Array
Represents an array expression in the SAP language. For example: [1, 2, 3, 4, 5]
Binary
Represents a binary expression in the SAP language. For example: x + 5
FunctionCall
Represents a function call expression in the SAP language. For example: add(5, 10)
Identifier
Represents an identifier in the SAP language. For example: x
Index
Represents an index expression in the SAP language. For example: arr[0]
Selection
Represents a selection expression in the SAP language. For example:
Unary
Represents a unary expression in the SAP language. For example: -x

Enums§

Expression
Represents a single expression in the SAP language.