diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-16 15:44:04 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-16 15:44:04 -0400 |
| commit | 07bf9008a0698d2ada09fe7db471adb349f1703c (patch) | |
| tree | 693716dd901e4f96781e188763714058628b2b57 /docs | |
| parent | 9f437d3468c9078c46d30da68ac3821cacb045e5 (diff) | |
Specification for Catch (β)
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/spec/evaluate.html | 1 | ||||
| -rw-r--r-- | docs/spec/primitive.html | 3 | ||||
| -rw-r--r-- | docs/spec/token.html | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/docs/spec/evaluate.html b/docs/spec/evaluate.html index 892aa7a5..9e221c53 100644 --- a/docs/spec/evaluate.html +++ b/docs/spec/evaluate.html @@ -7,6 +7,7 @@ <h1 id="specification-bqn-evaluation">Specification: BQN evaluation</h1> <p>This page describes the semantics of the code constructs whose grammar is given in <a href="grammar.html">grammar.md</a>. The formation rules there are not named, and here they are identified by either the name of the term or by copying the rule entirely if there are several alternative productions.</p> <p>Here we assume that the referent of each identifier, or equivalently the connections between identifiers, have been identified according to the <a href="scope.html">scoping rules</a>.</p> +<p>Errors described in this page are "evaluation errors" and can be caught by the Catch (<code><span class='Modifier2'>β</span></code>) modifier. If an error is caught, evaluation halts without attempting to complete any in-progress node, and is restarted as part of the execution of Catch.</p> <h3 id="programs-and-blocks">Programs and blocks</h3> <p>The result of parsing a valid BQN program is a <code><span class='Function'>PROGRAM</span></code>, and the program is run by evaluating this term.</p> <p>A <code><span class='Function'>PROGRAM</span></code> or <code><span class='Function'>BODY</span></code> is a list of <code><span class='Function'>STMT</span></code>s, which are evaluated in program order. A result is always required for <code><span class='Function'>BODY</span></code> nodes, and sometimes for <code><span class='Function'>PROGRAM</span></code> nodes (for example, when loaded with <code><span class='Function'>β’Import</span></code>). If any identifiers in the node's scope are exported, or any of its statements is an <code><span class='Function'>EXPORT</span></code>, then the result is the namespace created in order to evaluate the node. If a result is required but the namespace case doesn't apply, then the last <code><span class='Function'>STMT</span></code> node must be an <code><span class='Function'>EXPR</span></code> and its result is used. The statement <code><span class='Function'>EXPR</span></code> evaluates some APL code and possibly assigns the results, while <code><span class='Value'>nothing</span></code> evaluates any <code><span class='Value'>subject</span></code> or <code><span class='Function'>Derv</span></code> terms it contains but discards the results. An <code><span class='Function'>EXPORT</span></code> statement performs no action.</p> diff --git a/docs/spec/primitive.html b/docs/spec/primitive.html index 5b850b6a..a559a85e 100644 --- a/docs/spec/primitive.html +++ b/docs/spec/primitive.html @@ -68,6 +68,9 @@ <ul> <li><strong>Assert</strong> (<code><span class='Function'>!</span></code>) causes an error if the argument is not <code><span class='Number'>1</span></code>. If <code><span class='Value'>π¨</span></code> is provided, it gives a message to be associated with this error (which can be any value, not necessarily a string).</li> </ul> +<ul> +<li><strong>Catch</strong> (<code><span class='Modifier2'>β</span></code>) evaluates <code><span class='Function'>π½</span></code> on the arguments <code><span class='Value'>π¨</span></code> (if present) and <code><span class='Value'>π©</span></code>. If <code><span class='Function'>π½</span></code> completes without error it returns the result, but if evaluation of <code><span class='Function'>π½</span></code> results in an error then the error is suppressed, and Catch evaluates <code><span class='Function'>πΎ</span></code> on the arguments and returns the result. Errors in <code><span class='Function'>πΎ</span></code> are not caught. Catch only prevents evaluation errors, and not syntax errors: these are considered errors in the program as a whole rather than any particular part of it.</li> +</ul> <h2 id="commentary-on-other-primitives">Commentary on other primitives</h2> <p>As noted above, see <a href="https://github.com/mlochbaum/BQN/blob/master/spec/reference.bqn">reference.bqn</a> for the authoritative definitions. Commentary here gives an overall description and highlights implementation subtleties and edge cases.</p> <h3 id="combinators">Combinators</h3> diff --git a/docs/spec/token.html b/docs/spec/token.html index aee04486..8eb4bcee 100644 --- a/docs/spec/token.html +++ b/docs/spec/token.html @@ -35,7 +35,7 @@ </tr> <tr> <td>Primitive 2-Modifier</td> -<td><code><span class='Modifier2'>βββΈββΎββΆβββ</span></code></td> +<td><code><span class='Modifier2'>βββΈββΎββΆββββ</span></code></td> </tr> <tr> <td>Special name</td> |
