|
@@ -10409,9 +10409,9 @@ Figure~\ref{fig:Rwhile-anf-syntax} defines the output language
|
|
\begin{array}{rcl}
|
|
\begin{array}{rcl}
|
|
\Atm &::=& \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}}\\
|
|
\Atm &::=& \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}}\\
|
|
\Exp &::=& \Atm \MID \READ{} \\
|
|
\Exp &::=& \Atm \MID \READ{} \\
|
|
- &\MID& \BINOP{\itm{binaryop}}{\Atm}{\Atm} \MID \UNIOP{\key{unaryop}}{\Atm} \\
|
|
|
|
|
|
+ &\MID& \BINOP{\Atm}{\itm{binaryop}}{\Atm} \MID \UNIOP{\itm{unaryop}}{\Atm} \\
|
|
&\MID& \CMP{\Atm}{\itm{cmp}}{\Atm} \MID \IF{\Exp}{\Exp}{\Exp} \\
|
|
&\MID& \CMP{\Atm}{\itm{cmp}}{\Atm} \MID \IF{\Exp}{\Exp}{\Exp} \\
|
|
-% &\MID& \LET{\Var}{\Exp}{\Exp}\\
|
|
|
|
|
|
+% &\MID& \LET{\Var}{\Exp}{\Exp}\\ % Why?
|
|
\Stmt{} &::=& \PRINT{\Atm} \MID \EXPR{\Exp} \\
|
|
\Stmt{} &::=& \PRINT{\Atm} \MID \EXPR{\Exp} \\
|
|
&\MID& \ASSIGN{\VAR{\Var}}{\Exp} \MID \IFSTMT{\Exp}{\Stmt^{+}}{\Stmt^{+}}\\
|
|
&\MID& \ASSIGN{\VAR{\Var}}{\Exp} \MID \IFSTMT{\Exp}{\Stmt^{+}}{\Stmt^{+}}\\
|
|
&\MID& \WHILESTMT{\Exp}{\Stmt^{+}} \\
|
|
&\MID& \WHILESTMT{\Exp}{\Stmt^{+}} \\
|
|
@@ -11732,17 +11732,18 @@ pass, which is \LangAlloc{} in monadic normal form.
|
|
\itm{bool} &::=& \code{True} \MID \code{False} \\
|
|
\itm{bool} &::=& \code{True} \MID \code{False} \\
|
|
\Atm &::=& \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}} \\
|
|
\Atm &::=& \INT{\Int} \MID \VAR{\Var} \MID \BOOL{\itm{bool}} \\
|
|
\Exp &::=& \Atm \MID \READ{} \MID \\
|
|
\Exp &::=& \Atm \MID \READ{} \MID \\
|
|
- &\MID& \BINOP{\Exp}{\itm{binaryop}}{\Exp}
|
|
|
|
- \MID \UNIOP{\itm{unaryop}}{\Exp}\\
|
|
|
|
- &\MID& \CMP{\Exp}{\itm{cmp}}{\Exp}
|
|
|
|
- \MID \BOOLOP{\itm{boolop}}{\Exp}{\Exp}\\
|
|
|
|
|
|
+ &\MID& \BINOP{\Atm}{\itm{binaryop}}{\Atm}
|
|
|
|
+ \MID \UNIOP{\itm{unaryop}}{\Atm}\\
|
|
|
|
+ &\MID& \CMP{\Atm}{\itm{cmp}}{\Atm} \\
|
|
|
|
+% \MID \BOOLOP{\itm{boolop}}{\Exp}{\Exp} \\ % removed by RCO
|
|
&\MID& \IF{\Exp}{\Exp}{\Exp} \\
|
|
&\MID& \IF{\Exp}{\Exp}{\Exp} \\
|
|
&\MID& \GET{\Atm}{\Atm} \\
|
|
&\MID& \GET{\Atm}{\Atm} \\
|
|
&\MID& \LEN{\Exp}\\
|
|
&\MID& \LEN{\Exp}\\
|
|
&\MID& \ALLOCATE{\Int}{\Type}
|
|
&\MID& \ALLOCATE{\Int}{\Type}
|
|
\MID \GLOBALVALUE{\Var}\RP\\
|
|
\MID \GLOBALVALUE{\Var}\RP\\
|
|
- &\MID& \BEGIN{\Stmt^{*}}{\Exp} \\
|
|
|
|
-\Stmt{} &::=& \PRINT{\Exp} \MID \EXPR{\Exp} \\
|
|
|
|
|
|
+ &\MID& \BEGIN{\Stmt^{*}}{\Atm} \\ % can use this in place of \LET;
|
|
|
|
+ % why have \LET?
|
|
|
|
+\Stmt{} &::=& \PRINT{\Atm} \MID \EXPR{\Exp} \\
|
|
&\MID& \ASSIGN{\VAR{\Var}}{\Exp} \\
|
|
&\MID& \ASSIGN{\VAR{\Var}}{\Exp} \\
|
|
&\MID& \ASSIGN{\PUT{\Atm}{\Atm}}{\Exp} \\
|
|
&\MID& \ASSIGN{\PUT{\Atm}{\Atm}}{\Exp} \\
|
|
&\MID& \IFSTMT{\Exp}{\Stmt^{+}}{\Stmt^{+}}\\
|
|
&\MID& \IFSTMT{\Exp}{\Stmt^{+}}{\Stmt^{+}}\\
|
|
@@ -11814,8 +11815,9 @@ pass, which is \LangAlloc{} in monadic normal form.
|
|
\fi}
|
|
\fi}
|
|
\end{minipage}
|
|
\end{minipage}
|
|
}
|
|
}
|
|
-\caption{The abstract syntax of \LangCVec{}, extending \LangCLoop{}
|
|
|
|
- (Figure~\ref{fig:c7-syntax}).}
|
|
|
|
|
|
+\caption{The abstract syntax of \LangCVec{}, extending
|
|
|
|
+ \racket{\LangCLoop{} (Figure~\ref{fig:c7-syntax})}\python{\LangCIf{}
|
|
|
|
+ (Figure~\ref{fig:c1-syntax})}.}
|
|
\label{fig:c2-syntax}
|
|
\label{fig:c2-syntax}
|
|
\end{figure}
|
|
\end{figure}
|
|
|
|
|