|
@@ -16384,7 +16384,7 @@ True[0]
|
|
\MID \WHILESTMT{\Exp}{\Stmt^{+}}\\
|
|
\MID \WHILESTMT{\Exp}{\Stmt^{+}}\\
|
|
&\MID& \RETURN{\Exp} \\
|
|
&\MID& \RETURN{\Exp} \\
|
|
\Params &::=& \LP\Var\key{,}\code{AnyType()}\RP^* \\
|
|
\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}
|
|
\LangDynM{} &::=& \PROGRAM{}{\LS \Def \ldots \Stmt \ldots \RS}
|
|
\end{array}
|
|
\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 recover the original address.
|
|
|
|
|
|
To make tagged values into first-class entities, we can give them a
|
|
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,
|
|
such as \code{Inject} and \code{Project} for creating and using them,
|
|
yielding the \LangAny{} intermediate language. We describe how to
|
|
yielding the \LangAny{} intermediate language. We describe how to
|
|
compile \LangDyn{} to \LangAny{} in Section~\ref{sec:compile-r7}
|
|
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}{
|
|
\newcommand{\LanyASTPython}{
|
|
\begin{array}{lcl}
|
|
\begin{array}{lcl}
|
|
-\Type &::= & \key{AnyType} \\
|
|
|
|
|
|
+\Type &::= & \key{AnyType()} \\
|
|
\FType &::=& \key{IntType()} \MID \key{BoolType()} \MID \key{VoidType()}
|
|
\FType &::=& \key{IntType()} \MID \key{BoolType()} \MID \key{VoidType()}
|
|
\MID \key{TupleType}\LS\key{AnyType()}^+\RS \\
|
|
\MID \key{TupleType}\LS\key{AnyType()}^+\RS \\
|
|
&\MID& \key{FunctionType}\LP \key{AnyType()}^{*}\key{, }\key{AnyType()}\RP \\
|
|
&\MID& \key{FunctionType}\LP \key{AnyType()}^{*}\key{, }\key{AnyType()}\RP \\
|
|
\itm{unaryop} &::= & \code{IsBool()} \MID \code{IsInt()}
|
|
\itm{unaryop} &::= & \code{IsBool()} \MID \code{IsInt()}
|
|
\MID \code{IsTuple()} \MID \code{IsFunction()} \MID \code{IsNone()}\\
|
|
\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}
|
|
\end{array}
|
|
}
|
|
}
|
|
|
|
|