|
@@ -8417,14 +8417,11 @@ statements to x86. The \LangCIf{} language also adds a \code{return}
|
|
statement to finish the program with a specified value.
|
|
statement to finish the program with a specified value.
|
|
%
|
|
%
|
|
The \key{CProgram} construct contains a dictionary mapping labels to
|
|
The \key{CProgram} construct contains a dictionary mapping labels to
|
|
-lists of statements that end with a \code{return} statement, a
|
|
|
|
-\code{goto}, or a conditional \code{goto}.
|
|
|
|
-%% Statement lists of this
|
|
|
|
-%% form are called \emph{basic blocks}\index{subject}{basic block}: there
|
|
|
|
-%% is a control transfer at the end and control only enters at the
|
|
|
|
-%% beginning of the list, which is marked by the label.
|
|
|
|
-%
|
|
|
|
-A \code{goto} statement transfers control to the sequence of statements
|
|
|
|
|
|
+lists of statements that end with a \emph{tail} statement, which is
|
|
|
|
+either a \code{return} statement, a \code{goto}, or a conditional
|
|
|
|
+\code{goto}.
|
|
|
|
+%
|
|
|
|
+A \code{goto} transfers control to the sequence of statements
|
|
associated with its label.
|
|
associated with its label.
|
|
%
|
|
%
|
|
The concrete syntax for \LangCIf{} is defined in
|
|
The concrete syntax for \LangCIf{} is defined in
|
|
@@ -8461,8 +8458,7 @@ in figure~\ref{fig:c1-syntax}.
|
|
\MID \CBINOP{\itm{binaryop}}{\Atm}{\Atm}
|
|
\MID \CBINOP{\itm{binaryop}}{\Atm}{\Atm}
|
|
\MID \CUNIOP{\itm{unaryop}}{\Atm} \\
|
|
\MID \CUNIOP{\itm{unaryop}}{\Atm} \\
|
|
&\MID& \CCMP{\itm{cmp}}{\Atm}{\Atm} \\
|
|
&\MID& \CCMP{\itm{cmp}}{\Atm}{\Atm} \\
|
|
-\Stmt &::=& \CPRINT{\Atm} \MID \Exp \\
|
|
|
|
- &\MID& \CASSIGN{\Var}{\Exp} \\
|
|
|
|
|
|
+\Stmt &::=& \CPRINT{\Atm} \MID \Exp \MID \CASSIGN{\Var}{\Exp} \\
|
|
\Tail &::=& \CRETURN{\Exp} \MID \CGOTO{\itm{label}} \\
|
|
\Tail &::=& \CRETURN{\Exp} \MID \CGOTO{\itm{label}} \\
|
|
&\MID& \CIFSTMT{\CCMP{\itm{cmp}}{\Atm}{\Atm}}{\CGOTO{\itm{label}}}{\CGOTO{\itm{label}}}
|
|
&\MID& \CIFSTMT{\CCMP{\itm{cmp}}{\Atm}{\Atm}}{\CGOTO{\itm{label}}}{\CGOTO{\itm{label}}}
|
|
\end{array}
|
|
\end{array}
|