浏览代码

change let case of inert to use residual for rhs and body

Jeremy Siek 4 年之前
父节点
当前提交
c36955a472
共有 1 个文件被更改,包括 8 次插入4 次删除
  1. 8 4
      book.tex

+ 8 - 4
book.tex

@@ -2703,17 +2703,21 @@ arithmetic. For example, your partial evaluator should translate
 To accomplish this, the \code{pe-exp} function should produce output
 in the form of the $\itm{residual}$ non-terminal of the following
 grammar. The idea is that when processing an addition expression, we
-can always produce either 1) an integer constant, 2) and addition
+can always produce either 1) an integer constant, 2) an addition
 expression with an integer constant on the left-hand side but not the
 right-hand side, or 3) or an addition expression in which neither
 subexpression is a constant.
 \[
 \begin{array}{lcl}
-\itm{inert} &::=& \Var \mid \LP\key{read}\RP \mid \LP\key{-} \;\Var\RP
+  \itm{inert} &::=& \Var
+    \mid \LP\key{read}\RP
+    \mid \LP\key{-} \;\Var\RP
     \mid \LP\key{-} \;\LP\key{read}\RP\RP
     \mid \LP\key{+} \; \itm{inert} \; \itm{inert}\RP\\
-  &\mid& \LP\key{let}~\LP\LS\Var~\itm{inert}\RS\RP~ \itm{residual} \RP \\
-\itm{residual} &::=& \Int \mid \LP\key{+}\; \Int\; \itm{inert}\RP \mid \itm{inert} 
+    &\mid& \LP\key{let}~\LP\LS\Var~\itm{residual}\RS\RP~ \itm{residual} \RP \\  
+  \itm{residual} &::=& \Int
+    \mid \LP\key{+}\; \Int\; \itm{inert}\RP
+    \mid \itm{inert} 
 \end{array}
 \]
 The \code{pe-add} and \code{pe-neg} functions may assume that their