소스 검색

python ast

Peter Thiemann 3 년 전
부모
커밋
68b1ffdd0b
1개의 변경된 파일6개의 추가작업 그리고 6개의 파일을 삭제
  1. 6 6
      book.tex

+ 6 - 6
book.tex

@@ -16384,7 +16384,7 @@ True[0]
   \MID \WHILESTMT{\Exp}{\Stmt^{+}}\\
   &\MID& \RETURN{\Exp} \\
 \Params &::=& \LP\Var\key{,}\code{AnyType()}\RP^*   \\
-\Def &::=& \FUNDEF{\Var}{\Params}{\_}{}{\Stmt^{+}}  \\
+\Def &::=& \FUNDEF{\Var}{\Params}{\code{AnyType()}}{}{\Stmt^{+}}  \\
 \LangDynM{} &::=& \PROGRAM{}{\LS \Def \ldots \Stmt \ldots \RS}
 \end{array}
 \]
@@ -16771,7 +16771,7 @@ the rightmost 3 bits with the tag and we can simply zero-out the tag
 to recover the original address.
 
 To make tagged values into first-class entities, we can give them a
-type, called \racket{\code{Any}}\python{AnyType}, and define operations
+type, called \racket{\code{Any}}\python{\code{AnyType()}}, and define operations
 such as \code{Inject} and \code{Project} for creating and using them,
 yielding the \LangAny{} intermediate language. We describe how to
 compile \LangDyn{} to \LangAny{} in Section~\ref{sec:compile-r7}
@@ -16796,15 +16796,15 @@ but first we describe the \LangAny{} language in greater detail.
 
 \newcommand{\LanyASTPython}{
 \begin{array}{lcl}
-\Type &::= & \key{AnyType} \\
+\Type &::= & \key{AnyType()} \\
 \FType &::=& \key{IntType()} \MID \key{BoolType()} \MID \key{VoidType()}
   \MID \key{TupleType}\LS\key{AnyType()}^+\RS \\
   &\MID& \key{FunctionType}\LP \key{AnyType()}^{*}\key{, }\key{AnyType()}\RP \\
 \itm{unaryop} &::= & \code{IsBool()} \MID \code{IsInt()}
      \MID \code{IsTuple()}  \MID \code{IsFunction()} \MID \code{IsNone()}\\
-\Exp & ::= & \INJECT{\Exp}{\Type} \MID \PROJECT{\Exp}{\Type} \\
-     &\MID& \CALL{\VAR{\key{'any\_tuple\_load'}}}{\Exp\key{, }\INT{n}}\\
-     &\MID& \CALL{\VAR{\key{'any\_len}}}{\Exp}
+\Exp & ::= & \INJECT{\Exp}{\FType} \MID \PROJECT{\Exp}{\FType} \\
+     &\MID& \CALL{\VAR{\key{'any\_tuple\_load'}}}{\LS\Exp\key{, }\Exp\RS}\\
+     &\MID& \CALL{\VAR{\key{'any\_len'}}}{\LS\Exp\RS}
 \end{array}
 }