Chapter 3. Names and Expressions

Table of Contents

3.1. Names
3.1.1. Attributes
3.1.2. Indexed Components
3.1.3. Selected Components
3.2. Function Calls
3.3. Expressions

This chapter specifies the syntax and semantics of names and expressions.

3.1. Names

Names are used to denote a variety of entities within a Comma program. Names can refer to declared entities such as signatures, domains and types. Other examples include indexed and selected components, subroutine formal parameters, object declarations, the result of function calls, type conversions, and attributes applied (recursively) to a name.

[23]Name::= Direct_Name | Function_Call | Indexed_Component | Selected_Component | Attribute_Mark | Inj | Prj | Character_Literal  
[24]Direct_Name::= Identifier  

3.1.1. Attributes

[25]Attribute_Mark::= Name ' Identifier Range Attributes

[26]Range_Attribute_Mark::= Name ' Range [ ( Expression ) ]  

For a range attribute mark of the form X'Range(N) the prefix X must denote a scalar subtype, a constrained array subtype, or a value of array type.

When the prefix X denotes a scalar subtype a range arribute mark of the form X'Range is equivalent to X'First .. X'Last. An argument may not be supplied.

When the prefix X denotes a constrained array subtype or a value of some array type then the argument, if present, must be a static integer expression. If an argument is not supplied a then an implicit default argument of 0 is used. A range attribute mark of the form X'Range(N) is equivalent to a range A'First(N) .. A'Last(N), with the exception that the prefix is evaluated only once.

3.1.2. Indexed Components

Indexed Components
[27]Indexed_Component::= Name ( Expression [ , Expression ] )  

3.1.3. Selected Components

Selected Components
[28]Selected_Component::= Name . Selected_Name  
[29]Selected_Name::= Identifier | Character_Literal  

3.2. Function Calls

A function call represent the invocation of a subroutine that returns a value as the result of normal exectution. Function call expressions may provide key associations which map the actual parameters of the call to the corresponding formal parameters.

Function Calls
[30]Function_Call::= Name ( Key_Association [ , Key_Association ] )  
[31]Key_Association::= [ Identifier => ] Expression  

3.3. Expressions

[32]Expression::= Name