Doc: more details on the syntax of the dictionaries, variables and multi-expressions
This commit is contained in:
+134
-71
@@ -549,31 +549,31 @@ pre.rouge .ss {
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_strings">2.2. Strings</a></li>
|
||||
<li><a href="#_boolean">2.3. Boolean</a></li>
|
||||
<li><a href="#_booleans">2.3. Booleans</a></li>
|
||||
<li><a href="#_lists">2.4. Lists</a></li>
|
||||
<li><a href="#_dictionaries">2.5. Dictionaries</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_dictionaries">3. Dictionaries</a></li>
|
||||
<li><a href="#_variables">4. Variables</a></li>
|
||||
<li><a href="#_other_operations">5. Other operations</a>
|
||||
<li><a href="#_variables">3. Variables</a></li>
|
||||
<li><a href="#_other_operations">4. Other operations</a>
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_operator">5.1. <code class="blue">;</code> operator</a></li>
|
||||
<li><a href="#_but_operator">5.2. <code class="blue">but</code> operator</a></li>
|
||||
<li><a href="#_assignment_operator">5.3. Assignment operator <code class="blue">=</code></a></li>
|
||||
<li><a href="#_selector_operator">5.4. Selector operator <code class="blue">? : ::</code></a></li>
|
||||
<li><a href="#_operator">4.1. <code class="blue">;</code> operator</a></li>
|
||||
<li><a href="#_but_operator">4.2. <code class="blue">but</code> operator</a></li>
|
||||
<li><a href="#_assignment_operator">4.3. Assignment operator <code class="blue">=</code></a></li>
|
||||
<li><a href="#_selector_operator">4.4. Selector operator <code class="blue">? : ::</code></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_priorities_of_operators">6. Priorities of operators</a></li>
|
||||
<li><a href="#_functions">7. Functions</a>
|
||||
<li><a href="#_priorities_of_operators">5. Priorities of operators</a></li>
|
||||
<li><a href="#_functions">6. Functions</a>
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_function_calls">7.1. Function calls</a></li>
|
||||
<li><a href="#_function_definitions">7.2. Function definitions</a></li>
|
||||
<li><a href="#_function_calls">6.1. Function calls</a></li>
|
||||
<li><a href="#_function_definitions">6.2. Function definitions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#_builtins">8. Builtins</a>
|
||||
<li><a href="#_builtins">7. Builtins</a>
|
||||
<ul class="sectlevel2">
|
||||
<li><a href="#_builtin_functions">8.1. Builtin functions</a></li>
|
||||
<li><a href="#_import">8.2. <em class="blue">import()</em></a></li>
|
||||
<li><a href="#_builtin_functions">7.1. Builtin functions</a></li>
|
||||
<li><a href="#_import">7.2. <em class="blue">import()</em></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@@ -584,7 +584,7 @@ pre.rouge .ss {
|
||||
<div class="sectionbody">
|
||||
<!-- toc disabled -->
|
||||
<div class="paragraph">
|
||||
<p><mark>TODO: Work in progress (last update on 2024/05/16, 7:08 a.m.)</mark></p>
|
||||
<p><mark>TODO: Work in progress (last update on 2024/05/17, 7:30 a.m.)</mark></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -622,7 +622,7 @@ pre.rouge .ss {
|
||||
<div class="listingblock">
|
||||
<div class="title">Run <code>dev-expr</code> in REPL mode and ask for help</div>
|
||||
<div class="content">
|
||||
<pre class="rouge highlight"><code data-lang="shell"><span class="c"># Assume the expr source directory. Type 'exit' or Ctrl+D to quit the program.</span>
|
||||
<pre class="rouge highlight"><code data-lang="shell"><span class="c"># Type 'exit' or Ctrl+D to quit the program.</span>
|
||||
|
||||
<span class="o">[</span>user]<span class="nv">$ </span>./dev-expr
|
||||
<span class="nb">expr</span> <span class="nt">--</span> Expressions calculator v1.7.1<span class="o">(</span>build 2<span class="o">)</span>,2024/05/16 <span class="o">(</span>celestino.amoroso@portale-stac.it<span class="o">)</span>
|
||||
@@ -947,6 +947,7 @@ pre.rouge .ss {
|
||||
<p>Fractions can be used together with integers and floats in expressions.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<div class="title">Examples</div>
|
||||
<p><code>>>></code> <code class="blue">1|2 + 5</code><br>
|
||||
<code class="green">11|2</code><br>
|
||||
<code>>>></code> <code class="blue">4 - 1|2</code><br>
|
||||
@@ -1034,7 +1035,7 @@ pre.rouge .ss {
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_boolean"><a class="anchor" href="#_boolean"></a><a class="link" href="#_boolean">2.3. Boolean</a></h3>
|
||||
<h3 id="_booleans"><a class="anchor" href="#_booleans"></a><a class="link" href="#_booleans">2.3. Booleans</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>Boolean data type has two values only: <em class="blue">true</em> and <em class="blue">false</em>. Relational and boolean expressions result in boolean values.</p>
|
||||
</div>
|
||||
@@ -1171,18 +1172,31 @@ pre.rouge .ss {
|
||||
<div class="sect2">
|
||||
<h3 id="_lists"><a class="anchor" href="#_lists"></a><a class="link" href="#_lists">2.4. Lists</a></h3>
|
||||
<div class="paragraph">
|
||||
<p><em>Expr</em> supports list of mixed-type values, also specified by normal expressions.</p>
|
||||
<p><em>Expr</em> supports list of mixed-type values, also specified by normal expressions. Internally, <em>Expr</em>'s lists are Go arrays.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">List examples</div>
|
||||
<div class="exampleblock">
|
||||
<div class="title">Example 5. List literal syntax</div>
|
||||
<div class="content">
|
||||
<pre class="rouge highlight"><code data-lang="go"><span class="p">[</span><span class="m">1</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="m">3</span><span class="p">]</span> <span class="c">// List of integers</span>
|
||||
<span class="p">[</span><span class="s">"one"</span><span class="p">,</span> <span class="s">"two"</span><span class="p">,</span> <span class="s">"three"</span><span class="p">]</span> <span class="c">// List of strings</span>
|
||||
<span class="p">[</span><span class="s">"one"</span><span class="p">,</span> <span class="m">2</span><span class="p">,</span> <span class="no">false</span><span class="p">,</span> <span class="m">4.1</span><span class="p">]</span> <span class="c">// List of mixed-types</span>
|
||||
<span class="p">[</span><span class="s">"one"</span><span class="o">+</span><span class="m">1</span><span class="p">,</span> <span class="m">2.0</span><span class="o">*</span><span class="p">(</span><span class="m">9</span><span class="o">-</span><span class="m">2</span><span class="p">)]</span> <span class="c">// List of expressions</span>
|
||||
<span class="p">[</span> <span class="p">[</span><span class="m">1</span><span class="p">,</span><span class="s">"one"</span><span class="p">],</span> <span class="p">[</span><span class="m">2</span><span class="p">,</span><span class="s">"two"</span><span class="p">]]</span> <span class="c">// List of lists</span></code></pre>
|
||||
<div class="paragraph">
|
||||
<p><strong><em>list</em></strong> = <em>empty-list</em> | <em>non-empty-list</em><br>
|
||||
<em>empty-list</em> = "<strong>[]</strong>"<br>
|
||||
<em>non-empty-list</em> = "<strong>[</strong>" <em>any-value</em> {"<strong>,</strong>" _any-value} "<strong>]</strong>"<br></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<div class="title">Examples</div>
|
||||
<p><code>>>></code> <code class="blue">[1,2,3]</code> <em class="gray">// List of integers</em><br>
|
||||
<code class="green">[1, 2, 3]</code><br>
|
||||
<code>>>></code> <code class="blue">["one", "two", "three"]</code> <em class="gray">// List of strings</em><br>
|
||||
<code class="green">["one", "two", "three"]</code><br>
|
||||
<code>>>></code> <code class="blue">["one", 2, false, 4.1]</code> <em class="gray">// List of mixed-types</em><br>
|
||||
<code class="green">["one", 2, false, 4.1]</code><br>
|
||||
<code>>>></code> <code class="blue">["one"+1, 2.0*(9-2)]</code> <em class="gray">// List of expressions</em><br>
|
||||
<code class="green">["one1", 14]</code><br>
|
||||
<code>>>></code> <code class="blue">[ [1,"one"], [2,"two"]]</code> <em class="gray">// List of lists</em><br>
|
||||
<code class="green">[[1, "one"], [2, "two"]]</code></p>
|
||||
</div>
|
||||
<table class="tableblock frame-all grid-all stretch">
|
||||
<caption class="title">Table 6. List operators</caption>
|
||||
<colgroup>
|
||||
@@ -1204,23 +1218,25 @@ pre.rouge .ss {
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">+</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Join</em></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Joins two lists</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><code class="blue">[1,2] + [3]</code> <em>[ [1,2,3] ]</em></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><code class="blue">[1,2] + [3]</code> → <em>[1,2,3]</em></p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><code class="blue">-</code></p></td>
|
||||
<td class="tableblock halign-center valign-top"><p class="tableblock"><em>Difference</em></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock">Left list without elements in the right list</p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><code class="blue">[1,2,3] - [2]</code> <em>[ [1,3] ]</em></p></td>
|
||||
<td class="tableblock halign-left valign-top"><p class="tableblock"><code class="blue">[1,2,3] - [2]</code> → <em>[1,3]</em></p></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="paragraph">
|
||||
<p>The items of array can be accessed using the dot <code>.</code> operator.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">Item access syntax</div>
|
||||
<div class="exampleblock">
|
||||
<div class="title">Example 6. Item access syntax</div>
|
||||
<div class="content">
|
||||
<pre class="rouge highlight"><code data-lang="bnf"><item> ::= <list-expr>"."<index-expr></code></pre>
|
||||
<div class="paragraph">
|
||||
<p><em>item</em> = <em>list-expr</em> "<strong>.</strong>" <em>list-expr</em></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
@@ -1241,22 +1257,8 @@ pre.rouge .ss {
|
||||
<code class="green">3</code></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_dictionaries"><a class="anchor" href="#_dictionaries"></a><a class="link" href="#_dictionaries">3. Dictionaries</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>The <em>dictionary</em> data-type is set of pairs <em>key/value</em>. It is also known as <em>map</em> or <em>associative array</em>. Dictionary literals are sequences of pairs separated by comma <code>,</code>; sequences are enclosed between brace brackets.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">Dictionary examples</div>
|
||||
<div class="content">
|
||||
<pre class="rouge highlight"><code data-lang="go"><span class="p">{</span><span class="m">1</span><span class="o">:</span><span class="s">"one"</span><span class="p">,</span> <span class="m">2</span><span class="o">:</span><span class="s">"two"</span><span class="p">}</span>
|
||||
<span class="p">{</span><span class="s">"one"</span><span class="o">:</span><span class="m">1</span><span class="p">,</span> <span class="s">"two"</span><span class="o">:</span> <span class="m">2</span><span class="p">}</span>
|
||||
<span class="p">{</span><span class="s">"sum"</span><span class="o">:</span><span class="m">1</span><span class="o">+</span><span class="m">2</span><span class="o">+</span><span class="m">3</span><span class="p">,</span> <span class="s">"prod"</span><span class="o">:</span><span class="m">1</span><span class="o">*</span><span class="m">2</span><span class="o">*</span><span class="m">3</span><span class="p">}</span></code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_dictionaries"><a class="anchor" href="#_dictionaries"></a><a class="link" href="#_dictionaries">2.5. Dictionaries</a></h3>
|
||||
<div class="admonitionblock warning">
|
||||
<table>
|
||||
<tr>
|
||||
@@ -1269,31 +1271,85 @@ Support for dictionaries is still ongoing.
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The <em>dictionary</em>, or <em>dict</em>, data-type is set of pairs <em>key/value</em>. It is also known as <em>map</em> or <em>associative array</em>. Dictionary literals are sequences of pairs separated by comma <code>,</code>; sequences are enclosed between brace brackets.</p>
|
||||
</div>
|
||||
<div class="exampleblock">
|
||||
<div class="title">Example 7. Dict literal syntax</div>
|
||||
<div class="content">
|
||||
<div class="paragraph">
|
||||
<p><strong><em>dict</em></strong> = <em>empty-dict</em> | <em>non-empty-dict</em><br>
|
||||
<em>empty-dict</em> = "<strong>{}</strong>"<br>
|
||||
<em>non-empty-dict</em> = "<strong>{</strong>" <em>key-scalar</em> "<strong>:</strong>" <em>any-value</em> {"<strong>,</strong>" <em>key-scalar</em> "<strong>:</strong>" _any-value} "<strong>}</strong>"<br></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<div class="title">Examples</div>
|
||||
<p><code>>>></code> <code class="blue">{1:"one", 2:"two"}</code><br>
|
||||
<code>>>></code> <code class="blue">{"one":1, "two": 2}</code><br>
|
||||
<code>>>></code> <code class="blue">{"sum":1+2+3, "prod":1*2*3}</code></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_variables"><a class="anchor" href="#_variables"></a><a class="link" href="#_variables">4. Variables</a></h2>
|
||||
<h2 id="_variables"><a class="anchor" href="#_variables"></a><a class="link" href="#_variables">3. Variables</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>A variable is an identifier with an assigned value. Variables are stored in the object that implements the Go <em>ExprContext</em> interface, e.g. <em>SimpleVarStore</em> or <em>SimpleFuncStore</em>.</p>
|
||||
<p><em>Expr</em> supports variables like most programming languages. A variable is an identifier with an assigned value. Variables are stored in <em>contexts</em>.</p>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="title">Examples</div>
|
||||
<div class="exampleblock">
|
||||
<div class="title">Example 8. Variable literal syntax</div>
|
||||
<div class="content">
|
||||
<pre class="rouge highlight"><code data-lang="go"><span class="n">a</span><span class="o">=</span><span class="m">1</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="m">5.2</span> <span class="o">*</span> <span class="p">(</span><span class="m">9</span><span class="o">-</span><span class="m">3</span><span class="p">)</span>
|
||||
<span class="n">x</span> <span class="o">=</span> <span class="m">1</span><span class="p">;</span> <span class="n">y</span> <span class="o">=</span> <span class="m">2</span><span class="o">*</span><span class="n">x</span></code></pre>
|
||||
<div class="paragraph">
|
||||
<p><strong><em>variable</em></strong> = <em>identifier</em> "<strong>=</strong>" <em>any-value</em><br>
|
||||
<em>identifier</em> = <em>alpha</em> {(<em>alpha</em>)|<em>dec-digit</em>|"<strong>_</strong>"}<br>
|
||||
<em>alpha</em> = "<strong>a</strong>"|"<strong>b</strong>"|…​"<strong>z</strong>"|"<strong>A</strong>"|"<strong>B</strong>"|…​"<strong>Z</strong>"</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="admonitionblock note">
|
||||
<table>
|
||||
<tr>
|
||||
<td class="icon">
|
||||
<i class="fa icon-note" title="Note"></i>
|
||||
</td>
|
||||
<td class="content">
|
||||
The assign operator <code class="blue">=</code> returns the value assigned to the variable.
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<div class="title">Examples</div>
|
||||
<p><code>>>></code> <code class="blue">a=1</code><br>
|
||||
<code class="green">1</code><br>
|
||||
<code>>>></code> <code class="blue">a_b=1+2</code><br>
|
||||
<code class="green">1+2</code><br>
|
||||
<code>>>></code> <code class="blue">a_b</code><br>
|
||||
<code class="green">3</code><br>
|
||||
<code>>>></code> <code class="blue">x = 5.2 * (9-3)</code> <em class="gray">// The assigned value has the approximation error typical of the float data-type</em><br>
|
||||
<code class="green">31.200000000000003</code><br>
|
||||
<code>>>></code> <code class="blue">x = 1; y = 2*x</code><br>
|
||||
<code class="green">2</code><br>
|
||||
<code>>>></code> <code class="blue"><em>a=2</code><br>
|
||||
<code class="red">Parse Error: [1:2] unexpected token "</em>"</code><br>
|
||||
<code>>>></code> <code class="blue">1=2</code><br>
|
||||
<code class="red">Parse Error: assign operator ("=") must be preceded by a variable</code></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_other_operations"><a class="anchor" href="#_other_operations"></a><a class="link" href="#_other_operations">5. Other operations</a></h2>
|
||||
<h2 id="_other_operations"><a class="anchor" href="#_other_operations"></a><a class="link" href="#_other_operations">4. Other operations</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="sect2">
|
||||
<h3 id="_operator"><a class="anchor" href="#_operator"></a><a class="link" href="#_operator">5.1. <code class="blue">;</code> operator</a></h3>
|
||||
<h3 id="_operator"><a class="anchor" href="#_operator"></a><a class="link" href="#_operator">4.1. <code class="blue">;</code> operator</a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The semicolon operator <code class="blue">;</code> is an infixed pseudo-operator. It evaluates the left expression first and then the right expression. The latter is the final result.</p>
|
||||
<p>The semicolon operator <code class="blue">;</code> is an infixed pseudo-operator. It evaluates the left expression first and then the right expression. The value of the latter is the final result.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>An expression that contains <code class="blue">;</code> is called a <em>multi-expression</em> and each component expressione is called a <em>sub-expression</em>.</p>
|
||||
</div>
|
||||
<div class="admonitionblock important">
|
||||
<table>
|
||||
@@ -1319,15 +1375,22 @@ Technically <code class="blue">;</code> is not treated as a real operator. It ac
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="listingblock">
|
||||
<div class="paragraph">
|
||||
<div class="title">Example</div>
|
||||
<div class="content">
|
||||
<pre class="rouge highlight"><code data-lang="go"><span class="n">a</span><span class="o">=</span><span class="m">1</span><span class="p">;</span> <span class="n">b</span><span class="o">=</span><span class="m">2</span><span class="p">;</span> <span class="n">c</span><span class="o">=</span><span class="m">3</span><span class="p">;</span> <span class="n">a</span><span class="o">+</span><span class="n">b</span><span class="o">+</span><span class="n">c</span> <span class="c">// returns 6</span></code></pre>
|
||||
<p><code>>>></code> <code class="blue">a=1; b=2; c=3; a+b+c</code><br>
|
||||
<code class="green">6</code></p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<p>The value of each sub-expression is stored in the automatica variable <em>last</em>.</p>
|
||||
</div>
|
||||
<div class="paragraph">
|
||||
<div class="title">Example</div>
|
||||
<p><code>>>></code> <code class="blue">2+3; b=last+10; last</code><br>
|
||||
<code class="green">15</code></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_but_operator"><a class="anchor" href="#_but_operator"></a><a class="link" href="#_but_operator">5.2. <code class="blue">but</code> operator</a></h3>
|
||||
<h3 id="_but_operator"><a class="anchor" href="#_but_operator"></a><a class="link" href="#_but_operator">4.2. <code class="blue">but</code> operator</a></h3>
|
||||
<div class="paragraph">
|
||||
<p><code class="blue">but</code> is an infixed operator. Its operands can be expressions of any type. It evaluates the left expression first, then the right expression. The value of the right expression is the final result. Examples: <code class="blue">5 but 2</code> returns 2, <code class="blue">x=2*3 but x-1</code> returns 5.</p>
|
||||
</div>
|
||||
@@ -1336,7 +1399,7 @@ Technically <code class="blue">;</code> is not treated as a real operator. It ac
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_assignment_operator"><a class="anchor" href="#_assignment_operator"></a><a class="link" href="#_assignment_operator">5.3. Assignment operator <code class="blue">=</code></a></h3>
|
||||
<h3 id="_assignment_operator"><a class="anchor" href="#_assignment_operator"></a><a class="link" href="#_assignment_operator">4.3. Assignment operator <code class="blue">=</code></a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The assignment operator <code class="blue">=</code> is used to define variables in the evaluation context or to change their value (see <em>ExprContext</em>).
|
||||
The value on the left side of <code class="blue">=</code> must be an identifier. The value on the right side can be any expression and it becomes the result of the assignment operation.</p>
|
||||
@@ -1349,7 +1412,7 @@ The value on the left side of <code class="blue">=</code> must be an identifier.
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_selector_operator"><a class="anchor" href="#_selector_operator"></a><a class="link" href="#_selector_operator">5.4. Selector operator <code class="blue">? : ::</code></a></h3>
|
||||
<h3 id="_selector_operator"><a class="anchor" href="#_selector_operator"></a><a class="link" href="#_selector_operator">4.4. Selector operator <code class="blue">? : ::</code></a></h3>
|
||||
<div class="paragraph">
|
||||
<p>The <em>selector operator</em> is very similar to the <em>switch/case/default</em> statement available in many programming languages.</p>
|
||||
</div>
|
||||
@@ -1397,7 +1460,7 @@ The value on the left side of <code class="blue">=</code> must be an identifier.
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_priorities_of_operators"><a class="anchor" href="#_priorities_of_operators"></a><a class="link" href="#_priorities_of_operators">6. Priorities of operators</a></h2>
|
||||
<h2 id="_priorities_of_operators"><a class="anchor" href="#_priorities_of_operators"></a><a class="link" href="#_priorities_of_operators">5. Priorities of operators</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>The table below shows all supported operators by decreasing priorities.</p>
|
||||
@@ -1618,7 +1681,7 @@ The value on the left side of <code class="blue">=</code> must be an identifier.
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_functions"><a class="anchor" href="#_functions"></a><a class="link" href="#_functions">7. Functions</a></h2>
|
||||
<h2 id="_functions"><a class="anchor" href="#_functions"></a><a class="link" href="#_functions">6. Functions</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p>Functions in <em>Expr</em> are very similar to functions in many programming languages.</p>
|
||||
@@ -1627,13 +1690,13 @@ The value on the left side of <code class="blue">=</code> must be an identifier.
|
||||
<p>In <em>Expr</em> functions compute values in a local context (scope) that do not make effects on the calling context. This is the normal behavior. Using the reference operator <code class="blue">@</code> it is possibile to export local definition to the calling context.</p>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_function_calls"><a class="anchor" href="#_function_calls"></a><a class="link" href="#_function_calls">7.1. Function calls</a></h3>
|
||||
<h3 id="_function_calls"><a class="anchor" href="#_function_calls"></a><a class="link" href="#_function_calls">6.1. Function calls</a></h3>
|
||||
<div class="paragraph">
|
||||
<p><mark>TODO: function calls operations</mark></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_function_definitions"><a class="anchor" href="#_function_definitions"></a><a class="link" href="#_function_definitions">7.2. Function definitions</a></h3>
|
||||
<h3 id="_function_definitions"><a class="anchor" href="#_function_definitions"></a><a class="link" href="#_function_definitions">6.2. Function definitions</a></h3>
|
||||
<div class="paragraph">
|
||||
<p><mark>TODO: function definitions operations</mark></p>
|
||||
</div>
|
||||
@@ -1641,17 +1704,17 @@ The value on the left side of <code class="blue">=</code> must be an identifier.
|
||||
</div>
|
||||
</div>
|
||||
<div class="sect1">
|
||||
<h2 id="_builtins"><a class="anchor" href="#_builtins"></a><a class="link" href="#_builtins">8. Builtins</a></h2>
|
||||
<h2 id="_builtins"><a class="anchor" href="#_builtins"></a><a class="link" href="#_builtins">7. Builtins</a></h2>
|
||||
<div class="sectionbody">
|
||||
<div class="paragraph">
|
||||
<p><mark>TODO: builtins</mark></p>
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_builtin_functions"><a class="anchor" href="#_builtin_functions"></a><a class="link" href="#_builtin_functions">8.1. Builtin functions</a></h3>
|
||||
<h3 id="_builtin_functions"><a class="anchor" href="#_builtin_functions"></a><a class="link" href="#_builtin_functions">7.1. Builtin functions</a></h3>
|
||||
|
||||
</div>
|
||||
<div class="sect2">
|
||||
<h3 id="_import"><a class="anchor" href="#_import"></a><a class="link" href="#_import">8.2. <em class="blue">import()</em></a></h3>
|
||||
<h3 id="_import"><a class="anchor" href="#_import"></a><a class="link" href="#_import">7.2. <em class="blue">import()</em></a></h3>
|
||||
<div class="paragraph">
|
||||
<p><em class="blue">import(<span class="grey"><source-file></span>)</em> loads the multi-expression contained in the specified source and returns its value.</p>
|
||||
</div>
|
||||
@@ -1661,7 +1724,7 @@ The value on the left side of <code class="blue">=</code> must be an identifier.
|
||||
</div>
|
||||
<div id="footer">
|
||||
<div id="footer-text">
|
||||
Last updated 2024-05-16 07:10:03 +0200
|
||||
Last updated 2024-05-17 07:30:14 +0200
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user