浏览代码

added languages to index

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

+ 56 - 13
book.tex

@@ -26,7 +26,7 @@
 
 \def\racketEd{0}
 \def\pythonEd{1}
-\def\edition{0}
+\def\edition{1}
 
 % material that is specific to the Racket edition of the book
 \newcommand{\racket}[1]{{\if\edition\racketEd{#1}\fi}}
@@ -1064,6 +1064,7 @@ figure~\ref{fig:r0-concrete-syntax} and the abstract syntax for
 \end{tcolorbox}
 \caption{The concrete syntax of \LangInt{}.}
 \label{fig:r0-concrete-syntax}
+\index{subject}{Lint@\LangInt{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -1106,6 +1107,7 @@ figure~\ref{fig:r0-concrete-syntax} and the abstract syntax for
 }
 \caption{The abstract syntax of \LangInt{}.}
 \label{fig:r0-syntax}
+\index{subject}{Lint@\LangInt{} abstract syntax}
 \end{figure}
 
 
@@ -1908,6 +1910,7 @@ exhibit several compilation techniques.
 \end{tcolorbox}
 \caption{The concrete syntax of \LangVar{}.}
 \label{fig:Lvar-concrete-syntax}
+\index{subject}{Lvar@\LangVar{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -1938,6 +1941,7 @@ exhibit several compilation techniques.
 \end{tcolorbox}
 \caption{The abstract syntax of \LangVar{}.}
 \label{fig:Lvar-syntax}
+\index{subject}{Lvar@\LangVar{} abstract syntax}
 \end{figure}
 
 {\if\edition\racketEd
@@ -2530,6 +2534,7 @@ each of which is an integer constant (called an \emph{immediate
 \end{tcolorbox}
 \caption{The syntax of the \LangXInt{} assembly language (AT\&T syntax).}
 \label{fig:x86-int-concrete}
+\index{subject}{x86int@\LangXInt{} concrete syntax}
 \end{figure}
 
 A register is a special kind of variable that holds a 64-bit
@@ -2856,6 +2861,7 @@ register allocation (chapter~\ref{ch:register-allocation-Lvar}).
 \end{tcolorbox}
 \caption{The abstract syntax of \LangXInt{} assembly.}
 \label{fig:x86-int-ast}
+\index{subject}{x86int@\LangXInt{} abstract syntax}
 \end{figure}
 
 \section{Planning the Trip to x86}
@@ -3152,6 +3158,7 @@ uninitialized; they become initialized on their first assignment.
 \end{tcolorbox}
 \caption{The concrete syntax of the \LangCVar{} intermediate language.}
 \label{fig:c0-concrete-syntax}
+\index{subject}{Cvar@\LangCVar{} concrete syntax}
 \end{figure}
 
 
@@ -3168,6 +3175,7 @@ uninitialized; they become initialized on their first assignment.
 \end{tcolorbox}
 \caption{The abstract syntax of the \LangCVar{} intermediate language.}
 \label{fig:c0-syntax}
+\index{subject}{Cvar@\LangCVar{} abstract syntax}
 \end{figure}
 
 The definitional interpreter for \LangCVar{} is in the support code,
@@ -3389,6 +3397,7 @@ print(tmp_1)
 \caption{\LangVarANF{} is \LangVar{} with operands restricted to
   atomic expressions.}
 \label{fig:Lvar-anf-syntax}
+\index{subject}{Lvarmon@\LangVarANF{} abstract syntax}
 \end{figure}
 
 Figure~\ref{fig:Lvar-anf-syntax} presents the grammar for the output
@@ -3727,16 +3736,15 @@ list of \code{passes} and then run the script to test your compiler.
 
 In the \code{select\_instructions} pass we begin the work of
 translating \racket{from \LangCVar{}} to \LangXVar{}. The target
-language of this pass is a variant of x86 that still uses variables,
-so we add an AST node of the form $\XVAR{\itm{var}}$ to the \Arg{}
-nonterminal of the \LangXInt{} abstract syntax
-(figure~\ref{fig:x86-int-ast}).
-\racket{We recommend implementing the
-\code{select\_instructions} with three auxiliary functions, one for
-each of the nonterminals of \LangCVar{}: $\Atm$, $\Stmt$, and
-$\Tail$.}
-\python{We recommend implementing an auxiliary function
-  named \code{select\_stmt} for the $\Stmt$ nonterminal.}
+language of this pass, \LangXVar{}, is a variant of x86 that still
+uses variables, so we add an AST node of the form $\XVAR{\itm{var}}$
+to the \Arg{} nonterminal of the \LangXInt{} abstract syntax
+(figure~\ref{fig:x86-int-ast})\index{subject}{x86var@\LangXVar{}}.
+\racket{We recommend implementing the \code{select\_instructions} with
+  three auxiliary functions, one for each of the nonterminals of
+  \LangCVar{}: $\Atm$, $\Stmt$, and $\Tail$.}  \python{We recommend
+  implementing an auxiliary function named \code{select\_stmt} for the
+  $\Stmt$ nonterminal.}
 
 \racket{The cases for $\Atm$ are straightforward; variables stay the
   same and integer constants change to immediates; that is, $\INT{n}$
@@ -7827,6 +7835,7 @@ operators to include
 \caption{The concrete syntax of \LangIf{}, extending \LangVar{}
   (figure~\ref{fig:Lvar-concrete-syntax}) with Booleans and conditionals.}
 \label{fig:Lif-concrete-syntax}
+\index{subject}{Lif@\LangIf{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -7870,6 +7879,7 @@ operators to include
 }
 \caption{The abstract syntax of \LangIf{}.}
 \label{fig:Lif-syntax}
+\index{subject}{Lif@\LangIf{} abstract syntax}
 \end{figure}
 
 Figure~\ref{fig:interp-Lif} shows the definition of the interpreter
@@ -8551,6 +8561,7 @@ abstract syntax.
 \caption{The concrete syntax of the \LangCIf{} intermediate language%
   \racket{, an extension of \LangCVar{} (figure~\ref{fig:c0-concrete-syntax})}.}
 \label{fig:c1-concrete-syntax}
+\index{subject}{Cif@\LangCIf{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -8586,6 +8597,7 @@ abstract syntax.
 \caption{The abstract syntax of \LangCIf{}\racket{, an extension of \LangCVar{}
   (figure~\ref{fig:c0-syntax})}.}
 \label{fig:c1-syntax}
+\index{subject}{Cif@\LangCIf{} abstract syntax}
 \end{figure}
 
 \section{The \LangXIf{} Language}
@@ -8668,6 +8680,7 @@ $\Atm$ to x86:
 \end{tcolorbox}
 \caption{The concrete syntax of \LangXIf{}  (extends \LangXInt{} of figure~\ref{fig:x86-int-concrete}).}
 \label{fig:x86-1-concrete}
+\index{subject}{x86if@\LangXIf{} concrete syntax}
 \end{figure}
 
 \newcommand{\ASTXIfRacket}{
@@ -8729,6 +8742,7 @@ $\Atm$ to x86:
 \end{tcolorbox}
 \caption{The abstract syntax of \LangXIf{} (extends \LangXInt{} shown in figure~\ref{fig:x86-int-ast}).}
 \label{fig:x86-1}
+\index{subject}{x86if@\LangXIf{} abstract syntax}
 \end{figure}
 
 Next we consider the x86 instructions that are relevant for compiling
@@ -8925,6 +8939,7 @@ upcoming \code{explicate\_control} pass.
 \caption{\LangIfANF{} is \LangIf{} in monadic normal form
   (extends \LangVarANF in figure~\ref{fig:Lvar-anf-syntax}).}
 \label{fig:Lif-anf-syntax}
+\index{subject}{Lifmon@\LangIfANF{} abstract syntax}
 \end{figure}
 
 
@@ -11002,6 +11017,7 @@ condition remains true.
 
 \caption{The concrete syntax of \LangLoop{}, extending \LangIf{} (figure~\ref{fig:Lif-concrete-syntax}).}
 \label{fig:Lwhile-concrete-syntax}
+\index{subject}{Lwhile@\LangLoop{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -11040,6 +11056,7 @@ condition remains true.
   }
 \caption{The abstract syntax of \LangLoop{}, extending \LangIf{} (figure~\ref{fig:Lif-syntax}).}
 \label{fig:Lwhile-syntax}
+\index{subject}{Lwhile@\LangLoop{} abstract syntax}
 \end{figure}
 
 Figure~\ref{fig:Lwhile-concrete-syntax} shows the definition of the
@@ -11762,6 +11779,7 @@ Figure~\ref{fig:Lwhile-anf-syntax} defines the output language
 
 \caption{\LangLoopANF{} is \LangLoop{} in monadic normal form.}
 \label{fig:Lwhile-anf-syntax}
+\index{subject}{Lwhilemon@\LangLoopANF{} abstract syntax}
 \end{figure}
 
 {\if\edition\racketEd    
@@ -11864,6 +11882,7 @@ cycles.
 
 \caption{The abstract syntax of \LangCLoop{}, extending \LangCIf{} (figure~\ref{fig:c1-syntax}).}
 \label{fig:c7-syntax}
+\index{subject}{Cwhile@\LangCLoop{} abstract syntax}
 \end{figure}
 
 The new auxiliary function \code{explicate\_effect} takes an
@@ -12208,6 +12227,7 @@ print(t[0] + t[2][0] if t[1] else 44)
 \caption{The concrete syntax of \LangVec{}, extending \LangLoop{}
   (figure~\ref{fig:Lwhile-concrete-syntax}).}
 \label{fig:Lvec-concrete-syntax}
+\index{subject}{Ltup@\LangVec{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -12246,6 +12266,7 @@ print(t[0] + t[2][0] if t[1] else 44)
 
 \caption{The abstract syntax of \LangVec{}.}
 \label{fig:Lvec-syntax}
+\index{subject}{Ltup@\LangVec{} abstract syntax}
 \end{figure}
 
 Tuples raise several interesting new issues.  First, variable binding
@@ -12923,7 +12944,7 @@ expressions to temporary variables (see below).
 
 The output of \code{expose\_allocation} is a language \LangAlloc{}
 that replaces tuple creation with new lower-level forms that we use in the
-translation of tuple creation.
+translation of tuple creation\index{subject}{Lalloc@\LangAlloc{}}.
 %
 {\if\edition\racketEd
 \[
@@ -13164,6 +13185,7 @@ pass, which is \LangAlloc{} in monadic normal form.
 
 \caption{\LangAllocANF{} is \LangAlloc{} in monadic normal form.}
 \label{fig:Lvec-anf-syntax}
+\index{subject}{Ltupmon@\LangAllocANF{} abstract syntax}
 \end{figure}
 
 
@@ -13226,6 +13248,7 @@ pass, which is \LangAlloc{} in monadic normal form.
   \racket{\LangCLoop{} (figure~\ref{fig:c7-syntax})}\python{\LangCIf{}
   (figure~\ref{fig:c1-syntax})}.}
 \label{fig:c2-syntax}
+\index{subject}{Cvec@\LangCVec{} abstract syntax}
 \end{figure}
 
 The output of \code{explicate\_control} is a program in the
@@ -14017,6 +14040,7 @@ example of a structure definition, in this case the definition of a
 \caption{The concrete syntax of \LangStruct{}, extending \LangVec{}
   (figure~\ref{fig:Lvec-concrete-syntax}).}
 \label{fig:Lstruct-concrete-syntax}
+\index{subject}{Lstruct@\LangStruct{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tbp]
@@ -14041,6 +14065,7 @@ example of a structure definition, in this case the definition of a
 \caption{The abstract syntax of \LangStruct{}, extending \LangVec{}
   (figure~\ref{fig:Lvec-syntax}).}
 \label{fig:Lstruct-syntax}
+\index{subject}{Lstruct@\LangStruct{} abstract syntax}
 \end{figure}
 
 An instance of a structure is created using function-call syntax, with
@@ -14198,6 +14223,7 @@ inner product of two arrays (figure~\ref{fig:inner_product}).
 \end{tcolorbox}
 \caption{The concrete syntax of \LangArray{}, extending \LangVec{} (figure~\ref{fig:Lvec-concrete-syntax}).}
 \label{fig:Lvecof-concrete-syntax}
+\index{subject}{Larray@\LangArray{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -14237,6 +14263,7 @@ inner product of two arrays (figure~\ref{fig:inner_product}).
 \end{tcolorbox}
 \caption{The abstract syntax of \LangArray{}, extending \LangVec{} (figure~\ref{fig:Lvec-syntax}).}
 \label{fig:Lvecof-syntax}
+\index{subject}{Larray@\LangArray{} abstract syntax}
 \end{figure}
 
 
@@ -14975,6 +15002,7 @@ being nested inside each other.
 
 \caption{The concrete syntax of \LangFun{}, extending \LangVec{} (figure~\ref{fig:Lvec-concrete-syntax}).}
 \label{fig:Lfun-concrete-syntax}
+\index{subject}{Lfun@\LangFun{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -15015,6 +15043,7 @@ being nested inside each other.
 
 \caption{The abstract syntax of \LangFun{}, extending \LangVec{} (figure~\ref{fig:Lvec-syntax}).}
 \label{fig:Lfun-syntax}
+\index{subject}{Lfun@\LangFun{} abstract syntax}
 \end{figure}
 
 
@@ -15645,7 +15674,7 @@ changes function references from $\VAR{f}$ to $\FUNREF{f}{n}$ where
 $n$ is the arity of the function.\python{\footnote{The arity is not
     needed in this chapter but is used in chapter~\ref{ch:Ldyn}.}}
 This pass is named \code{reveal\_functions} and the output language
-is \LangFunRef{}.
+is \LangFunRef{}\index{subject}{Lfunref@\LangFunRef{}}.
 
 %is defined in figure~\ref{fig:f1-syntax}.
 %% The concrete syntax for a
@@ -15858,6 +15887,7 @@ and augments programs to include a list of function definitions.
 
 \caption{\LangFunANF{} is \LangFunRef{} in monadic normal form.}
 \label{fig:Lfun-anf-syntax}
+\index{subject}{Lfunmon@\LangFunANF{} abstract syntax}
 \end{figure}
 
 
@@ -15983,6 +16013,7 @@ appropriate explicate functions for the various contexts.
 
 \caption{The abstract syntax of \LangCFun{}, extending \LangCVec{} (figure~\ref{fig:c2-syntax}).}
 \label{fig:c3-syntax}
+\index{subject}{Cfun@\LangCFun{} abstract syntax}
 \end{figure}
 
 \clearpage
@@ -16930,6 +16961,7 @@ for \LangFun{}, which already has syntax for function application.
 \caption{The concrete syntax of \LangLam{}, extending \LangFun{} (figure~\ref{fig:Lfun-concrete-syntax}) 
   with \key{lambda}.}
 \label{fig:Llam-concrete-syntax}
+\index{subject}{Llambda@\LangLam{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -16972,6 +17004,7 @@ for \LangFun{}, which already has syntax for function application.
 
 \caption{The abstract syntax of \LangLam{}, extending \LangFun{} (figure~\ref{fig:Lfun-syntax}).}
 \label{fig:Llam-syntax}
+\index{subject}{Llambda@\LangLam{} abstract syntax}
 \end{figure}
 
 Figure~\ref{fig:interp-Llambda} shows the definitional
@@ -17978,6 +18011,7 @@ figure~\ref{fig:Clam-syntax}.
 
 \caption{The abstract syntax of \LangCLam{}, extending \LangCFun{} (figure~\ref{fig:c3-syntax}).}
 \label{fig:Clam-syntax}
+\index{subject}{Clambda@\LangCLam{} abstract syntax}
 \end{figure}
 
 
@@ -18488,6 +18522,7 @@ be a tuple, not a Boolean.
   \end{tcolorbox}
 \caption{Syntax of \LangDyn{}, an untyped language (a subset of \racket{Racket}\python{Python}).}
 \label{fig:r7-concrete-syntax}
+\index{subject}{Ldyn@\LangDyn{} concrete syntax}
 \end{figure}
 
 
@@ -18544,6 +18579,7 @@ be a tuple, not a Boolean.
 
 \caption{The abstract syntax of \LangDyn{}.}
 \label{fig:r7-syntax}
+\index{subject}{Ldyn@\LangDyn{} abstract syntax}
 \end{figure}
 
 
@@ -19010,6 +19046,7 @@ section~\ref{sec:compile-r7}; in the next section we describe the
 
 \caption{The abstract syntax of \LangAny{}, extending \LangLam{} (figure~\ref{fig:Llam-syntax}).}
 \label{fig:Lany-syntax}
+\index{subject}{Lany@\LangAny{} abstract syntax}
 \end{figure}
 
 The definition of the abstract syntax of \LangAny{} is given in
@@ -19866,6 +19903,7 @@ whose syntax definition is shown in figure~\ref{fig:c5-syntax}.
 
 \caption{The abstract syntax of \LangCAny{}, extending \LangCLam{} (figure~\ref{fig:Clam-syntax}).}
 \label{fig:c5-syntax}
+\index{subject}{Cany@\LangCAny{} abstract syntax}
 \end{figure}
 
 
@@ -20415,6 +20453,7 @@ next two sections.
 
 \caption{The concrete syntax of \LangGrad{}, extending \LangVec{} (figure~\ref{fig:Lvec-concrete-syntax}).}
 \label{fig:Lgrad-concrete-syntax}
+\index{subject}{L?@\LangGrad{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tbp]
@@ -20455,6 +20494,7 @@ next two sections.
 
 \caption{The abstract syntax of \LangGrad{}, extending \LangVec{} (figure~\ref{fig:Lvec-syntax}).}
 \label{fig:Lgrad-syntax}
+\index{subject}{L?@\LangGrad{} abstract syntax}
 \end{figure}
 
 
@@ -22565,6 +22605,7 @@ The grammar for types is extended to include the type of a generic
 \caption{The concrete syntax of \LangPoly{}, extending \LangLam{}
     (figure~\ref{fig:Llam-concrete-syntax}).}
 \label{fig:Lpoly-concrete-syntax}
+\index{subject}{Lgen@\LangPoly{} concrete syntax}
 \end{figure}
 
 \begin{figure}[tp]
@@ -22610,6 +22651,7 @@ The grammar for types is extended to include the type of a generic
 \caption{The abstract syntax of \LangPoly{}, extending \LangLam{}
     (figure~\ref{fig:Llam-syntax}).}
 \label{fig:Lpoly-syntax}
+\index{subject}{Lgen@\LangPoly{} abstract syntax}
 \end{figure}
 
 By including the \code{All} type in the $\Type$ nonterminal of the
@@ -23163,6 +23205,7 @@ compiler.
 \caption{The abstract syntax of \LangInst{}, extending \LangLam{}
     (figure~\ref{fig:Llam-syntax}).}
 \label{fig:Lpoly-prime-syntax}
+\index{subject}{Linst@\LangInst{} abstract syntax}
 \end{figure}
 
 The output of the \code{resolve} pass on the generic \code{map}