aboutsummaryrefslogtreecommitdiff
path: root/docs/doc
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2022-05-15 21:58:45 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2022-05-15 21:58:45 -0400
commitade2f9fbb72bc960a053b6aebf6287977b099090 (patch)
treeb9f9cd62807991ffb537d406c00b6f77b60750bf /docs/doc
parent8a64b4b7a1a721b0d8034195ba718aed6992241e (diff)
Fill in some missing full documentation links from help
Diffstat (limited to 'docs/doc')
-rw-r--r--docs/doc/expression.html2
1 files changed, 2 insertions, 0 deletions
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 @@
<p>The four roles (subject, function, two kinds of modifier) describe expressions, not values. When an expression is evaluated, the value's <a href="types.html">type</a> 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.</p>
<p>In the table, <code><span class='Head'>?</span></code> marks an optional left argument. If there isn't a value in that position, or it's <a href="#nothing">Nothing</a> (<code><span class='Nothing'>·</span></code>), the middle function will be called with only one argument.</p>
<p>If you're comfortable reading <a href="https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form">BNF</a> and want to understand things in more detail than described below, you might check the <a href="../spec/grammar.html">grammar specification</a> as well.</p>
+<h2 id="parentheses"><a class="header" href="#parentheses">Parentheses</a></h2>
+<p>As in most programming languages, parentheses <code><span class='Paren'>()</span></code> 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 <code><span class='Paren'>(</span><span class='Number'>2</span><span class='Function'>×</span><span class='Number'>3</span><span class='Paren'>)</span><span class='Function'>+</span><span class='Number'>4</span></code>, <code><span class='Number'>2</span><span class='Function'>×</span><span class='Number'>3</span></code> is a subexpression evaluating to <code><span class='Number'>6</span></code>, so that larger expression is equivalent to <code><span class='Number'>6</span><span class='Function'>+</span><span class='Number'>4</span></code>. The syntactic role of a set of parentheses is also the same as that of the expression inside.</p>
<h2 id="syntactic-role"><a class="header" href="#syntactic-role">Syntactic role</a></h2>
<p><em>This issue is approached from a different angle in <a href="context.html">Context free grammar</a>.</em></p>
<p>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 <a href="types.html">type</a>, BQN has to introduce a new and independent concept, called <strong>syntactic role</strong>, in order to support APL-like expressions.</p>