From ade2f9fbb72bc960a053b6aebf6287977b099090 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 15 May 2022 21:58:45 -0400 Subject: Fill in some missing full documentation links from help --- docs/doc/expression.html | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs/doc/expression.html') diff --git a/docs/doc/expression.html b/docs/doc/expression.html index c1b4d539..b2f40951 100644 --- a/docs/doc/expression.html +++ b/docs/doc/expression.html @@ -58,6 +58,8 @@

The four roles (subject, function, two kinds of modifier) describe expressions, not values. When an expression is evaluated, the value's type doesn't have to correspond to its role, and can even change from one evaluation to another. An expression's role is determined entirely by its source code, so it's fixed.

In the table, ? marks an optional left argument. If there isn't a value in that position, or it's Nothing (·), the middle function will be called with only one argument.

If you're comfortable reading BNF and want to understand things in more detail than described below, you might check the grammar specification as well.

+

Parentheses

+

As in most programming languages, parentheses () are for grouping. The code inside a balanced set of parentheses is a single expression, which produces one value to be used by the expression that contains it—for example, in (2×3)+4, 2×3 is a subexpression evaluating to 6, so that larger expression is equivalent to 6+4. The syntactic role of a set of parentheses is also the same as that of the expression inside.

Syntactic role

This issue is approached from a different angle in Context free grammar.

In APL, the way one part of an expression interacts with others is determined by its value. That means that to parse an expression, in general you would have to evaluate that part, get a value, check its type, and then figure out how it fits in with the rest of the expression. This is a lot of work. BQN changes things so that you can determine how to parse an expression just by looking at its source code. But because it still needs to support expressions that can evaluate to more than one possible type, BQN has to introduce a new and independent concept, called syntactic role, in order to support APL-like expressions.

-- cgit v1.2.3