NORMA_DD (1158356)
Текст из файла
79
Norma compiler
Detail design
Keldysh Institute of Applied Mathematics
Russia Academy of Sciences
1999
Contents
1. Technical background.
2. General scheme of Norma compiler
3. Main data structures of Norma compiler.
3.1 Symbol table
3.2 Constant table
3.3 List of Norma statements
3.4 List of iterations
3.5 Table of iterations structure
3.6 Statements-lines table
3.7 Table of ordered groups
3.8 List of errors
3.9 Table of domains
3.9.1 Table of ranges
3.9.2 Table of conditions
3.9.3 Table of conditional domains
3.9.4 Table of diagonals
3.10 Table of ordered indexes
3.11 Table of distribution indexes
3.12 Table of functional dependencies
3.12.1 What-compute table
3.12.2 Where-compute table
3.13 Table of operators body
3.14 Table of input-output formats
3.15 Data dependencies graph (DDG)
3.16 Reduced data dependencies graph (RDDG)
3.17 List of MSCS
3.18 List for parallel layer scheme representation
3.19 Table of distributed variables
3.20 Table of shadow variables
3.21 Table of remote variables
3.22 Intermediate representation of Fortran DVM programs
3.23 Input variables queue
4. Global initialisation
4.1 Initialisation of global counters (function count0)
4.2 Analysis of translation's options (function zaparg)
5. Norma part unit compilation
5.1 Local initialisation
5.1.1 Initialisation of local counters (function count)
5.1.2 Initialisation of Symbol table (function tableid)
5.1.3 Initialisation of Constant table (function tablecon)
5.2 Part unit scanner
5.2.1 Begin scanning (function beginlex)
5.2.2 Read source file (function nextline)
5.2.3 Norma part unit head analyses (function begin_part)
5.2.4 Norma statement extraction (function line)
5.2.5 Conversion in tokens (function pkd)
5.2.6 Type of statement detection (function statement)
5.2.7 Part unit head processing(function head_of_part)
5.2.8 Norma iteration processing (function lexitex)
5.2.9 Statement processing(function kbaht)
5.2.10 Stop compilation detection (function StopCompile)
5.2.11 Scanning termination (function EndLex)
5.3 Part unit parsing
5.3.1 Group a statements processing (function kvpar1)
5.3.2 Group b,c,d statements processing (function kvop1)
5.3.3 Group e statements processing (function kbbxo)
5.3.4 Group f statements processing (function kbbyx)
5.3.5 Group g statements processing (function kvopr1)
5.3.6 Iteration processing (function kbiter)
5.4 Data dependencies graph builder
5.4.1 DDG constructor
5.4.2 RDDG constructor
5.5 Data dependencies graph analyser
5.6 Fortran DVM intermediate representation generator
5.6.1 Simple node realisation (function begkf)
5.6.2 Iteration node realisation (function gen_iter)
5.6.3 Ordered group node realisation (function ms)
5.6.4 MSCS node realisation (function mssv)
5.7 Fortran DVM code generator
5.8 Input files analyser
5.9 Listing generator
5.10 Exit from part unit compilation
6. Exit from compilation
1Technical background.
Detail design of Norma compiler is a detailed version of the preliminary design (doc. "Norma compiler. Preliminary design."). Main units of the compiler, its control structure and data structures defined in the preliminary design are given now in details. Notions are taken from doc. "Norma. Language specification" also.
Norma compiler translates Norma-program from <source file> into FORTRAN DVM program placed in <target file>. Norma compiler is implemented for workstation cluster and executed under OS UNIX.
Norma command starts up compiler. The format of this command is given below:
norma <options> < source file>
Norma compiler consists of the next components.
1) Global initialisation
2) Norma part unit compilation
a) Local initialisation
b) Part unit scanner
c) Part unit parser
d) Data dependencies graph builder
e) Data dependencies graph analyser
f) FORTRAN DVM intermediate representation generator
g) FORTRAN DVM code generator
h) Input files analyser
i) Listing generator
j) Exit from part unit compilation.
3) Exit from compilation.
General scheme of Norma compiler, declaration of the main compiler data structures ( defined in doc. "Norma compiler. Preliminary design") and detailed specification of some compiler's units (principal functions, data structures and interfaces) are given below.
All the declarations of data structures, functions and interfaces are done at the level of logical organisation and doesn't depend on the implementation language of Norma compiler.
2General scheme of Norma compiler
Control structure of Norma compiler is given in Fig. 1.
| G |
No
| I |
Yes
| L |
| P |
| P |
| B |
| A |
| G |
| G |
| A |
| E |
| E |
| L |
Fig.1. Control structure of Norma compiler.
3Main data structures of Norma compiler.
In this project we use some notions which correspond to notion of unique number: <statement number>, <iteration number>, <MSCS number>, <ordered-group-number>, <token code>.
Let's consider that
| a1< statement number< a2 | b1 < identifier-token code < b2 |
| a3< MSCS number < a4 | b3 < identifier-token code < b4 |
| a5< ordered-group-number < a6 | |
| a7< iteration number < a8 |
and besides a1<a2<a3<a4<a5<a6<a7<a8, b1<b2<b3<b4. Characteristic of singleness follows from this condition. The value of parameters ai, bj are defined during realisation and in this project we consider a1=1, a2=499, a3=500, a4=549, a5=550, a6=599, a7=600, a8=650, b1=185, b2=9999, b3=10000.
3.1Symbol table
Symbol table is used for holding identificators of Norma program and information about these identificators. Identificators of Norma program are put into the symbol table at the stage of part unit scanner and the information about their characteristics - at the stage of part unit parser
Line of Symbol table has the following form:
| identifier | info | token-code |
<info>::=
| X | - PART name, MAIN PART name |
| AR | - FUNCTION name, REAL |
| AI | - FUNCTION name, INTEGER |
| AD | - FUNCTION name, DOUBLE |
| P<integer> | - DOMAIN PARAMETERS identifier =<integer> |
| M<indexes number><list indexes> | - domain |
| I | - domain index |
| II | - iteration index |
| VI<token-code> | - VARIABLE DEFINED ON domain |
| <token-code>, INTEGER | |
| VR<token-code> | - VARIABLE DEFINED ON domain |
| <token-code>, REAL | |
| VD<token-code> | - VARIABLE DEFINED ON domain |
| <token-code>, DOUBLE | |
| SR | - VARIABLE, INTEGER |
| SI | - VARIABLE, REAL |
| SD | - VARIABLE, DOUBLE |
| ER | - EXTERNAL FUNCTION, REAL |
| EI | - EXTERNAL FUNCTION, INTEGER |
| ED | - EXTERNAL FUNCTION, DOUBLE |
| R | - EXTERNAL PART |
| F | - Standard Norma function |
<token-code>::=<integer>
3.2Constant table
Constant table is used for holding constants of Norma program and information about these constants. Constants of Norma program and the information about their characteristics are put into the symbol table at the stage of part unit scanner.
Line of Constant table has the following form:
| constant-body | info | token-code |
<info>::=
| R | - REAL |
| I | - INTEGER |
| D | - DOUBLE |
<token-code>::=<integer>
3.3List of Norma statements
List of Norma statements is used for holding operators and declarations of Norma program in the form of structured sequence of tokens. Operators and declarations of Norma program can be divided into the following groups of statements:
-
Declarations of DOMAIN PARAMETERS, INDEX - group а,
-
Declarations of domains, - group b,
-
Declarations of variables, DISTRIBUTION INDEX, EXTERNAL - group c
-
Declarations of conditional variables, - group d,
-
Declarations of INPUT, - group e,
-
Declarations of OUTPUT, - group f,
-
Norma-operators - group g.
Every statement of Norma program is given in the form of the token codes sequence and unique number of the statement.
Structure of List of Norma statements:
| h | statement-1 of group a | … | statement-k of group a | |||
|
| ||||||
| h | statement-1 of group b | … | statement-l of group b | |||
|
| ||||||
| h | statement-1 of group c | … | statement-m of group c | |||
|
| ||||||
| h | statement-1 of group d | … | statement-n of group d | |||
|
| ||||||
| h | statement-1 of group e | … | statement-p of group e | |||
|
| ||||||
| h | statement-1 of group f | … | statement-q of group f | |||
|
| ||||||
| h | statement-1 of group g | … | statement-q of group g |
<statement> ::=<statement number><sequence of token codes>
Характеристики
Тип файла документ
Документы такого типа открываются такими программами, как Microsoft Office Word на компьютерах Windows, Apple Pages на компьютерах Mac, Open Office - бесплатная альтернатива на различных платформах, в том числе Linux. Наиболее простым и современным решением будут Google документы, так как открываются онлайн без скачивания прямо в браузере на любой платформе. Существуют российские качественные аналоги, например от Яндекса.
Будьте внимательны на мобильных устройствах, так как там используются упрощённый функционал даже в официальном приложении от Microsoft, поэтому для просмотра скачивайте PDF-версию. А если нужно редактировать файл, то используйте оригинальный файл.
Файлы такого типа обычно разбиты на страницы, а текст может быть форматированным (жирный, курсив, выбор шрифта, таблицы и т.п.), а также в него можно добавлять изображения. Формат идеально подходит для рефератов, докладов и РПЗ курсовых проектов, которые необходимо распечатать. Кстати перед печатью также сохраняйте файл в PDF, так как принтер может начудить со шрифтами.
lobal initialisation
s there next Norma part unit?
ocal initialisation
art unit scanner
uilding graph of data dependencies
nalysing graph of d
enerating FORTRAN DVM code
nalysis of the input files
xit from part unit compilation
isting generation
ead of group a list
ead of group b list
ead of group d list
ead of group e list















