NORMA_DD (1158356), страница 14
Текст из файла (страница 14)
m
s sp_new begk
<statement numbers> of operators included into MSCS are chosen from List of MSCS function sp_nem is called.
Function sp_new analyses index expressions of the variables included into в MSCS finds index with all index displacements ³ 0 (or all £ 0). The name of this index is fixed in list newsps (this information will be used in generation of DO loops while the operators included into MSCS are being realised). Then function begk with parameter <statement numbers> of the operators included into MSCS is called for their realisation.
5.6.4MSCS node realisation (function mssv)
Function mssv is used for realisation of the node of <parallel layer scheme> of type <ordered group number>.
General structure of function mssv control is given in the following scheme
m
ssv begk
<Statement numbers> of the operators included into ordered group are chosen by Table of ordered groups and function begk is called for their realisation.
5.7Fortran DVM code generator
Entry point of unit Fortran DVM code generator is function forprint.
General structure of function forprint control is given in the following scheme.
f
orprint serial-head makedimension description
dvm-declaration fp
Function forprint analyses output mode lst and the value of error counter osh in Norma part unit. For lst=2,3 and osh=0 functions of generating text representation and outputting Fortran-program into output file <target-file> are called.
Function serial-head designs operators PROGRAM or SUBROUTINE or FUNCTION in format Intermediate representation of Fortran DVM program, (List FORT), using additional structures such as part parameters list and part type record.
Function makedimension designs arrays' declarations in format Intermediate representation of Fortran DVM program, (List FORT) using Symbol table .
Function description designs declarations of simple variables and external names in format Intermediate representation of Fortran DVM program, (List FORT) using Symbol table.
Function dvm-declaration designs declarations of PROCESSORS, ALIGN, DISTRIBUTE in special comments HPF and DVM format of Intermediate representation of Fortran DVM program, (List FORT) using Table of distributed variables and Table of distribution indexes.
Function fp processes obtained by the previous functions operators and declarations, it also processes List FORT created in the process of unit Fortran DVM intermediate representation generator work. Processing means to translate <fortran-statements> represented as <sequence of token codes> into <sequence of symbols>, to divide <sequence of symbols> into lines according to the rules of Fortran program representation and to pass these lines to function info (unit Listing generator) for output into output file <target-file>.
5.8Input files analyser
Entry point of unit Input files analyser is function isiofile. Besides input data themselves input files in Norma language contain names of variables which these data are to obtain as their values. It could be explained by the fact that compiler orders input operators execution and it is to order input files according to the order of the operators.
Syntax of input files in Norma language:
file :
input-element { input-element }*
input-element :
name-scalar = arithm-constant;
name-variable-on-domain ( list-index-range ) = data ;
index-range :
name-index = int-constant .. int-constant
data :
list-data-element
data-element :
int-constant
body
int-constant ( data )
Source information for unit Input files analyser is Input variables queue and Table of input-output formats.
General structure of function isiofile control is given in the following scheme.
i
siofile trees files t1 prefmt gather
fls2 checktree shaketree in-fno
sntx
Function trees chooses next element from Input variables queue and passes it to function files.
Function files calls function fls2 with argument <file-number> for processing input file and after that it calls function t1 for processing input element.
Function fls2 reads data file file with number <file-number> into array of lines data (determining its name by the table of input files' fti) and calls function sntx for checking syntax correctness of this file's contents.
Function fixes errors:
error code 271 ' file'<error context>’ is not found’
Function sntx parsing array of lines data (contents of data file file) and if there is no errors it builds data structure heap used for holding input data in the order set in data file file (this order doesn't correspond to the order set by the queue of Input variables queue).
Element of data structure heap has the form:
| name-variable | name-index | range | … | name-index | range | data |
<name-variable>::=<identifier>
<name-index>::=<identifier>
<range>::=<integer><integer>
<data>::=<Norma language notion data>
This information means that values <data> (for scalar variable of field <name-index>there is no <range>)are set for variable with name<name-variable> and indexes <name-index>=<range>, … , <name-index>=<range> in the input file.
Function fixes errors:
error code 249 'incorrect data file: in line'<error context>’missed = or ('
error code 250 'incorrect data file: in line'<error context>’missed =’
error code 251 'incorrect data file: in line'<error context>’missed , or ; or (’
error code 252 'incorrect data file: in line'<error context>’missed , or )’
error code 253 'incorrect data file: in line'<error context>’missed identifier’
error code 254 'incorrect data file: in line'<error context>’missed number’
error code 255 'incorrect data file: in line'<error context>’missed integer’
Function t1 receives next element as an argument from Input variables queue. Field <format> of this element is passed to function prefmt, then structure tree is created, used for holding input data in the order determined by queue Input variables queue. Structure tree is determined in the following way:
<tree>::= (<vector>) OR <tree><tree>
<vector>::=<n>’undefined’
<n>::=<integer>
The number of structure tree elements is equal to the number of input variable elements. At start all the values of the elements of tree structure are values ’undefined’. Further processing is in transit of the values from heap structure to tree structure instead of corresponding ’undefined’.
Example. For the element of queue
| X | format | I | 1 | 10 | J | 1 | 15 | K | 1 | 2 |
structure tree is created
((10 ’undefined’)(15 ’undefined’)) ((10 ’undefined’)(15 ’undefined’))
Function prefmt processes field <format> and puts type of variable, number of digits in line and number of position for one digit into counters type, count, len correspondingly ( these counters will be used in the process of input file lines' creation in function shaketree).
Function gather concords structures heap and tree for the next element of queue Input variables queue. The values which correspond to the element of the queue and belong to heap are transmitted to corresponding positions in tree. Concordance of queue element and structures heap and tree is analysed and
function fixes errors:
error code 257 'incorrect data file: missed data for variable'<error context>
error code 258 'incorrect data file: repeatedly defined data for variable’<error context>
error code 259 'incorrect data file:there are less data for'<error context>’than defined in indexes’
error code 260 'incorrect data file: too much indexes for'<error context>
error code 261 'incorrect data file: not enough indexes for '<error context>
error code 274 'disaccordance of indexes'<error context>'and'<error context>'in variable declaration and in data file’'
error code 275 'disaccordance of indexes values of variable '<error context>' in INPUT and in data file'
Function checktree checks structure tree built before for certainty as there must be no elements with value ’undefined’ left. In other case,
function fixes error:
error code 262 'incorrect data file: there are undefined data for'<error context>
Function shaketree creates lines of the final reordered input file on the base of information from structure tree and counters type, count, len. Function checks correspondence of input data and input format represented by the values of these counters.
Function fixes errors:
error code 264 'incorrect data file:input'<error context>’for integer variable’
error code 265 'incorrect data file:'<error context>’is longer than attribute format'
Function in-fno receives text line as a parameter and puts it into the final input file. The name of this file is normain.in, and if the main part of Norma-program is compiled then - <part-name>.in.
5.9Listing generator
Listing generator contains the number of functions used for:















