ImpliedDoLoop¶
A loop that contributes several values to an array constructor or I/O list.
Declaration¶
Syntax¶
ImpliedDoLoop(expr* values, expr var, expr start, expr end,
expr? increment, ttype type, expr? value)
Arguments¶
Argument |
Description |
|---|---|
|
the expressions produced for each iteration. |
|
the loop variable. |
|
the first value of the loop variable. |
|
the last value. |
|
the step, or |
|
the type of the expression. |
|
the compile time value of the expression, when the frontend could fold it; |
Return values¶
The value of the expression.
Description¶
(i, i=1,3) inside an array constructor, or inside the input or output list
of an I/O statement. It is an expression rather than a statement because it
appears where values are expected and produces a sequence of them.
The loop variable is local to the construct: it exists only while the values are being produced.
Examples¶
(ImpliedDoLoop
:values [
(Var
:v (SymbolRef 1 "i")
)
]
:var (Var
:v (SymbolRef 1 "i")
)
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:end (IntegerConstant
:n 3
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:increment nil
:type (Integer
:kind 4
)
:value nil
)
It comes from this complete ASR text document:
(TranslationUnit
:symtab (SymbolTable
:id 0
:symbols {
"main" (Program
:symtab (SymbolTable
:id 1
:symbols {
"a" (Variable
:parent_symtab 1
:name "a"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Array
:type (Integer
:kind 4
)
:dims [
(dimension
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:length (IntegerConstant
:n 3
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
]
:physical_type :FixedSizeArray
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
"i" (Variable
:parent_symtab 1
:name "i"
:dependencies []
:intent :Local
:symbolic_value nil
:value nil
:storage :Default
:type (Integer
:kind 4
)
:type_declaration nil
:abi :Source
:access :Public
:presence :Required
:value_attr false
:target_attr false
:contiguous_attr false
:bindc_name nil
:is_volatile false
:is_protected false
:pass_attr :NotMethod
:self_argument nil
:codims []
)
}
)
:name "main"
:dependencies []
:body [
(Assignment
:target (Var
:v (SymbolRef 1 "a")
)
:value (ArrayConstructor
:args [
(ImpliedDoLoop
:values [
(Var
:v (SymbolRef 1 "i")
)
]
:var (Var
:v (SymbolRef 1 "i")
)
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:end (IntegerConstant
:n 3
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:increment nil
:type (Integer
:kind 4
)
:value nil
)
]
:type (Array
:type (Integer
:kind 4
)
:dims [
(dimension
:start (IntegerConstant
:n 1
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
:length (IntegerConstant
:n 3
:type (Integer
:kind 4
)
:intboz_type :Decimal
)
)
]
:physical_type :FixedSizeArray
)
:value nil
:storage_format :ColMajor
:struct_var nil
)
:overloaded nil
:realloc_lhs false
:move_allocation false
)
]
)
}
)
:items []
)