Functional Stream Mashina. Uniform data structure and programs
Detailing of concepts (project) not of von Neumann model of today's computers formulated in the work "A universal Functional Stream computer with parallel computings" defined here as the section 1 (Introduction) begins this article. This model breaks and the concepts of algoritmicheky languages adopted today, solving a problem of creation of a universal digital computer with parallel computings. The author (PhD in Technological Sciences Patrikeev V.L., TF 0642-937358) is convinced that the calculator - the robot (computer) shall not be model of neural network of a human brain and its mentality. Therefore the simple solution which is first not simple for understanding owing to the developed traditions is proposed (review to only 15.08-2013 g).
Content
|
Links to all sections of the project:
1. Functional Stream Mashina with parallel computings. Introduction (http://tadviser.ru/a/121275)
2. Uniform data structure and programs (http://tadviser.ru/a/149691)
3. Functioning of FPM. Expressions of language of programming
(http://tadviser.ru/a/149691)
4. Flows and their processing in structure of expression
(http://tadviser.ru/a/150588)
5. Micro programming of functions
(http://tadviser.ru/a/153069)
6. The program as the managed flow of expressions
(http://tadviser.ru/a/153069)
7. Macro definitions of the user functions (http://tadviser.ru/a/157631)
2. Uniform data structure and programs
For structure declaration of data, language and the machine Backus Nowra metasymbolics is used. In addition in brackets> []
part of the description which can be lowered consists. Brackets { } join repeated (iteration) a part of the description.
Structure members have properties - the character sequence limited on both sides by the '%' special character.
Preceding (prefix) property the special character '~' denies existence of the corresponding property
2.1. Syntax and codes of structure
<Структура> ::= [<Атом>][<Слой>] %[.][,]% %.% %,% For lack of Atom or the Layer in structure, respectively, is absent property '.' or ',' <Слой> ::= (<Список элементов>)|[<Список элементов>]|{<Список элементов>} %,(% %,[% %,{% <Список элементов> ::= <Элемент>{,<Элемент>} <Элемент> ::= [<Имя-индекс>:]<Неопределенный>|[<Имя-индекс>:]<Структура> %#% <Неопределенный>::= [#] – the character '#' can fall between commas and brackets '(', '[', '{' and ‘:’. The %#% property is equivalent to % ~. ~, % <Имя-индекс> ::= <идентификатор>
Not necessarily set Name index of an element is unique within a layer where the element enters.
For lack of an element it is indefinite (%#% property), perhaps, with a name index.
The identifier consists of Latin letters and digits, and the first of them surely a letter. Atom is a number, a line, date, function name
etc. (item 2.3)
Example: Properties '% ~., %' describe structure with the absent atom (~.), but present layer ().
2.2. Codes of data members
2.2.1. Codes of structure members
These codes are defined also logically and are designed to enter a little more profound idea of construction of data members at their processing.
In determination of codes are absent:
- The data members of their property accompanying in flows, including defined in item 2.1 and defined further (property list)
- the names indexes of elements of a layer used for access to them and physically in the form of the corresponding list of pointers
accompanying this layer
The code of a layer is placed in the block (BP) of the dynamically distributed memory (DDM), allowing (BP) direct access to the code of any its element by the integer index – sequence number (0, 1, 2, …) in a layer:
<Код элемента [слоя]> ::= <УКА[- Указатель БП с атомом]> <УКС[- Указатель БП с кодом слоя]>
Actually existence of properties '.' and ',' in the property list of %., the % of structure is defined, respectively, by existence (determinancy)
<><>links UKA (UKA0) and UKS (UKS0). In case of an element - Atom (%. ~, %) UKS is not determined (UKS=0).
In case of a layer element (% ~., %) UKA=0 and in case of an element - the Node (%.) are determined <><>by UKA0 and UKS0.
In case of an indefinite element (#) UKA =0 and UKS =0.
In all cases at <>UKS0 the element among others accompanies properties of %. (%, %. [% or %. { %
depending on type of brackets (item 2.1) of the layer specified by UKS. Considered here i properties of a layer are lower,
as well as properties of a vtom are placed directly in BP, UKS or UKA specified soovetstvenno and change automatically
only (!) at an izmeneniitip or contents of a layer or atom in BP
2.2.2. Codes of elements of data streams
Functions process arriving on their inputs (from arguments) elements of flows with property '%; %' everyone or unary (% ~; %) –
only element following type:
- R-value (% @ %) - the copy of a structure member (layer), i.e. couple of links UKA and/or UKS (perhaps, UKA=0 and UKS =0 -
indefinite element)
- V-value (%&) - pair: UKS and index: A name index or sequence number (0, 1, 2, …) R-values (the code of an element) in a layer (BP),
specified by the link UKS. In effect, V-value - the link to placement of R-value in DRP.
- The atom (\is equivalent %~&~@%) transferred from an argument exit (a micro computer) to a function input (a micro computer)
directly the value (the copy of BP, more convenient for processing) without use of uniform DRP FPM
Specified (in brackets) the properties corresponding to types of elements of a flow can be processed by functions and primitives,
together with considered above (item 2.2.1) and considered further (item 2.3, etc.) properties of structure members and
flows, automatically determined in BP on UKA and UKS R-values. In case of V-value UKA and/or UKS are used
The R-value specified by V-value: The V-value inherits properties (atom, a layer) of the R-value specified by V-value.
ndsp; The V-value excludes mentioned in [2] uncertainty and ambiguity of an absolute majority of programming languages in
determination of X in left (where to write) and right (what to put with 1) parts of assignment statement:
X := X + 1
2.3. And t about m y
<атом>::= <Целое>|<Вещественное>|<Дата>|<Строка>|<Свойства> | %.9% %./% %.'% %."% /%.:%/ <Имя> |<формула[_Calc]> %.`%
Here and below in % … % are given descriptions of types (types) of atoms, to each of which the character following ‘%’ '.'
defines atom, and the special character following it - atom type. The characters defining atom type '+', '.',
: ', ' '' and '/' syntactically begin atom representation that simplifies storing of their sense
on property.
Attention! In a formula of NE the ispolzrvaniye of the return apostrophe is allowed
<Имя>::= <Имя-индекс> |<Имя функции>|<Имя настройки [функции] %.|% %._% <Имя функции>::= <Имя генератора потока>|<Имя обработчика потоков> %.*% %.$% <Имя>::= [<тип имени>]<идентификатор> In case of index name "the name type" is absent, in other cases it matches the second character of properties (type, item 2.4) atom: '!', '_', '$' and '*' <Имя настройки [функции]>::= <имя примитива настройки>|<имя параметра настройки>
Tuning property differs in the fact that unlike a primitive of setup it does not accompany a layer (%, (%) from arguments.
The primitive of setup has an appearance of function of an unary primitv and has no exit
.
Here the name index is set obviously as atom and optional matches determination of index name (item 2.1) of some element
same or other layer.
.
Feature set (%. * % and %. $ %), primitives and tuning properties (%._%) the FPM functions it is fixed together with their names,
which are placed in statically defined memory allowing to calculate instantly on their name the link UKA to this Name.
Other names are defined by the user and, as well as other atoms, are placed in BP DRP.
'Whole' and Material also float of the SI language are defined as int <Свойства>::= %{[~][<свойство>]}% In Properties atom member properties of a flow precede to properties of atom and/or layer, but can be absent.
We defined a part of properties in the form of special characters (the special character - property) above, other we will define later and
each of the subsequent is defined except special characters by digit or the character of Latin.
Anyway the special character preceding property '~' is denial of the property following it and perhaps following further
the specifying properties. If '~' precedes the character '.' that it denies (atom):
- in general availability of atom, if to the right of '.' additional properties of atom are not specified
- availability of atom in general or with the properties of atom specified further
Note: Action '~' on property ',' (layer) and the specifying properties of a layer following further is similar.
Here properties are set obviously by atom (its value) unlike the properties accompanying structure members and flows
including containing atom<Свойства>. The list of properties in atom<Свойства> can be empty.
'Line' – by analogy with Si is quoted and uses the screen for canceling of normal interpretation of special characters
in syntax of a data structure.
The formula _Calc is an essence a line with the sequence of operators (transactions) of the _Calc calculator (river 5).
2.4. Properties of data members
Here we will in addition specify the following properties:
%. [<тип атома>] 0%-Atom has 0th value of type: number 0 (+ types 'and'.'), blank line (type'"') or empty set of properties (':'), including lack of the code' ~' <тип слоя>%,[]0% - <>the layer specified <>by UKS0 is empty (layer type:' (', ' ['or' {') The %, [<тип слоя>] ~ 0% - <>the layer of NE specified <>by UKS0 is empty (there is a way down hierarchy of structure) %. [+] 2% - parity of integer atom. Property '2' defines whole and therefore the property '9' (whole) can be absent %.9 ~ 2% - oddness of integer atom % of.9+ % - whole positive %./%- material positive %&0% - the V-value (%&) specifies the first element of a layer on the UKS (index 0) %&~0% - the V-value (property &) specifies NOT the first element of a layer %&@% - the V-value (property &) indicates real-life layer element %&~@% - V-value (property &) NE points to real-life layer element (the V-value is incorrect) %&|% - the V-value (property &) contains a name index (property '|') the element specified by it in a layer %&~|% - the V-value (property &) contains the integer index the element specified by it in a layer: it is denied (~) property' |' index name %.|1% or %. "1% - atom a name - = the index or a line begin with a capital letter (big) letter
2.5. Data streams and expressions
Speaking about flows on inputs and exits of functions, we will mean the actual implementation of flows in SA (Structure Aktivatsy)
similar structure from microprocessors, river 1).
According to item 2.2.2 the flow consists of atoms, R-and V-values. Each element of a flow can have own properties,
other than properties of other elements of a flow.
Flow of indexes – an essence a flow from integer atoms (%.9+") and/or names indexes (%.|%) and/or links UKA (R-value) to such atoms.
In need of use function of atom from R-value on UKA automatically extracts atom.
When processing the R-values function, atom (on UKA) or a layer (on UKS) on V-value of a flow automatically takes R-value -
layer element on UKS from V-value with sequence number - the index from V-value. Inheritance (see above) R-values properties from Atom on UKA
and V-value from R-value allows to avoid these "extraction" in need of processing only of properties
$Eval processed by function (river 6) the next element of a flow – Atom or determined by R-value (according to links UKA and UKS)
the structure in DRP is identified by function (syntax) as expression according to determinations of the following section (river 3).
Such flow of expressions is defined as the program.
2.6. Space and subspaces
At start of function of $Eval prior to processing of a flow of expressions by it (argument) its own space - an empty layer forms. At the first address in processed (performed) it expression of a name index with property of %.|1% the subspace with the specified index as a space layer element forms:
<Имя поодпространства>:<подпространство> %.|1% <Имя поодпространства><имя-индекс>::= (2-1) <подпространство>::= <структура>
Let's remind (item 1.3) that processing by function of $Eval the next expression of a flow comes down to development of a new branch of SA – structures
from the micro computer adequate to the structure of this expression connected by a root to $Eval and executing its calculations. In this expression
his members address subspaces (2-1) of space of function of $Eval on their names.
According to item 3.1.1 expression (argument) from one this name returns V-value of a node – a subspace in a space layer.
For lack of a subspace with such name according to item 1.3(9) it is looked for in space of function of $Eval (activation),
processing expression with assumed function of $Eval, etc. up hierarchy of a tree from $Eval in SA.
2.7. Functional Stream Mashina. Core
At start of FPM the function of $Eval processing the expressions entered manually (flow) is started actually
FPM which is root SA with own (global) space and deleted only at switching off.
At switching off of FPM space of this $Eval remains and at restart is recovered.
3. Functioning of FPM. Expressions of a programming language
<Выражение [ФПМ]>::= <Подпространство>|<Подобласть>|<Литерал>| <Вызов унарного примитива>|<Вызов примитива настройки>| <Вызов встроенной функции>|<Встроенное макроопределение>| <Вызов пользовательской функции [с макроопределением пользователя]>
Expression is performed by function of $Eval according to river 1 developing this expression in the same structure corresponding to it a branch (subtree)
SA (Structure Aktivatsy of functions) - structure from a micro computer on which it will be organized calculations, formation and processing of data streams.
In view of identity of structures of expression and SA we will tell about formation of flows at the exits (a) of functions - receipt their inputs of function,
which arguments functions (a) are, understanding, of course at the same time physical inputs and entry of the corresponding micro computers into SA.
3.1. Unary value. Subspace and literal
Expressions Subspace, Subarea and 'literal' return unary (only) value (% ~; %) and which can be used in functions as a flow from one element. The unary value can be coded and be transferred from an argument to function (to its input) physically (SA) is simpler, than a flow (item 3.3).
<Подпространство>::= <Имя-индекс [элемента слоя `Пространство`]> %.|I1% <Подобласть>::= <Имя-индекс [элемента слоя `Область`]> %.|I~1%
Here "Name index" returns V-value of an element of a subspace or subarea (item 2.6) of SA, nearest to a root of a tree (river 1) to function of $Eval, performing expression. Let's remind what can be present at the expression (and not one!) $Eval, performing the expressions arriving on its input. $Eval hereinafter (expression and flows on it) there is a speech about this
<Литерал> ::= <Атом[кроме имени-индекса]><Слой> | %.~|% <Слой>|# [-the Indefinite element] %~.,% %#%
The literal (as expression) returns links (copy) to itself in expression – R-value (% @ %). The R-values returned by literals
in addition purchase properties of %.? % and/or %? the protection % only warning about possible need
(defined and made by the user by means of expressions of language!) to block change, respectively
atom on <>UKA0 and/or a layer on <>UKS0 R-values. The property of % defined for a layer of a literal (R-value)? % ('?')
automatically extends on all hierarchy levels of structure of a literal in the form of couples of properties of %.? % and %? %
for atoms and layers. Actually property '?' protection joins in the general property list of atom and/or a layer.
When copying R-value (links UKA and UKS) automatically together with it also these properties and also properties are copied,
the defining types of atoms, availability of atom and layer, etc. Properties of protection can be set or deleted with the transactions _Calc
3.2. Call of an unary primitive
<Вызов унарного примитива> ::= <Имя примитива>([<Выражение>{,<Выражение>}]) %.|%
These actually following two with the fixed names (name indexes) of NE having the arguments of a primitive returning unary value:
1) Lit (<Структура[ c %.,%]>) is expansion of determination of a literal: returns R-value of structure (%., %).
Need for such additional determination of a literal arises only in cases when<Структура> syntactically is
built-in macro definition, function call or primitive. In this case accomplishment of this Structure as expressions is blocked
2) Data () – returns an element (Atom, R-or V-value) of a data stream from the second input (item 3.2.4) of function of $Eval (river 6),
processing expression (an element of the first input) with this primitive.
3.3. Function setup primitive call
<Вызов примитива настройки>::= <параметр настройки>| %._% <имя примитива настройки>(<аргумент>{,<аргумент>}) %._% <аргумент>::= <Литерал>
This call has a function call appearance (see further) and differs in the fact that NE has an exit, and serves only for function setup
(more precisely, the branch of SA implementing it), the organizations and reorganizations of the data streams processed and created by function in SA. As a rule,
arguments of a primitive of setup are literals (are not calculated!). Provision of calls of primitives of setup among function arguments
Does not affect results of its work and therefore such arguments are defined as "transparent" in the river 4 also rubles 5 are considered in more detail
3.4. A call of the function which is built in FPM
<Вызов встроенной функции> ::= <Имя функции>(<аргумент>{,<аргумент>} <аргумент>::=<[Имя параметра>:]<Выражение> %.|1%
The first consistently the arguments parameters determined by their names or positionally (in a layer of arguments) most are calculated from left to right
function. If the argument - parameter creates a flow, then as its unary value (% ~; the %) is accepted the first element of a flow, including,
perhaps, sign of end of a flow - an element without properties (%%). At the same time the others the rest of a flow is interrupted together with creating
its expression and with removal of the corresponding part of a branch of SA. It is possible to connect means of the _Calc calculator to processing of parameters
&nbps; After calculation of parameters the function arguments creating flows which are processed in parallel are started and function
function. The results of processing of parameters and/or entrance flows created by function can return function on syntactically
the defined main exit and additional _Out (item 4.2) determined by a primitive additional exits. As well as vkhodna, and days off
flows of function can be processed in parallel connection of the _Calc calculator
3.4.1. Function parameters
Parameters variously are defined for the specific built-in functions (river 4). At the same time there are parameters, identical
in the way used by all or a part of functions. Moreover, it is possible to enter additional into structure of arguments of any function
the parameters used entered by the user in additional transactions of the _Calc calculator when processing as tsamy parameters
so entrance and output flows of function and even when implementing actions of the function or their adjustment.
3.4.1.1. Standard Parameters of functions
1) Struct:<аргумент функции>
- announces function argument the processed structure. By default Struct, as a rule, the 1st argument (functions of $In, * Tree, item 4.3.3.1
and item 4.1.4). Even for lack of determination by function of this parameter they can vosplzovatsya for a stream input of function to accept
only the first element of a flow on this input
2) T_out:<количество мкс>
- If formation of the next element of an output flow borrowed the timeout value which was less specified by an argument, then issue
this element on an exit it is delayed on a difference between them – to timeout value. for lack of this set parameter
(by default) it is accepted equal 0
3) Sum:<исходное значение>
- At transactions of calculation of results when processing by function of entrance flows (item 3.5), this parameter sets original value
register "Adder". For lack of this set parameter (by default) it is accepted equal 0 or is established
content of function, but always exists. As well as T_out this NE parameter is defined positionally in the parameter list of function
(without name). When using transactions of the _Calc calculator in function evaluations and also in processing of flows at the exits
functions (item 4.2.2 and item 4.2.3) actually the parameter value of Sum is possible after processing by similar transactions (item 3.4.1.2)
prinimayeisya as initial
3.4.1.2. Control and processing of parameters of functions
For this purpose it is necessary to include in structure to argumentovvklyuchit the setup primitive defining these transactions:
<Имя параметра><операции><Имя параметра><операции>_Par(:{,:}) <операции>::= <операция>|<ряд операций> <операция>:: = _If (<условие><операция>{, transaction }) |<собственно операция> | _if (<условие><операция>{, transaction }) <условие>::=<Свойства>|(<Свойства>{,<Свойства>}) <собственно Операция>::= _Go| _Break|<формула> <формула>::`<операция _Calc>{;<операция _Calc>}` <операция _Calc>::=[<операнд1>]<Код операции>[<операнд2>] <операнд1>::=<операнд>[<Свойства>] <операнд2>::=<операнд>[<Свойства>] <операнд>::=<литерал>|<Результат [последней] операции _Calc> | <результат вычислений>|<Имя параметра> <Код операции>: = +|-|++ |+ =|= |->|&|@, etc. according to item 5.3 <Результат операции _Calc>::= . <результат вычислений>::= !
<ряд операций>::= {<операция>{ ,<операция>} }
1) All this means use of the _Calc calculator. By the beginning of execution of operations of a row a parameter value (perhaps accepted by default) is located in the register'!' and on their termination value'!', perhaps (not necessarily) corrected returns to the same to parameter if the last executed transaction NOT is _Break stopping a vypoloneniye of transactions of a row, as well as function in general.
2) In a number of transactions transactions from which in case of _If compliance of the register is required are executed from left to right '!', and in case of _if
register '.' to "condition", to be exact one of the formulated condition of Properties. And then are executed consistently specified by the second
and following arguments of a primitive of _If (_if) of transaction, including:
- _If (...) and _if (...)
- a formula with the transactions _Calc
- _Go - the following transactions of a row are passed (NE are executed)
- _Break - to interrupt (to block) function accomplishment (on an exit of function the empty flow is issued).
3) The last transaction in not an empty "number of transactions" can be set without condition - as "actually transaction", executed
certainly for lack of the transactions _Go or _Break executed earlier
4) _If (<условие>) or _if (<условие>) causes the transaction _Break (by default) at Failure of consideration: value of the register '!' or '.'
does not answer any of Properties of a condition. Otherwise the transaction _Go is executed
5)<Имя параметра>: _If (<условие>) can be written well as<Имя параметра>:<условие>
6) "Properties" conditions set separate or joint requirements to structure as to a flow element (a flow, unary value, atom,
V or R-value), to atom and/or a layer of R-value, including absence specified by R-values V-value atom or a layer at R-value,
set obviously or implicitly by means of the V-value specifying it. If the NE V-value indicates specific R-value, then are considered
absent its atom and layer. Let's remind that for lack of the listed above components of structure of an element the code' ~ is used',
as well as for an otsustviye of properties of these components: element, atom and layer of R-value (river 2)
7) The formula can change the parameter value (and/or its properties) analyzed and processed by the following behind a formula
transactions of a row. _If (_if) can also be the argument of transaction (primitive) of _If (_if) second, third etc.
In the presence of Properties to the right of an operand this operand before transaction is given to a type, the defined these properties, however saving
at the same time initial type and properties.
8) Transaction can consist of one operanda1 (for lack of an activity code and an operand 2) and then result of transaction (the register '.')
there is Operand1 after its reduction to required Properties to the right of it (if they are set).
9) Upon transition from accomplishment of one formula to another contents of registers '!' and '.' remain at the time of end of the first
from them.
Let's remind (item 2.1) that for denial of properties in their list (condition) the code '~' is used.
In formulas the parameters, functions including which are absent can be used, switching off standard. In this case are used
their original values by default.
3.5. Built-in macro definitions
It the macro definitions which are obviously not determined by the user in subspaces. In compliance with them their macroes, as well as in case of explicit
macro definitions of the user functions (item 3.6, river 7), are substituted for function of $Eval only in SA for the expressions which are not containing such macroes
(expansions) and therefore having an appearance, more difficult for a review, for example:
<Имя подпространства или подобласти><индекс><индекс>[,...,>] (3-2) in SA is implemented as transaction of indexing of structure subspaces (subarea) deep into - on hierarchy levels (expansion): <Имя подпространства или подобласти>$In(, <индекс><индекс>*Stream(,...,>)) (3-3) <Имя подпространства или подобласти><индекс><индекс>{,...,} (3-4) in SA is implemented as <Имя подпространства или подобласти>$Sel, <индекс><индекс>*Stream(,...,)), creating (selecting) at the exit of V-value of elements subspaces or subareas – a layer according to the list of indexes. The description of functions of $In, $Sel and * Stream, respectively, in 4.3. In expressions (3-2) and (3-4) instead of the list of indexes (in brackets [] or {}) the expression calculating a flow can be used] indexes
The built-in macro definitions, reducing number of the enclosed couples of brackets (hierarchy levels of structure) of expression, do by its lakonichny and
more expressively, displaying indexing of elements of hierarchical structures by the method commonly accepted in the existing programming languages
3.6. A call of the user function - macro definition
<Вызов пользовательской функции> ::= <Имя подпространства>(<Выражение>{,<Выражение>}) %.|1%
The subspace specified by a name contains implementation of this macro definition of the user function (river 7) in the form of the expression processed
function of $Eval - macro definition interpretations (river 6). – When forming the corresponding branch of SA function of $Eval it is implicit (without change
initial expression) substitutes a call of the user function - a macro for its interpretation: substitution is made only in structure of SA!
Rules for the built-in functions, including use of function parameters, primitives of management extend to the user functions
flows (Out, _Chanal and additional exits with transactions). The difference consists that function parameters (their names and appointment) now
can be defined by the function macro definition made by the user
Note: It is clear, that the name of the user function cannot match the fixed names Lit and Data of unary primitives (item 3.2)