Partager via


Expression

Expressions in Cord are used to represent arguments in an Invocation.

Syntax Definition

Expression ::= ( Type ) Expression | QualIdent | Literal | _ | Domain | StructuredValue .
StructuredValue ::= Type ( StructuredValueArgumentList | StructuredValueCollectionSpec ) .
StructuredValueArgumentList ::= ( [ NamedPatternList ] ) .
StructuredValueCollectionSpec ::= { [ MapletOrExprList ] } .
NamedPatternList ::= NamedPattern { , NamedPattern } .
NamedPattern ::= Ident = Expression .
MapletOrExprList ::= Expression { , Expression } | Maplet { , Maplet } .
Maplet ::= Expression -> Expression .
QualIdent ::= QualIdent . Ident | Ident .

Remarks

Type in parentheses is used for type casts. Qualified identifiers (QualIdent) are used for local variables and their fields or constants, such as in an enumerated type. The underscore (_), when used as an expression, stands for any value: it has the same meaning as an unnamed local variable, typed by context, with each underscore representing a different variable. A NamedPattern is used to represent a mapping from field name to field value, in the context of the structure or compound value. MapletOrExprList is a list of expressions or maplets. Expression lists represent elements in an instance of the Set (Set) or the Sequence (Sequence) class. Maplet lists represent elements in an instance of the Map class (Map), declared in the Modeling Library. A Maplet is used to represent a key-value pair in the context of the Map class. Both key and value can be expressions.

See Also

Reference

Invocation
Type
Domain
CordScript

Concepts

Cord Syntax Definition

Other Resources

Cord Scripting Language