|
@@ -12641,11 +12641,21 @@ application is shown in Figures~\ref{fig:Rfun-concrete-syntax} and
|
|
|
\LangFun{} begin with zero or more function definitions. The function
|
|
|
names from these definitions are in-scope for the entire program,
|
|
|
including all other function definitions (so the ordering of function
|
|
|
-definitions does not matter). The concrete syntax for function
|
|
|
-application\index{subject}{function application} is $(\Exp \; \Exp \ldots)$
|
|
|
-where the first expression must
|
|
|
-evaluate to a function and the rest are the arguments.
|
|
|
-The abstract syntax for function application is
|
|
|
+definitions does not matter).
|
|
|
+%
|
|
|
+\python{The abstract syntax for function parameters in
|
|
|
+ Figure~\ref{fig:Rfun-syntax} is a list of pairs, where each pair
|
|
|
+ consists of a parameter name and its type. This differs from
|
|
|
+ Python's \code{ast} module, which has a more complex syntax for
|
|
|
+ function parameters, for example, to handle keyword parameters and
|
|
|
+ defaults. The type checker in \code{type\_check\_Lfun} converts the
|
|
|
+ more commplex syntax into the simpler syntax of
|
|
|
+ Figure~\ref{fig:Rfun-syntax}.}
|
|
|
+%
|
|
|
+The concrete syntax for function application\index{subject}{function
|
|
|
+ application} is $(\Exp \; \Exp \ldots)$ where the first expression
|
|
|
+must evaluate to a function and the rest are the arguments. The
|
|
|
+abstract syntax for function application is
|
|
|
$\APPLY{\Exp}{\Exp\ldots}$.
|
|
|
|
|
|
%% The syntax for function application does not include an explicit
|
|
@@ -12693,8 +12703,8 @@ inside each other.
|
|
|
\newcommand{\LfunASTPython}{
|
|
|
\begin{array}{lcl}
|
|
|
\Type &::=& \key{FunctionType}\LP \Type^{*} \key{, } \Type \RP \\
|
|
|
- \itm{arguments}&::=&
|
|
|
- \Def &::=& \FUNDEF{\Var}{\itm{arguments}}{\Type}{}{\Stmt^{+}}
|
|
|
+ \Exp &::& \CALL{\Exp}{\Exp^{*}}\\
|
|
|
+ \Def &::=& \FUNDEF{\Var}{\LS \LP \Var \key{, } \Type \RP \key{, } \ldots \RS}{\Type}{}{\Stmt^{+}}
|
|
|
\end{array}
|
|
|
}
|
|
|
|
|
@@ -12769,7 +12779,7 @@ inside each other.
|
|
|
\gray{\LtupASTPython} \\ \hline
|
|
|
\LfunASTPython \\
|
|
|
\begin{array}{rcl}
|
|
|
- \LangFunM{} &::=& ??
|
|
|
+ \LangFunM{} &::=& \PROGRAM{}{\LS \Def \ldots \Stmt \ldots \RS}
|
|
|
\end{array}
|
|
|
\end{array}
|
|
|
\]
|