13.1Overview
The Alf::Syntax::Expressions package contains the abstract syntax model for expressions. The syntax and semantics of expressions are discussed in Clause 8. Their mapping to UML is given in Clause 17.
Figure 13 82 Expressions and Qualified Names
Figure 13 83 Literal Expressions
Figure 13 84 Basic Primary Expressions
Figure 13 85 Invocation Expressions
Figure 13 86 Tuples
Figure 13 87 Sequence Expressions
Figure 13 88 Sequence Expansion Expressions
Figure 13 89 Increment and Decrement Expressions
Figure 13 90 Unary Expressions
Figure 13 91 Binary Expressions
Figure 13 92 Cast and Conditional-Test Expressions
Figure 13 93 Assignment Expressions
13.2.1ArithmeticExpression
A binary expression with an arithmetic operator.
Generalizations
Synthesized Properties
None
Derived Properties
Whether this is a string concatenation expression.
Constraints
[1] arithmeticExpressionIsConcatenationDerivation
An arithmetic expression is a string concatenation expression if its type is String.
[2] arithmeticExpressionLowerDerivation
An arithmetic expression has a multiplicity lower bound of 0 if the lower bound if either operand expression is 0 and 1 otherwise.
[3] arithmeticExpressionOperandTypes
The operands of an arithmetic expression must both have type Integer, unless the operator is +, in which case they may also both have type String.
[4] arithmeticExpressionTypeDerivation
The type of an arithmetic expression is the same as the type of its operands.
[5] arithmeticExpressionUpperDerivation
An arithmetic expression has a multiplicity upper bound of 1.
Helper Operations
None
13.2.2AssignmentExpression
An expression used to assign a value to a local name, parameter or property.
Generalizations
Synthesized Properties
-
leftHandSide : LeftHandSide
The left-hand side of the assignment, to which a value is to be assigned.
The image of the assignment operator used in the expression.
-
rightHandSide : Expression
The right-hand side expression of the assignment, which produces the value being assigned.
Derived Properties
-
assignment : AssignedSource [0..1]
If the left-hand side is a name, then the new assigned source for that name.
-
expression : Expression [0..1]
If this is a compound assignment, then the effective expression used to obtain the original value of the left-hand side to be updated.
-
feature : ElementReference [0..1]
If the left-hand side is a feature, then the referent for that feature.
If this is a compound assignment, whether the compound assignment operator is arithmetic or not.
-
isBitStringConversion : Boolean
Whether BitString conversion is required for this assignment.
-
isCollectionConversion : Boolean
Whether collection conversion is required for this assignment.
-
isDataValueUpdate : Boolean
Whether this assignment updates an attribute of a data value held in a local name or parameter.
Whether this assignment is the definition of a new local name or not.
Whether the left-hand side is a feature or not.
If the left-hand side is a feature, whether it has an index or not.
Whether this is a simple assignment or not.
Constraints
[1] assignmentExpressionAssignmentDerivation
The new assigned source for an assignment to a local name is the assignment expression. If the assignment is a definition, then the type is given by the right hand side, the multiplicity upper bound is 1 if the upper bound of the right hand side is 1 and otherwise * and the multiplicity lower bound is 0. Otherwise, the type and multiplicity are the same as the left hand side.
[2] assignmentExpressionAssignmentsBefore
The assigned source of a name before the right-hand side expression of an assignment expression is the same as the assigned source before the assignment expression. The assigned source of a name before the left-hand side is the assigned source after the right-hand side expression.
[3] assignmentExpressionCompoundAssignmentMultiplicityConformance
For a compound assignment, both the left-hand and right-hand sides must have a multiplicity upper bound of 1.
[4] assignmentExpressionCompoundAssignmentTypeConformance
For a compound assignment, both the left-hand side and the right-hand side must have the same type, consistent with the arithmetic or logical operator used in the compound assignment operator.
[5] assignmentExpressionExpressionDerivation
For a compound assignment, the effective expression is the left-hand side treated as a name expression, property access expression or sequence access expression, as appropriate for evaluation to obtain the original value to be updated.
[6] assignmentExpressionFeatureDerivation
If the left-hand side of an assignment expression is a feature, then the feature of the assignment is the referent of the left-hand side.
[7] assignmentExpressionIsArithmeticDerivation
An assignment expression is an arithmetic assignment if its operator is a compound assignment operator for an arithmetic operation.
[8] assignmentExpressionIsBitStringConversionDerivation
An assignment requires BitString conversion if the type of the left-hand side is BitString and either the type of the right-hand side is Integer or collection conversion is required and the type of the right-hand side is a collection class whose argument type is Integer.
[9] assignmentExpressionIsCollectionConversionDerivation
An assignment requires collection conversion if the type of the right-hand side is a collection class and its multiplicity upper bound is 1, and the type of the left-hand side is not a collection class.
[10] assignmentExpressionIsDataValueUpdateDerivation
An assignment expression is a data value update if its left hand side is an attribute of a data value held in a local name or parameter.
[11] assignmentExpressionIsDefinitionDerivation
An assignment expression is a definition if it is a simple assignment and its left hand side is a local name for which there is no assignment before the expression.
[12] assignmentExpressionIsFeatureDerivation
The left hand side of an assignment expression is a feature if it is a kind of FeatureLeftHandSide.
[13] assignmentExpressionIsIndexedDerivation
The left hand side of an assignment expression is indexed if it has an index.
[14] assignmentExpressionIsSimpleDerivation
An assignment expression is a simple assignment if the assignment operator is "=".
[15] assignmentExpressionLowerDerivation
An assignment expression has the same multiplicity lower bound as its right-hand side expression.
[16] assignmentExpressionSimpleAssignmentMultiplicityConformance
If the left-hand side of a simple assignment is not a new local name and the multiplicity upper bound of the left-hand side is less than or equal to 1, then the multiplicity upper bound of the right-hand side cannot be greater than that of the left-hand side.
[17] assignmentExpressionSimpleAssignmentTypeConformance
If the left-hand side of a simple assignment is not a new local name, and the right-hand side is not null, then the left-hand side must either be untyped or have a type that conforms to the type of the right-hand side expression.
[18] assignmentExpressionTypeDerivation
An assignment expression has the same type as its right-hand side expression.
[19] assignmentExpressionUpperDerivation
An assignment expression has the same multiplicity upper bound as its right-hand side expression.
Helper Operations
[1] updateAssignments ( ) : AssignedSource [*]
The assignments after an assignment expression are the assignments after the left-hand side, updated by the assignment from the assignment statement, if any.
Share with your friends: |