Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4000374
interpretation.xml
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 9, 4:09 AM
Size
29 KB
Mime Type
text/xml
Expires
Sat, Jul 11, 4:09 AM (1 d, 4 h)
Engine
blob
Format
Raw Data
Handle
273290
Attached To
rXR Xreate
interpretation.xml
View Options
<?xml version="1.0" encoding="UTF-8"?>
<chapter version="5.1" xmlns="http://docbook.org/ns/docbook"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:xila="http://www.w3.org/2001/XInclude/local-attributes"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:trans="http://docbook.org/ns/transclusion"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns:m="http://www.w3.org/1998/Math/MathML"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:db="http://docbook.org/ns/docbook">
<?xxe-sn 26cy4nalqsw pu35zrt1aby9?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1abya?>Interpretation</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyb?>Interpretation is a compiler's mode
reserved to evaluate, expand and simplify parts of a given program based on
information available in this mode. On the other hand, Interpretation is a
middle man, or an intermediate level, between the Transcend and Brute
levels, as it facilitates communication between those by means of
interpreting data of respective layers. It can be further divided into Upper
and Lower Interpretations depending on the interaction with the layer we are
focused on at the moment.</para>
<remark><?xxe-sn 26stp2g6sxs p?><emphasis role="bold"><?xxe-sn 26stp2g6sxs q?>mode
whereby - как это перевести? - это режим с помощью которого xreate
интерпретирует? Авторский смысл: это режим(компилятора) В КОТОРОМ компилятор
интерпретирует. </emphasis></remark>
<remark><?xxe-sn 26stp2g6sxs 1?>Program: Речь идет о компьютерной программе,
или может приложении для смартфона, или алгоритме? Тогда лучше употребить
соответственно software ('piece of software') / app / algorithm. Вообще
"наши" компьютерные программы - это у них software, а не programs - -
<emphasis role="bold"><?xxe-sn 26stp2g6sxs 2?>ДА ТУТ СЛОВО PROGRAM ПОДХОДИТ,
особенно в контексте обработки программы с какимито целями, как здесь, чтоб
ее интерпретировать.</emphasis></remark>
<programlisting xml:id="Intr_1"><?xxe-sn 26cy4nalqsw pu35zrt1abyd?>name="tests/interpretation.cpp: Interpretation.Doc_Intr_1"
main= function:: int; entry
{
x= "a":: string.
y= if (x=="b"):: string; i12n(on)
{1} else {0}.
y
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abye?>In this example, the identifier
<code><?xxe-sn 26cy4nalqsw pu35zrt1abyf?>y</code> has an attached annotation
<code><?xxe-sn 26cy4nalqsw pu35zrt1abyg?>i12(on)</code> which indicates that
the compiler should use compile-time interpretation to evaluate
<code><?xxe-sn 26cy4nalqsw pu35zrt1abyh?>y</code>. Once the simplification
process is over, the function returns <code><?xxe-sn 26cy4nalqsw pu35zrt1abyi?>0</code>,
with neither memory allocations for the string variable <code><?xxe-sn 26cy4nalqsw pu35zrt1abyj?>x</code>
nor any computation at runtime.</para>
<remark><?xxe-sn 26stp2g6sxs 3?>Annotation - может лучше value или
parameter? - <emphasis role="bold"><?xxe-sn 26stp2g6sxs 4?>да Annotation
подходит</emphasis></remark>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyk?>There are two annotations reserved
to control the interpretation process:</para>
<itemizedlist>
<?xxe-sn 26cy4nalqsw pu35zrt1abyl?>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abym?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyn?><code><?xxe-sn 26cy4nalqsw pu35zrt1abyo?>i12n(on)</code>
Forces compiler to interpret the annotated expression, function, or
function argument. It yields error if the expression is impossible to
interpret.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abyp?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyq?><code><?xxe-sn 26cy4nalqsw pu35zrt1abyr?>i12n(off)</code>
Disables interpretation for the annotated expression.</para>
</listitem>
</itemizedlist>
<section>
<?xxe-sn 26cy4nalqsw pu35zrt1abys?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1abyt?>Eligible Expressions</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyu?>Currently the compiler is able to
interpret the following expressions:</para>
<itemizedlist>
<?xxe-sn 26cy4nalqsw pu35zrt1abyv?>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abyw?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyx?>Atomic instructions: numbers,
strings, identifiers.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abyy?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abyz?>Relational and logic
operators e.g. <code><?xxe-sn 26cy4nalqsw pu35zrt1abz0?>x==true</code>,
<code><?xxe-sn 26cy4nalqsw pu35zrt1abz1?>x!=0</code>.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abz2?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abz3?><code><?xxe-sn 26cy4nalqsw pu35zrt1abz4?>if</code>,
<code><?xxe-sn 26cy4nalqsw pu35zrt1abz5?>switch</code> statements.
[[#late-interpretation-or-e|Statement expansion]] allowed.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abz6?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abz7?>Loop statements.
[[#late-interpretation-or-e|Statement expansion]] allowed.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abz8?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abz9?>Functions.
[[#function-interpretation|Function calls]],
[[#partial-or-late-function|Partial function call
interpretation]].</para>
<remark><?xxe-sn 26stp2g6sxs 5?>interpreta - это так и нужно, или
неполное слово? - <emphasis role="bold"><?xxe-sn 26stp2g6sxs 6?>этот
кусок текста на сайте превратится в ссылку, это адрес ссылки, такой
должен быть</emphasis></remark>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abza?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzb?>Index operator e.g.
<code><?xxe-sn 26cy4nalqsw pu35zrt1abzc?>x = {1, 2, 3}.
y = x[0]</code>, <code><?xxe-sn 26t7ih8bitc 1?>info = {planet="Earth"}.
x = info["planet"]</code>.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abze?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzf?>List operators e.g.
<code><?xxe-sn 26t7ih8bitc 2?>x = [1..10]. y={"day",
"night"}</code>.</para>
</listitem>
</itemizedlist>
</section>
<section>
<?xxe-sn 26cy4nalqsw pu35zrt1abzh?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1abzi?>Function Interpretation</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzj?>The whole function body may be
subject to interpretation if it consists of interpretable expressions
only.</para>
<programlisting xml:id="FnIntr_1"><?xxe-sn 26cy4nalqsw pu35zrt1abzk?>name="tests/interpretation.cpp: Interpretation.Doc_FnIntr_1"
unwrap = function(data::unknType, keys::unknType):: unknType; i12n(on)
{
loop fold(keys->key::string, data->record):: unknType
{
record[key]
}
}
test = function:: bool; entry
{
book = unwrap({
Library = {
Shelf = {
Book = "Aristotle's Politics"
}}}, {"Library", "Shelf", "Book"}):: unknType.
book == "Aristotle's Politics"
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzl?>The above example demonstrates
the <code><?xxe-sn 26cy4nalqsw pu35zrt1abzm?>unwrap</code> function which
is intended to be fully interpretable, as indicated by the function
header's annotation. Obviously, the interpretable function requires that
all its arguments are also interpretable. In this case the compiler is
able to calculate the function's result at compile time with no byte code
produced. Here is what the compiled code looks like (which will be also
optimized out during the consequent compilation phases):</para>
<programlisting xml:id="Alt_FnIntr_1"><?xxe-sn 26cy4nalqsw pu35zrt1abzn?>name="tests/interpretation.cpp: Interpretation.Doc_FnIntr_1"
test = function:: bool; entry
{
book = "Aristotle's Politics":: string; i12n(on).
book == "Aristotle's Politics"
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzo?>The example also reveals a number
of similarities with dynamically typed programming languages:</para>
<remark><?xxe-sn 26stp2g6sxs 7?>number of similarities - тут точно нужен
артикль, неопределенный (a) если в смысле "много схожестей", и
определенный (the) - если речь идет о точном их количестве. a dynamically
typed - неопределенный артикль никогда не употребляется при множественных
объектах - <emphasis role="bold"><?xxe-sn 26stp2g6sxs 8?>OK</emphasis></remark>
<itemizedlist>
<?xxe-sn 26cy4nalqsw pu35zrt1abzp?>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abzq?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzr?><emphasis><?xxe-sn 26cy4nalqsw pu35zrt1abzs?>Relaxed
types</emphasis>. Notice <code><?xxe-sn 26cy4nalqsw pu35zrt1abzt?>unknType</code>
type which has not been defined. It's interpreted well because the
compiler completely ignores the type system since everything can be
checked at compile time anyway. The Interpretation mode is exactly the
level where the relaxed type system is possible without any
performance penalties or safety concerns.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1abzu?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzv?><emphasis><?xxe-sn 26cy4nalqsw pu35zrt1abzw?>Introspection
abilities</emphasis>. Notice how it is allowed to treat list fields as
string keys, so functions like <code><?xxe-sn 26cy4nalqsw pu35zrt1abzx?>unwrap</code>
can get list field name as a parameter. Possible errors, such as the
list not having the requested field are easily spotted by the compiler
during interpretation and there are no concealed runtime bugs. In a
sense, it is a fair trade off between introspection expressiveness and
possible compilation errors.</para>
<remark><?xxe-sn 26stp2g6sxs 9?>no hard to catch runtime bugs - не
вполне ясно. В смысле, "легко заметить баги проявившиеся во время
операции"? Тогда лучше "its is easy to see runtime bugs", или может
"the runtime bugs are possible" (если смысл такой, что могут
проявиться ошибки/баги"). It's и другие подобные сокращения: лучше
употреблять полную форму - it is, так как it's это разговорный вариант
- <emphasis role="bold"><?xxe-sn 26stp2g6sxs a?>OK</emphasis>.</remark>
</listitem>
</itemizedlist>
<note>
<?xxe-sn 26cy4nalqsw pu35zrt1abzy?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1abzz?>Additional reason for the
arbitrary undefined type <code><?xxe-sn 26cy4nalqsw pu35zrt1ac00?>unknType</code>
being used in the example is to ensure that no compilation occurs and
everything is done at the interpretation mode.</para>
</note>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac01?>In simple cases interpretation
analysis could determine that a function is subject to interpretation with
no annotation hints provided.</para>
<programlisting xml:id="FnIntr_2"><?xxe-sn 26tbgov1xq8 1?>name="tests/interpretation.cpp: Interpretation.Doc_FnIntr_2"
unwrap = function(data::unknType, keys::unknType):: unknType
{
loop fold(keys->key::string, data->record):: unknType
{
record[key]
}
}
test = function:: bool; entry
{
book = unwrap({
Library = {
Shelf = {
Book = "Aristotle's Politics"
}}}, {"Library", "Shelf", "Book"}):: unknType; i12n(on).
book == "Aristotle's Politics"
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac03?>The only difference from the
example above is the lack of annotation hint for <code><?xxe-sn 26cy4nalqsw pu35zrt1ac04?>unwrap</code>.
It can be seen that interpretation of the variable <code><?xxe-sn 26cy4nalqsw pu35zrt1ac05?>book</code>
is required which in its turn depends on <code><?xxe-sn 26cy4nalqsw pu35zrt1ac06?>unwrap</code>.
In this case analysis is capable enough to determine that <code><?xxe-sn 26cy4nalqsw pu35zrt1ac07?>unwrap</code>
is indeed possible to interpret, so no errors occur.</para>
<remark><?xxe-sn 26stp2g6sxs b?>"Developer requires interpretation" - тут
речь о разработчике-программисте? Не вполне понятен смысл, поэтому пока
оставляю как есть. - <emphasis role="bold"><?xxe-sn 26stp2g6sxs c?>да
программист, исправил</emphasis></remark>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac08?>There are, however, more
complicated cases for interpretation analysis:</para>
<itemizedlist>
<?xxe-sn 26cy4nalqsw pu35zrt1ac09?>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac0a?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0b?>Direct recursion.
Interpretation analysis is able to correctly determine whether a
function involving direct recursion (where the function calls itself)
is subject to interpretation or not.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac0c?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0d?>Indirect recursion.
Currently, when processing the indirect recursion (where a function is
called not by itself but rather by another function), the analysis
usually fails and relies on manually provided annotation hints.</para>
</listitem>
</itemizedlist>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0e?>Below is an example of a direct
recursion:</para>
<programlisting xml:id="FnIntr_3"><?xxe-sn 26cy4nalqsw pu35zrt1ac0f?>name="tests/interpretation.cpp: Interpretation.Doc_FnIntr_3"
unwrap = function(data:: X):: bool
{
if (data[0] == "the-end"):: bool
{true} else {unwrap(data[0])}
}
entry = function:: bool; entry
{
unwrap({{{{"the-end"}}}}):: bool; i12n(on)
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0g?>Function <code><?xxe-sn 26cy4nalqsw pu35zrt1ac0h?>unwrap</code>
unwraps the nested list until the desired value is found. No function
level annotation is required.</para>
</section>
<section>
<?xxe-sn 26cy4nalqsw pu35zrt1ac0i?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1ac0j?>Late Interpretation or
Expansion</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0k?><emphasis><?xxe-sn 26stp2g6sxs d?>Late
Interpretation</emphasis> can be conceptualized as a <emphasis><?xxe-sn 26stp2g6sxs e?>partial</emphasis>
expansion, i.e. a simplification or elimination of interpretable parts of
certain statements.</para>
<programlisting xml:id="LateIntr_1"><?xxe-sn 26cy4nalqsw pu35zrt1ac0l?>name="tests/interpretation.cpp: Interpretation.Doc_LateIntr_1"
test = function(x:: int):: int; entry
{
comm= "inc":: string; i12n(on).
y= if (comm == "inc"):: int
{x + 1} else {x}.
y
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0m?>In this example, computation of
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac0n?>y</code> depends on
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac0o?>comm</code> and <code><?xxe-sn 26cy4nalqsw pu35zrt1ac0p?>x</code>.
On the one hand, <code><?xxe-sn 26cy4nalqsw pu35zrt1ac0q?>comm</code> has
an annotation that requires interpretation, while on the other hand
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac0r?>x</code> is unknown at the
compile-time and thus cannot be interpreted. In this case the only way to
satisfy contradictory requirements is to <emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac0s?>expand</emphasis>
the <code><?xxe-sn 26cy4nalqsw pu35zrt1ac0t?>if</code> statement, since it
is only possible to interpret condition part of the statement, leaving
conditional blocks unchanged. In other words, the <code><?xxe-sn 26cy4nalqsw pu35zrt1ac0u?>if</code>
statement is <emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac0v?>expanded</emphasis>
which results in only one of the child blocks being compiled,
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac0w?>x+1</code> in this example, based
on already known fact that the <code><?xxe-sn 26stp2g6sxs f?>else</code>
block would never be executed.</para>
<remark><?xxe-sn 26stp2g6sxs g?>"to interpret condition part of the
statement" - это не смог понять. - <emphasis role="bold"><?xxe-sn 26stp2g6sxs h?>`if
(...) {..} else {...}` is a statement. It consists of condition part `if
(..)`, and two blocks - "if-true" block and "if-false" block
</emphasis></remark>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0x?>Due to the fact that expansion,
as opposed to "pure interpretation", leaves some portion of the code for
subsequent compilation it can also be called <emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac0y?>late
interpretation</emphasis> for the result depends on runtime information
and has memory and performance footprint.</para>
<remark><?xxe-sn 26stp2g6sxs i?>as having runtime footprint - не понял.
Что-то связанное с требованиями к памяти? Но это кажется о программах, а
не о interpretation - <emphasis role="bold"><?xxe-sn 26stp2g6sxs j?>переписал
фразу</emphasis></remark>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac0z?>Below is a more complex example
of a loop expansion:</para>
<programlisting xml:id="LateIntr_2"><?xxe-sn 26cy4nalqsw pu35zrt1ac10?>name="tests/interpretation.cpp: Interpretation.Doc_LateIntr_2"
main = function(x:: int):: int; entry
{
commands = {"inc", "double", "dec"}:: [string]; i12n(on).
loop fold(commands->comm::string, x->operand):: int
{
switch(comm):: int
case ("inc") {operand + 1}
case ("dec") {operand - 1}
case ("double") {operand * 2}
}
}
</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac11?>Identifier <code><?xxe-sn 26cy4nalqsw pu35zrt1ac12?>commands</code>
contains a list of operations that need to be interpreted as indicated by
the corresponding annotation. Operand <code><?xxe-sn 26cy4nalqsw pu35zrt1ac13?>x</code>
is assigned at runtime. This is the same situation as in previous example,
and it triggers expansion as expected. The result after expansion looks as
follows:</para>
<programlisting xml:id="Alt_LateIntr_2"><?xxe-sn 26cy4nalqsw pu35zrt1ac14?>name="tests/interpretation.cpp: Interpretation.Doc_LateIntr_2"
main = function(x:: int):: int; entry
{
x{1} = x + 1:: int.
x{2} = x{1} * 2:: int.
x{3} = x{2} * 1:: int.
x{3}
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac15?>In other words, this mimics the
well known loop unrolling technique by putting several copies of the loop
body in a row, each one for every item in the list <code><?xxe-sn 26stp2g6sxs k?>commands</code>.</para>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac16?>As of now, the following
statements support late interpretation:</para>
<itemizedlist>
<?xxe-sn 26cy4nalqsw pu35zrt1ac17?>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac18?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac19?>Branching statements:
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1a?>if</code>, <code><?xxe-sn 26cy4nalqsw pu35zrt1ac1b?>switch</code>,
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1c?>switch variant</code>,
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1d?>switch late</code>.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac1e?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac1f?>Loop statements:
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1g?>loop fold</code>.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac1h?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac1i?>Functions.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac1j?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac1k?>Other operators:
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1l?>query late</code>.</para>
</listitem>
</itemizedlist>
</section>
<section>
<?xxe-sn 26cy4nalqsw pu35zrt1ac1m?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1ac1n?>Partial or Late Function
Interpretation</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac1o?>Xreate supports cases where a
function has mixed arguments in terms of interpretation, some of which
need to be interpreted, while others need to be compiled.</para>
<programlisting xml:id="LateFnIntr_1"><?xxe-sn 26cy4nalqsw pu35zrt1ac1p?>name="tests/interpretation.cpp: Interpretation.Doc_LateFnIntr_1"
evaluate= function(argument:: num, code:: string; i12n(on)):: num
{
switch(code):: num
case ("inc") {argument + 1}
case ("dec") {argument - 1}
case ("double") {argument * 2}
case default {argument}
}
main = function(init::int):: int; entry
{
commands= {"inc", "double", "dec"}:: [string]; i12n(on).
loop fold(commands->comm::string, init->operand):: int
{
evaluate(operand, comm)
}
}</programlisting>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac1q?>Looking at the function
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1r?>evaluate</code>'s signature in
this example we can see only one argument <code><?xxe-sn 26cy4nalqsw pu35zrt1ac1s?>code</code>
that requires interpretation. This means that the function <code><?xxe-sn 26cy4nalqsw pu35zrt1ac1t?>evaluate</code>
is subject to a partial interpretation or, in other words,
<emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac1u?>late function
interpretation</emphasis>.</para>
<para><?xxe-sn 26stp2g6sxs n?>In general, to enable late interpretation
for a function, at least one of its arguments should be annotated as
<code><?xxe-sn 26cy4nalqsw pu35zrt1ac1v?>i12n(on)</code>. What compiler
does next is to generate a number of distinctive <emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac1w?>function
specializations</emphasis>. Each unique combination of interpretable
argument values corresponds to its own function specialization. This
should be used with cautiousness, since compiler can generate large
amounts of code in some cases.</para>
<remark><?xxe-sn 26stp2g6sxs l?>What compiler does next is to generate
number - то же самое, что в примеч. ниже (a number - несколько, the number
- конкретное число).To enable late interpretation for function - тут перед
function обязательно нужен артикль - определенный (the), если речь идет о
evaluate, или неопределенный (а) если речь идет о любой функции (я указал
the) - <emphasis role="bold"><?xxe-sn 26stp2g6sxs m?>OK</emphasis></remark>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac1x?>Based on the above example, three
different <code><?xxe-sn 26cy4nalqsw pu35zrt1ac1y?>evaluate</code>
specializations are generated as follows:</para>
<programlisting xml:id="Alt_LateFnIntr_1"><?xxe-sn 26cy4nalqsw pu35zrt1ac1z?>name="tests/interpretation.cpp: Interpretation.Doc_LateFnIntr_1"
main= function(init::int):: int; entry
{
operand = init:: int.
operand{1} = evaluate1(operand):: int.
operand{2} = evaluate2(operand{1})::int.
operand{3} = evaluate3(operand{2})::int.
operand(3)
}</programlisting>
</section>
<section>
<?xxe-sn 26cy4nalqsw pu35zrt1ac20?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1ac21?>Domain Specific Languages and
Interpretation</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac22?>DSL is an idea of expressing
various concepts in a lapidary and concise form. Xreate recognizes and
acknowledges very successful and beneficial DSL usage in certain areas,
primarily to express <emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac23?>queries</emphasis>
and <emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac24?>configs</emphasis>, to
name a few. It is possible to use interpretation abilities to emulate DSL.
Developer can express the desired functionality in the form of nested
lists of numbers, variants and strings which are then processed by a
partially interpreted function. Such function in its turn transforms the
input data into a set of low level compilation instructions so there is no
runtime overhead.</para>
</section>
<section>
<?xxe-sn 26cy4nalqsw pu35zrt1ac25?>
<title><?xxe-sn 26cy4nalqsw pu35zrt1ac26?>On Interpretation
Analysis</title>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac27?>Analysis follows classical
<emphasis><?xxe-sn 26stp2g6sxs o?>type reconstruction</emphasis>
algorithms to determine which expressions are subject to interpretation
and check the correctness of reconstruction w.r.t. developer-provided
annotations. Analysis consists of two general parts:</para>
<itemizedlist>
<?xxe-sn 26cy4nalqsw pu35zrt1ac28?>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac29?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac2a?><emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac2b?>Inference</emphasis>.
Infers if it is possible to interpret an expression based on its
already inferred argument's decisions.</para>
</listitem>
<listitem>
<?xxe-sn 26cy4nalqsw pu35zrt1ac2c?>
<para><?xxe-sn 26cy4nalqsw pu35zrt1ac2d?><emphasis><?xxe-sn 26cy4nalqsw pu35zrt1ac2e?>Unification</emphasis>.
Assigns an appropriate decision w.r.t. previously inferred
expectations and developer-provided hints as well.</para>
</listitem>
</itemizedlist>
</section>
</chapter>
<?xxe-revisions
#6 2018-12-15T16:59:22Z pgess
#5 2018-12-15T16:52:17Z pgess
1sPEAAABgcQRADKBw2wAABoRc6Y2IwkTgR+DCYNeM0RDBBMLQx4TCDOBmi4A3R2mTqpOghXYbqY6
UpIdLg==
#4 2018-12-15T16:19:00Z pgess
1sPEAAABgcNsAEyBw2AAACYfc8wdExoTkBhDCmMEEwRTG1M3EwljhFITF0MlQ+BbUxVDEFMLMwsA
zUnMM5Ig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