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 /spec | |
| parent | 9f437d3468c9078c46d30da68ac3821cacb045e5 (diff) | |
Specification for Catch (β)
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/evaluate.md | 2 | ||||
| -rw-r--r-- | spec/primitive.md | 2 | ||||
| -rw-r--r-- | spec/token.md | 2 |
3 files changed, 5 insertions, 1 deletions
diff --git a/spec/evaluate.md b/spec/evaluate.md index 1ef6486a..e3cd2666 100644 --- a/spec/evaluate.md +++ b/spec/evaluate.md @@ -6,6 +6,8 @@ This page describes the semantics of the code constructs whose grammar is given Here we assume that the referent of each identifier, or equivalently the connections between identifiers, have been identified according to the [scoping rules](scope.md). +Errors described in this page are "evaluation errors" and can be caught by the Catch (`β`) 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. + ### Programs and blocks The result of parsing a valid BQN program is a `PROGRAM`, and the program is run by evaluating this term. diff --git a/spec/primitive.md b/spec/primitive.md index 386b0dcf..dc089cfa 100644 --- a/spec/primitive.md +++ b/spec/primitive.md @@ -75,6 +75,8 @@ Inferred properties are specified in [their own document](inferred.md), not in t - **Assert** (`!`) causes an error if the argument is not `1`. If `π¨` is provided, it gives a message to be associated with this error (which can be any value, not necessarily a string). +- **Catch** (`β`) evaluates `π½` on the arguments `π¨` (if present) and `π©`. If `π½` completes without error it returns the result, but if evaluation of `π½` results in an error then the error is suppressed, and Catch evaluates `πΎ` on the arguments and returns the result. Errors in `πΎ` 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. + ## Commentary on other primitives As noted above, see [reference.bqn](reference.bqn) for the authoritative definitions. Commentary here gives an overall description and highlights implementation subtleties and edge cases. diff --git a/spec/token.md b/spec/token.md index 89d0d521..230f1f0b 100644 --- a/spec/token.md +++ b/spec/token.md @@ -23,7 +23,7 @@ Otherwise, a single character forms a token. Only the specified set of character | Null literal | `@` | Primitive Function | `+-ΓΓ·ββββ\|Β¬β§β¨<>β =β€β₯β‘β’β£β’β₯βΎββββ«»β½β/ββββββββ·β!` | Primitive 1-Modifier | `` ΛΛΛΒ¨ββΌΒ΄Λ` `` -| Primitive 2-Modifier | `βββΈββΎββΆβββ` +| Primitive 2-Modifier | `βββΈββΎββΆββββ` | Special name | `π¨π©πππ€πππ½πΎπ` | Punctuation | `βββ©β(){}β¨β©βΏβ,.` and newline |
