Selaa lähdekoodia

Lfun: type grammar in concrete and abstract syntax

Peter Thiemann 3 vuotta sitten
vanhempi
commit
4b5fa716a1
1 muutettua tiedostoa jossa 5 lisäystä ja 3 poistoa
  1. 5 3
      book.tex

+ 5 - 3
book.tex

@@ -13018,7 +13018,10 @@ nested inside each other.
 
 \newcommand{\LfunGrammarPython}{
   \begin{array}{lcl}
-   \Type &::=& \key{Callable}\LS \LS \Type \key{,} \ldots \RS \key{, } \Type \RS \\
+    \Type &::=& \key{int}
+                \MID \key{bool}
+                \MID \key{tuple}\LS \Type^+ \RS
+                \MID \key{Callable}\LS \LS \Type \key{,} \ldots \RS \key{, } \Type \RS \\
    \Exp &::=& \CAPPLY{\Exp}{\Exp\code{,} \ldots} \\
    \Stmt &::=& \CRETURN{\Exp} \\
    \Def &::=& \CDEF{\Var}{\Var \key{:} \Type\key{,} \ldots}{\Type}{\Stmt^{+}} 
@@ -13026,11 +13029,10 @@ nested inside each other.
 }
 \newcommand{\LfunASTPython}{
   \begin{array}{lcl}
-    \Type &::=& \key{FunctionType}\LP \Type^{*} \key{, } \Type \RP \\
+    \Type &::=& \key{int} \MID \key{bool} \MID \key{tuple}\LS\Type^+\RS \MID \key{FunctionType}\LP \Type^{*} \key{, } \Type \RP \\
     \Exp &::=& \CALL{\Exp}{\Exp^{*}}\\
     \Stmt &::=& \RETURN{\Exp} \\
    \Params &::=&                  \LP\Var\key{,}\Type\RP^*
-   % was: \LS\LP\Var\key{,}\Type\RP\code{,}\ldots\RS 
     \\
    \Def &::=& \FUNDEF{\Var}{\Params}{\Type}{}{\Stmt^{+}} 
   \end{array}