NORMA_DD (1158356), страница 11
Текст из файла (страница 11)
out-parameter :
name-scalar espis2
name-variable-on-domain ON domain-of-parameter espis3,espis4
iterated-variable-on-domain ON domain-of-parameter espis7,espis8
iterated-scalar espis5
This function checks if parameters call-part are allowable and constructs dependencies param-dependency, required to put them into Table of functional dependencies. Besides for out-parameter:
function dopkdc puts information about parameter into What-compute table, setting value <statement number> equal to the value of the top of stack nom,
function dopgdc puts information about parameter into Where-compute table, setting value <statement number> equal to the value of the top of stack nom.
Function paramt fixes errors:
error code 212 'incorrect parameter-result of part '<error context>
error code 213 'missed parameter of part'
error code 214 'incorrect parameter of part: '<error context>' is not declared or declared twice’'
error code 216 'incorrect parameter-result of part '<error context> ': computation on precede (-1) step of ITERATION'
error code 217 'incorrect parameter-result of part : reassignment '<error context>
error code 218 'incorrect parameter of part : incorrect variable'<error context>
error code 219 'incorrect parameter of part : domain'<error context>' is conditional’'
error code 220 'incorrect parameter-result of part :’ <error context>' is not iterated'’
error code 222 'incorrect parameter of part : domain of parameter'<error context>' is not in declaration domain’'
error code 223 'incorrect parameter of part : index' <error context>' with two conditions'
error code 225 'incorrect parameter of part :variable'<error context>' has not index’ <error context>
error code 226 'incorrect parameter of part : domain of operator ASSUME has not index '<error context>' of variable’<error context>
error code 229 'incorrect parameter of part : incorrect condition’ <error context>' on domain’'
error code 230 'incorrect parameter of part : incorrect index’ <error context>' in condition’'
error code 231 'incorrect parameter of part : incorrect variable’ <error context>' in condition on index ’ <error context>
error code 233 'incorrect parameter of part : incorrect condition on index’ <error context>' of variable’'<error context>
Function obrraz makes the value of field <parameter-dependencies> of Table of functional dependencies from the list of dependencies <param-dependency> built by function paramt.
Function zapf puts information about parameter into Table of functional dependencies and the body of operator into Table of operators body.
5.3.6Iteration processing (function kbiter)
It analyses and processes iteration. Syntax in Norma language:
iteration :
head-of-iteration
[ boundary-value ]
initial-value
body-of-iteration
exit-condition
end-iteration
Function receives current declaration of iteration represented in List of iterations, and calls function kb1.
General structure of function kbiter control is given in the following scheme
k
biter iterzag itergr iternzn itpolag itexit
kvo1it kvo1it kvo1it
5.3.6.1Additional data structures for processing of iteration
In processing iteration following additional data structures are used.
Stack ite, its top contains <iteration number> of processed iteration. It is used in processing embedded iteration.
Attribute env, determining the type of environment: env =’B’ in processing boundary-value, env =’H’ in processing initial-value, env =’P’ in processing body-of-iteration.
Table of iterated variables is used for holding names of iterated variables and corresponding names of variables-results ( from the previous and current steps of iteration). It is used for optimisation of processing iterated variables. Structure of line from Table of iterated variables:
| iterated variable name | first result variable name | second result variable name |
Table of copy operators is used for holding information about additional operators generated by compiler in realisation of construction iteration.
Variable-results are introduced for holding values of each iterated variable in Fortran-program generated by compiler (first result variable - for holding values from iteration step n, and second result variable - for holding values from iteration step n-1). After finishing each step of iteration ( each stage of cycle in Fortran -program) it is necessary to provide copying values of second result variable into first result variable. For this purpose compiler generates copy operator which <statement number> is held in Table of copy operators. After establishing the order of operators' execution by the compiler copy operators are put into corresponding place of Fortran-program.
Structure of line from Table of copy operators:
| iteration number | <statement number><ref-on-body> | … | <statement number><ref-on-body> |
<statement number>::=<integer>
<ref-on-body>::=<reference in Table of operators body >
5.3.6.2Processing of head-of-iteration (function iterzag)
Norma syntax:
head-of-iteration :
ITERATION list-iterated-element ON name-iteration-index .
iterated-element :
name-variable [ ( list-name-result ) ]
Function puts <iteration number> into stack ite, analyses head-of-iteration, and specified the variables from list-name-result in ymbol table.
Function fixes error:
error code 53 'incorrect list element of iterated variables'<error context>
5.3.6.3Processing of boundary-value (function itergr)
It sets env =’B’ and calls function kvo1it of processing Norma-statements included into iteration.
5.3.6.4Processing of initial-value (function iternzn)
It sets env =’H’ and calls function kvo1it of processing Norma-statements included into iteration.
5.3.6.5Processing of body-of-iteration (function itpolag)
It sets env =’P’ and calls function kvo1it of processing Norma-statements included into iteration.
5.3.6.6Processing of Norma-statements included into iteration (function kvo1it)
Function kvo1it is similar to function kvopr1 (see 5.3.5)
scopit
k
vo1it kvit
kvo2i
Function kvo1it calls functions scopit (processing scalar-operator, analogue of function scop (see 5.3.5.1)), kvit (processing operator-ASSUME, analogue of function opv6 (see 5.3.5.2)) or kvo2i (processing call-part in operator-ASSUME or out of operator-ASSUME, analogue of function kvo2 (see 5.3.5.3)) depending on the type of operator.
These functions differ from their analogies by the operations which are to be done during termination of operator's processing.
If computed in the operator variable isn't iterated variable there is no need in additional operations.
If computed in the operator variable is iterated variable additional operations are done for concordance between iterated variable name and result variable name.
For the operators set in initial-value, it is necessary to substitute iterated variable name in the left part of the operator for result variable name and to put information into Table of functional dependencies, What-compute table and Where-compute table considering this substitution.
For the operators from body-of-iteration function perzap generates copy operator for iterated variable. Function perzap puts text of operator in the form of sequence of tokens into group g of List of Norma statements and Table of operators body, and it also puts information about operator into Table of copy operators.
5.3.6.7Processing exit-condition (function itexit)
Norma syntax:
exit-condition :
EXIT WHEN log-expression
Construction exit-condition is considered as scalar-operator with left empty part.
Function analyses log-expression, calling function b1 and a (see 5.3.5.1), puts information (calling function zapf) into Table of functional dependencies and body of log-expression into Table of operators body.
Top of stack ite is cleaned.
5.4Data dependencies graph builder
Function graf is an entry point of unit Data dependencies graph builder , it is called by EndLex of unit Part unit scanner if errors haven't been detected at the previous stages of translation (i.e. error counter osh=0).
Data dependencies graph builder consists of two main blocks:
-
DDG constructor.
Functions: data dependencies graph (DDG) creation, entry point graf.
-
RDDG constructor.
Functions: reduced data dependencies graph (RDDG) creation, entry point mssg.
Structure of unit Data dependencies graph builder control:
g
raf mssg pord
Function pord - entry point of unit Data dependencies graph analyser
5.4.1DDG constructor
Entry point of unit DDG constructor is function graf. General structure of function graf control is given in the following scheme.
g
raf reassign strdep pre posl test
Function reassign checks characteristic of single assignment: any variable can be computed in any point of its definitional domain no more than once. Source information for checking this characteristic is Where-compute table. Following operations are done for this table.















