|
@@ -12962,10 +12962,13 @@ definitions does not matter).
|
|
}
|
|
}
|
|
%
|
|
%
|
|
The concrete syntax for function application\index{subject}{function
|
|
The concrete syntax for function application\index{subject}{function
|
|
- application} is $\CAPPLY{\Exp}{\Exp \ldots}$ where the first expression
|
|
|
|
-must evaluate to a function and the rest are the arguments. The
|
|
|
|
|
|
+ application} is
|
|
|
|
+\python{$\CAPPLY{\Exp}{\Exp\code{,} \ldots}$}
|
|
|
|
+\racket{$\CAPPLY{\Exp}{\Exp \ldots}$}
|
|
|
|
+ where the first expression
|
|
|
|
+must evaluate to a function and the remaining expressions are the arguments. The
|
|
abstract syntax for function application is
|
|
abstract syntax for function application is
|
|
-$\APPLY{\Exp}{\Exp\ldots}$.
|
|
|
|
|
|
+$\APPLY{\Exp}{\Exp^*}$.
|
|
|
|
|
|
%% The syntax for function application does not include an explicit
|
|
%% The syntax for function application does not include an explicit
|
|
%% keyword, which is error prone when using \code{match}. To alleviate
|
|
%% keyword, which is error prone when using \code{match}. To alleviate
|
|
@@ -13024,7 +13027,9 @@ nested inside each other.
|
|
\Type &::=& \key{FunctionType}\LP \Type^{*} \key{, } \Type \RP \\
|
|
\Type &::=& \key{FunctionType}\LP \Type^{*} \key{, } \Type \RP \\
|
|
\Exp &::=& \CALL{\Exp}{\Exp^{*}}\\
|
|
\Exp &::=& \CALL{\Exp}{\Exp^{*}}\\
|
|
\Stmt &::=& \RETURN{\Exp} \\
|
|
\Stmt &::=& \RETURN{\Exp} \\
|
|
- \Params &::=& \LS\LP\Var\key{,}\Type\RP\code{,}\ldots\RS \\
|
|
|
|
|
|
+ \Params &::=& \LP\Var\key{,}\Type\RP^*
|
|
|
|
+ % was: \LS\LP\Var\key{,}\Type\RP\code{,}\ldots\RS
|
|
|
|
+ \\
|
|
\Def &::=& \FUNDEF{\Var}{\Params}{\Type}{}{\Stmt^{+}}
|
|
\Def &::=& \FUNDEF{\Var}{\Params}{\Type}{}{\Stmt^{+}}
|
|
\end{array}
|
|
\end{array}
|
|
}
|
|
}
|
|
@@ -13705,7 +13710,7 @@ Module(|$\Def\ldots\Stmt\ldots$|)
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
where $\itm{mainDef}$ is
|
|
where $\itm{mainDef}$ is
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
-FunctionDef('main', [], int, None, |$\Stmt'\ldots$|Return(Constant(0)), None)
|
|
|
|
|
|
+FunctionDef('main', [], int, None, |$\Stmt\ldots$|Return(Constant(0)), None)
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
\fi}
|
|
\fi}
|
|
|
|
|
|
@@ -13808,7 +13813,7 @@ the $k$th element of the tuple, where $k = i - 6$.
|
|
\fi}
|
|
\fi}
|
|
{\if\edition\pythonEd
|
|
{\if\edition\pythonEd
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
- Name(|$x_i$|) |$\Rightarrow$| Subscript(tup, Constant(|$k$|))
|
|
|
|
|
|
+ Name(|$x_i$|) |$\Rightarrow$| Subscript(tup, Constant(|$k$|), Load())
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
\fi}
|
|
\fi}
|
|
|
|
|
|
@@ -14058,7 +14063,7 @@ language, whose syntax is defined in Figure~\ref{fig:x86-3}.
|
|
&\MID& \gray{ \GLOBAL{\Var} } \MID \FUNREF{\itm{label}} \\
|
|
&\MID& \gray{ \GLOBAL{\Var} } \MID \FUNREF{\itm{label}} \\
|
|
\Instr &::=& \ldots \MID \INDCALLQ{\Arg}{\itm{int}}
|
|
\Instr &::=& \ldots \MID \INDCALLQ{\Arg}{\itm{int}}
|
|
\MID \TAILJMP{\Arg}{\itm{int}}\\
|
|
\MID \TAILJMP{\Arg}{\itm{int}}\\
|
|
- &\MID& \BININSTR{\code{leaq}}{\Arg}{\REG{\Reg}}\\
|
|
|
|
|
|
+ &\MID& \BININSTR{\scode{leaq}}{\Arg}{\REG{\Reg}}\\
|
|
\Def &::= & \DEF{\itm{label}}{\LS\RS}{\LC\itm{label}\key{:}\,\Instr^{*}\code{,}\ldots\RC}{\_}{\Type}{\_} \\
|
|
\Def &::= & \DEF{\itm{label}}{\LS\RS}{\LC\itm{label}\key{:}\,\Instr^{*}\code{,}\ldots\RC}{\_}{\Type}{\_} \\
|
|
\LangXIndCallM{} &::= & \XPROGRAMDEFS{\LS\Def\code{,}\ldots\RS}
|
|
\LangXIndCallM{} &::= & \XPROGRAMDEFS{\LS\Def\code{,}\ldots\RS}
|
|
\end{array}
|
|
\end{array}
|
|
@@ -14078,17 +14083,31 @@ is the translation of $\itm{lhs}$ from \Atm{} in \LangCFun{}
|
|
to \Arg{} in \LangXIndCallVar{}. \\
|
|
to \Arg{} in \LangXIndCallVar{}. \\
|
|
\begin{tabular}{lcl}
|
|
\begin{tabular}{lcl}
|
|
\begin{minipage}{0.35\textwidth}
|
|
\begin{minipage}{0.35\textwidth}
|
|
|
|
+{\if\edition\racketEd
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
|$\itm{lhs}$| = (fun-ref |$f$|);
|
|
|$\itm{lhs}$| = (fun-ref |$f$|);
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
|
|
+\fi}
|
|
|
|
+{\if\edition\pythonEd
|
|
|
|
+\begin{lstlisting}
|
|
|
|
+ |$\itm{lhs}$| = FunRef(|$f$|);
|
|
|
|
+\end{lstlisting}
|
|
|
|
+\fi}
|
|
\end{minipage}
|
|
\end{minipage}
|
|
&
|
|
&
|
|
$\Rightarrow$\qquad\qquad
|
|
$\Rightarrow$\qquad\qquad
|
|
&
|
|
&
|
|
\begin{minipage}{0.3\textwidth}
|
|
\begin{minipage}{0.3\textwidth}
|
|
|
|
+{\if\edition\racketEd
|
|
\begin{lstlisting}
|
|
\begin{lstlisting}
|
|
leaq (fun-ref |$f$|), |$\itm{lhs}'$|
|
|
leaq (fun-ref |$f$|), |$\itm{lhs}'$|
|
|
\end{lstlisting}
|
|
\end{lstlisting}
|
|
|
|
+\fi}
|
|
|
|
+{\if\edition\pythonEd
|
|
|
|
+\begin{lstlisting}
|
|
|
|
+leaq (FunRef(|$f$|)), |$\itm{lhs}'$|
|
|
|
|
+\end{lstlisting}
|
|
|
|
+\fi}
|
|
\end{minipage}
|
|
\end{minipage}
|
|
\end{tabular} \\
|
|
\end{tabular} \\
|
|
|
|
|