From fb3580660898306105c2e1f041f29bbdb9006210 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 29 Nov 2021 20:55:22 -0500 Subject: =?UTF-8?q?Remove=20return=20(=E2=86=92)=20from=20the=20spec?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/spec/evaluate.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'docs/spec/evaluate.html') diff --git a/docs/spec/evaluate.html b/docs/spec/evaluate.html index 9b57dd5f..44a337b5 100644 --- a/docs/spec/evaluate.html +++ b/docs/spec/evaluate.html @@ -7,7 +7,7 @@

Specification: BQN evaluation

This page describes the semantics of the code constructs whose grammar is given in grammar.md. 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.

Here we assume that the referent of each identifier, or equivalently the connections between identifiers, have been identified according to the scoping rules.

-

Evaluation is an ordered process, and any actions required to evaluate a node always have a specified order unless performing them in any order would have the same effect. Side effects that are relevant to ordering are setting and getting the value of a variable, causing an error, and returning (with ) from a block. Errors described in this page are "evaluation errors" and can be caught by the Catch () modifier. For caught errors and returns, evaluation halts without attempting to complete any in-progress node, and is restarted by Catch (for errors) or at the end of the appropriate block evaluation (for returns).

+

Evaluation is an ordered process, and any actions required to evaluate a node always have a specified order unless performing them in any order would have the same effect. Side effects that are relevant to ordering are setting and getting the value of a variable, and causing an error. Errors described in this page are "evaluation errors" and can be caught by the Catch () modifier. If caught, evaluation halts without attempting to complete any in-progress node, and is restarted by Catch.

As specified, BQN programs can involve an arbitrary amount of information, but when run there will be memory and possibly other limitations. To accommodate this, any part of evaluation can cause an error, if a resource such as memory, stack memory, or limited execution time is exhausted.

Programs and blocks

The result of parsing a valid BQN program is a PROGRAM, and the program is run by evaluating this term.

@@ -23,7 +23,6 @@

Modified assignment is the subject assignment rule lhs Derv "↩" subExpr?. In this case, lhs is evaluated as if it were a subExpr (the syntax is a subset of subExpr), and passed as an argument to Derv. The full application is lhs Derv subExpr, if subExpr is given, and Derv lhs otherwise. Its value is assigned to lhs, and is also the result of the modified assignment expression.

Expressions

We now give rules for evaluating an atom, Func, _mod1 or _mod2_ expression (the possible options for ANY). A literal or primitive sl, Fl, _ml, or _cl_ has a fixed value defined by the specification (literals and built-ins). An identifier s, F, _m, or _c_, if not preceded by atom ".", must have an associated variable due to the scoping rules, and returns this variable's value, or causes an error if it has not yet been set. If it is preceded by atom ".", then the atom node is evaluated first; its value must be a namespace, and the result is the value of the identifier's name in the namespace, or an error if the name is undefined. A parenthesized expression such as "(" _modExpr ")" simply returns the result of the interior expression. A braced construct such as BraceFunc is defined by the evaluation of the statements it contains after all parameters are accepted. Finally, a list "⟨" ? ( ( EXPR )* EXPR ? )? "⟩" or ANY ( "‿" ANY )+ consists grammatically of a list of expressions. To evaluate it, each expression is evaluated in source order and their results are placed as elements of a rank-1 array. The two forms have identical semantics but different punctuation.

-

A Return node creates a return function. As discussed in the scoping rules, its identifier indicates a namespace from a particular block evaluation. When called, the function causes an error if that block has finished execution, or if the call includes a left argument 𝕨. Otherwise, evaluation stops immediately, and resumes at the end of the block where it returns the right argument 𝕩 from that block.

Rules in the table below are function and modifier evaluation.

-- cgit v1.2.3