NORMA_PD (1158358)
Текст из файла
13
Norma compiler
Preliminary design
Март 30, 1999
Keldysh Institute of Applied Mathematics
Russia Academy of Sciences
Contents
1. Main principles of NORMA compiler implementation
2. Functions of Norma compiler
3. Contents of Norma compiler
4. Norma part unit compilation
4.1 Local initialization
4.2 Part unit scanner
4.3 Part unit parser
4.4 Data dependencies graph builder
4.5 Data dependencies graph analyser
4.6 Fortran DVM intermediate representation generator
4.7 Fortran DVM code generator
4.8 Input files analyser
4.9 Listing generator
4.10 Exit part unit compilation
1.Main principles of NORMA compiler implementation
Norma compiler is based on traditional compilation methods and specific compilation methods, related to a solution of a target program synthesis problem.
The first class of methods include methods for lexical and syntactic analysis, methods for data representation (tables, access methods), code generation methods etc.
The second class of methods includes methods for creation of executable program based on a declarative specification of computational task. These methods were developed in KIAM RAS.
Implementaion of Norma compiler must support:
-
effective mapping of Norma language computational model into Fortran DVM computational model,
-
strong analysis of Norma program at all stages of compilation to detect much more errors in Norma source and to create diagnostic messages in terms of Norma source,
-
possibility of Norma language (or Fortran DVM) modifications.
2.Functions of Norma compiler
Norma compiler translates a source file containing program written in Norma language into a target file containing Fortran DVM program. Norma compiler must be implemented for workstation cluster and executed under OS Unix.
norma command compiles Norma source and has the following form:
norma <options> <source-file>
On the norma command line options is one or more compiler options.
Source Norma program is placed into input file <source-file>.
Compiled Fortran DVM program is placed into output file <target-file>.
Listing is placed into output file <listing-file> and may consists of the source Norma program, error and warning messages, compiling time messages, Fortran DVM program (optional). Listing may be also sent onto a screen.
3.Contents of Norma compiler
Structure of Norma compiler.
Norma compiler consists of the next components.
-
Global initialization.
-
Norma part unit compilation.
-
Exit compilation.
Global initialization’s functions are:
-
to process compiler options,
-
to initialize compilers variables and data structures,
-
to open files, to output some compiling time messages (date, compiler version, compiler options).
Control Interface.
Global initialization is the initial component of Norma compiler.
Global initialization calls Norma part unit compilation.
Norma part unit compilation is the main component of the compiler and realizes autonomous translation method. If the Norma program consists of part units p1,p2,...,pn, n>0, then each pi, i=1,...,n will be compiled autonomously by this component.
Norma part unit compilation’s functions are described more precisely in paragraph 4.
Control Interface.
Norma part unit compilation is called from Global initialization (for i=1) or from Norma part unit compilation (for i=2,…,n).
Norma part unit compilation calls Norma part unit compilation (for i=2,…,n) or Exit compilation otherwise.
Exit compilation’s functions are:
-
to close files,
-
to output some compiling time messages (time of compilation, number of errors and warnings).
Control Interface.
Exit compilation is the final component of Norma compiler.
Exit compilation is called from Norma part unit compilation.
4.Norma part unit compilation
The Norma part unit compilation consists of the following components:
-
Local initialization
-
Part unit scanner
-
Part unit parser
-
Data dependencies graph builder
-
Data dependencies graph analyser
-
Fortran DVM intermediate representation generator
-
Fortran DVM code generator
-
Input files analyser
-
Listing generator
-
Exit part unit compilation
4.1Local initialization
Local initialization’s function is:
-
to initialize compilers variables and data structures for part unit compilation. Data structure initialized: compiler counters, compiler tables etc.
Control Interface.
Local initialization is the initial component of Norma part unit compilation.
Local initialization call Part unit scanner.
4.2Part unit scanner
Part unit scanner’s functions are:
-
to translate a sequence of symbols from <source-file> into a sequence of tokens; to create a symbol table.
Data structure created: symbol table, constant table.
-
to fix up this sequence of tokens as a sequence of Norma program statements (declarations, operators, iterations).
Data structure created: list of Norma statements, list of iterations.
-
to define of a relation between Norma program statements and <source-file> lines.
Data structure created: statements-lines table.
-
to determine those Norma statements groups (ordered groups) which sequential computing mode is defined for.
Data structure created: table of ordered groups.
Data structure used: list of Norma statements.
-
to check & detect lex-errors.
Data structure used: list of errors.
Control Interface.
Part unit scanner is called from Local initialization.
Part unit scanner calls Part unit parser.
Data Interface.
Part unit scanner reads Norma source from <source-file>.
Part unit scanner passes errors and warnings messages to Listing generator and passes lexically correct statements from list of Norma statements and list of iterations to Part unit parser in the following order:
-
Declarations DOMAIN PARAMETERS, INDEX,
-
Declarations of domains,
-
Declaration of variables, DISTRIBUTION INDEX, EXTERNAL,
-
Declaration of conditional domains,
-
Declaration of input variables,
-
Declaration of output variables,
-
Norma operators,
-
Iterations.
4.3Part unit parser
Part unit parser’s functions are:
-
syntax analysis of Norma statements, errors checking and detection.
Data structure used: list of Norma statements, list of iterations, symbol table, constant table, table of domains, list of indexes order, table of distribution indexes, list of errors.
-
internal representation for Norma statements creation
Data structure created: symbol table, constant table, table of domains, table of operators bodies, table of functional dependencies, list of indexes order, table of distribution indexes, table of input-output formats, table of iterations structures.
Control Interface.
Part unit parser is called from Part unit scanner.
Part unit parser calls Listing generator and after that Data dependencies graf builder.
Data Interface.
Part unit parser receive lexically correct statements from Part unit parser in the following order:
-
Declarations DOMAIN PARAMETERS, INDEX,
-
Declarations of domains,
-
Declaration of variables, DISTRIBUTION INDEX, EXTERNAL,
-
Declaration of conditional domains,
-
Declaration of input variables,
-
Declaration of output variables,
-
Norma operators,
-
Iterations.
Part unit parser passes table of functional dependencies to Data dependencies graf builder and passes errors and warnings messages to Listing generator.
Structure of Part unit parser.
Part unit parser consists of the following main blocks:
-
Processing domain parameters declaration.
Functions: to check & detect errors, to update: symbol table.
-
Processing domain indexes declaration.
Functions: to check & detect errors, to update: symbol table, to create: table of ordered indexes.
-
Processing distribution indexes declaration.
Functions: to check & detect errors, to update: symbol table, to create: table of distribution indexes.
-
Processing domains declaration.
Functions: to check & detect errors, to update: symbol table, constant table, to create: table of domains.
-
Processing variables declaration.
Functions: to check & detect errors, to update: symbol table.
-
Processing external names declaration.
Functions: to check & detect errors, to update: symbol table.
-
Processing Norma operators.
Functions: to check & detect errors, to create: table of operators bodies, table of functional dependencies, table of shadow variables, table of remote variables.
Table of operators bodies contains text of Norma operators in the form, oriented on a code generation.
Table of functional dependencies contains text of Norma operators in the form, oriented on a data dependencies analysis.
Table of shadow variables contains infornation about storage allocation on each processor to include additional space for the elements of arrays that have to be moved in from neighboring processors (see document ‘Fortran DVM. Language description’, SHADOW directive description).
Table of remote variables contains infornation about program statements, which have remote references to distributed arrays (see document ‘Fortran DVM. Language description’, REMOTE_ACCESS directive description).
-
Processing input and output variables declaration.
Functions: to check & detect errors, to update: table of operators bodies, table of functional dependencies, to create: table of input-output formats.
-
Processing iterations.
Functions: to check & detect errors, to update: table of operators bodies, table of functional dependencies, table of shadow variables, table of remote variables.
4.4Data dependencies graph builder
Data dependencies graph builder functions are:
-
data dependencies graph (DDG) creation.
DDG G(V,E) is a hierarchical oriented graph. V is a set of graph nodes, each node corresponds to a Norma operator, iteration or declaration of input and output variables. E is a set of edges reflecting the variables dependencies: if the variable X depends on the variable Y then there exists the edge e from X to Y.
All Norma iteration units for special nodes (iteration-nodes) are substituted. Iteration-nodes is a subgraph of DDG graph.
All Norma ordered groups (Norma statements groups which sequential computing mode is defined for) for special nodes (ordered-groups-nodes) are substituted.
Data structure used: table of functional dependencies, table of iterations structures, table of ordered groups, symbol table, table of domains, table of conditions.
Характеристики
Тип файла документ
Документы такого типа открываются такими программами, как Microsoft Office Word на компьютерах Windows, Apple Pages на компьютерах Mac, Open Office - бесплатная альтернатива на различных платформах, в том числе Linux. Наиболее простым и современным решением будут Google документы, так как открываются онлайн без скачивания прямо в браузере на любой платформе. Существуют российские качественные аналоги, например от Яндекса.
Будьте внимательны на мобильных устройствах, так как там используются упрощённый функционал даже в официальном приложении от Microsoft, поэтому для просмотра скачивайте PDF-версию. А если нужно редактировать файл, то используйте оригинальный файл.
Файлы такого типа обычно разбиты на страницы, а текст может быть форматированным (жирный, курсив, выбор шрифта, таблицы и т.п.), а также в него можно добавлять изображения. Формат идеально подходит для рефератов, докладов и РПЗ курсовых проектов, которые необходимо распечатать. Кстати перед печатью также сохраняйте файл в PDF, так как принтер может начудить со шрифтами.















