Skip to content

Commit

Permalink
Additional changes for previous.
Browse files Browse the repository at this point in the history
  • Loading branch information
HansOlsson committed Aug 10, 2023
1 parent f2ee984 commit 110a0a1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions chapters/operatorsandexpressions.tex
Expand Up @@ -103,9 +103,10 @@ \section{Operator Precedence and Associativity}\label{operator-precedence-and-as
\end{center}
\end{table}

The postfix array index and postfix access operators are not expression operators in the normal sense that \lstinline!a.b[1]! can be treated as \lstinline!a.(b[1])!.
The postfix array index and postfix access operators are not merely expression operators in the normal sense that \lstinline!a.b[1]! can be treated as \lstinline!a.(b[1])!.
Instead, these operators need to be considered jointly to identify an entire \lstinline[language=grammar]!component-reference! (one of the alternative productions for \lstinline[language=grammar]!primary! in the grammar) which is the smallest unit that can be seen as an expression in itself.
Postfix array index and postifx access can only be applied immediately to a \lstinline[language=grammar]!component-reference!; not even parentheses around the left operand are allowed.
Postfix access can only be applied immediately to a \lstinline[language=grammar]!component-reference!; not even parentheses around the left operand are allowed.
Postfix array index can additionally be applied if there are parentheses around the left operand, see \cref{indexing}.

\begin{example}
Relative precedence of postfix array index and postfix access.
Expand All @@ -130,7 +131,6 @@ \section{Operator Precedence and Associativity}\label{operator-precedence-and-as
\end{lstlisting}
The relation between \lstinline!a.x!, \lstinline!a.x[2]!, and \lstinline!(a.x)[2]! illustrates the effect of giving higher precedence to array index than postfix access.
Had the precedence been equal, this would have changed the meaning of \lstinline!a.x[2]! to the same thing that \lstinline!(a.x)[2]! expresses, being a component reference of type \lstinline!Real[2]!.
Note that \lstinline!(a.x)[2]! was illegal in version 3.6 and earlier.
\end{example}

\begin{example}
Expand Down

0 comments on commit 110a0a1

Please sign in to comment.