diff --git a/chapters/syntax.tex b/chapters/syntax.tex index e6d5be079..843060257 100644 --- a/chapters/syntax.tex +++ b/chapters/syntax.tex @@ -267,17 +267,20 @@ \subsection{Equations}\label{equations1} [ initial ] algorithm { statement ";" } some-equation : - ( simple-expression "=" expression + ( equation-or-procedure | if-equation | for-equation | connect-equation | when-equation - | component-reference function-call-args ) description +equation-or-procedure : + simple-expression "=" expression + | component-reference function-call-args + statement : - ( component-reference ( ":=" expression | function-call-args ) + ( statement-or-procedure | "(" output-expression-list ")" ":=" component-reference function-call-args | break @@ -289,6 +292,10 @@ \subsection{Equations}\label{equations1} ) description +statement-or-procedure : + component-reference ":=" expression + | component-reference function-call-args + if-equation : if expression then { some-equation ";" } @@ -352,6 +359,11 @@ \subsection{Equations}\label{equations1} connect "(" component-reference "," component-reference ")" \end{lstlisting} +\begin{nonnormative} +The productions \lstinline[language=grammar]!equation-or-procedure! and \lstinline[language=grammar]!statement-or-procedure! are not suitable for recursive descent parsers. +A work-around is to left-factor them and for \lstinline[language=grammar]!equation-or-procedure! introduce semantic checks to ensure that only the grammar above is accepted. +\end{nonnormative} + \subsection{Expressions}\label{expressions1} \begin{lstlisting}[language=grammar]