Browse Source

updating diagrams for python version

Jeremy Siek 3 years ago
parent
commit
ecff7c99a3
1 changed files with 131 additions and 5 deletions
  1. 131 5
      book.tex

+ 131 - 5
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}}
@@ -12593,11 +12593,12 @@ conclusion:
 
 \begin{figure}[tbp]
   \begin{tcolorbox}[colback=white]
-    \begin{tikzpicture}[baseline=(current  bounding  box.center)]
+{\if\edition\racketEd    
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
 \node (Lvec) at (0,2)  {\large \LangVec{}};
 \node (Lvec-2) at (3,2)  {\large \LangVec{}};
 \node (Lvec-3) at (6,2)  {\large \LangVec{}};
-\node (Lvec-4) at (9,2)  {\large \LangVec{}};
+\node (Lvec-4) at (9,2)  {\large \LangAlloc{}};
 \node (Lvec-5) at (9,0)  {\large \LangAlloc{}};
 \node (Lvec-6) at (6,0)  {\large \LangAllocANF{}};
 \node (C2-4) at (3,0)  {\large \LangCVec{}};
@@ -12609,8 +12610,6 @@ conclusion:
 \node (x86-4) at (9,-2) {\large \LangXGlobal{}};
 \node (x86-5) at (9,-4) {\large \LangXGlobal{}};
 
-
-%\path[->,bend left=15] (Lvec) edge [above] node {\ttfamily\footnotesize type-check} (Lvec-2);
 \path[->,bend left=15] (Lvec) edge [above] node {\ttfamily\footnotesize shrink} (Lvec-2);
 \path[->,bend left=15] (Lvec-2) edge [above] node {\ttfamily\footnotesize uniquify} (Lvec-3);
 \path[->,bend left=15] (Lvec-3) edge [above] node {\ttfamily\footnotesize expose\_alloc.} (Lvec-4);
@@ -12625,6 +12624,34 @@ conclusion:
 \path[->,bend left=15] (x86-3) edge [above] node {\ttfamily\footnotesize patch\_instr.} (x86-4);
 \path[->,bend left=15] (x86-4) edge [right] node {\ttfamily\footnotesize prelude\_and\_concl.} (x86-5);
 \end{tikzpicture}
+\fi}
+{\if\edition\pythonEd
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.90]
+\node (Lvec) at (0,2)  {\large \LangVec{}};
+\node (Lvec-2) at (3,2)  {\large \LangVec{}};
+\node (Lvec-5) at (6,2)  {\large \LangAlloc{}};
+\node (Lvec-6) at (9,2)  {\large \LangAllocANF{}};
+\node (C2-4) at (3,0)  {\large \LangCVec{}};
+
+\node (x86-2) at (3,-2)  {\large \LangXGlobalVar{}};
+\node (x86-2-1) at (3,-4)  {\large \LangXGlobalVar{}};
+\node (x86-2-2) at (6,-4)  {\large \LangXGlobalVar{}};
+\node (x86-3) at (6,-2)  {\large \LangXGlobalVar{}};
+\node (x86-4) at (9,-2) {\large \LangXGlobal{}};
+\node (x86-5) at (9,-4) {\large \LangXGlobal{}};
+
+\path[->,bend left=15] (Lvec) edge [above] node {\ttfamily\footnotesize shrink} (Lvec-2);
+\path[->,bend left=15] (Lvec-2) edge [above] node {\ttfamily\footnotesize expose\_alloc.} (Lvec-5);
+\path[->,bend left=15] (Lvec-5) edge [above] node {\ttfamily\footnotesize remove\_complex.} (Lvec-6);
+\path[->,bend left=10] (Lvec-6) edge [right] node {\ttfamily\footnotesize explicate\_control} (C2-4);
+\path[->,bend left=15] (C2-4) edge [right] node {\ttfamily\footnotesize select\_instr.} (x86-2);
+\path[->,bend right=15] (x86-2) edge [left] node {\ttfamily\footnotesize uncover\_live} (x86-2-1);
+\path[->,bend right=15] (x86-2-1) edge [below] node {\ttfamily\footnotesize build\_inter.} (x86-2-2);
+\path[->,bend right=15] (x86-2-2) edge [right] node {\ttfamily\footnotesize allocate\_reg.} (x86-3);
+\path[->,bend left=15] (x86-3) edge [above] node {\ttfamily\footnotesize patch\_instr.} (x86-4);
+\path[->,bend left=15] (x86-4) edge [right] node {\ttfamily\footnotesize prelude\_and\_concl.} (x86-5);
+\end{tikzpicture}
+\fi}
   \end{tcolorbox}
 
   \caption{Diagram of the passes for \LangVec{}, a language with tuples.}
@@ -14964,6 +14991,7 @@ previously created test programs.
 
 \begin{figure}[tbp]
   \begin{tcolorbox}[colback=white]
+{\if\edition\racketEd    
     \begin{tikzpicture}[baseline=(current  bounding  box.center)]
 \node (Lfun) at (0,2)  {\large \LangFun{}};
 \node (Lfun-1) at (3,2)  {\large \LangFun{}};
@@ -15011,6 +15039,50 @@ previously created test programs.
      {\ttfamily\footnotesize patch\_instr.} (x86-4);
 \path[->,bend right=15] (x86-4) edge [left] node {\ttfamily\footnotesize prelude.} (x86-5);
 \end{tikzpicture}
+\fi}
+{\if\edition\pythonEd
+    \begin{tikzpicture}[baseline=(current  bounding  box.center)]
+\node (Lfun) at (0,2)  {\large \LangFun{}};
+\node (Lfun-2) at (3,2)  {\large \LangFun{}};
+\node (F1-1) at (6,2)  {\large \LangFunRef{}};
+\node (F1-2) at (9,2)  {\large \LangFunRef{}};
+\node (F1-4) at (3,0)  {\large \LangFunRefAlloc{}};
+\node (F1-5) at (0,0)  {\large \LangFunANF{}};
+\node (C3-2) at (0,-2)  {\large \LangCFun{}};
+
+\node (x86-2) at (0,-4)  {\large \LangXIndCallVar{}};
+\node (x86-3) at (3,-4)  {\large \LangXIndCallVar{}};
+\node (x86-4) at (6,-4) {\large \LangXIndCall{}};
+\node (x86-5) at (6,-6) {\large \LangXIndCallFlat{}};
+
+\node (x86-2-1) at (0,-6)  {\large \LangXIndCallVar{}};
+\node (x86-2-2) at (3,-6)  {\large \LangXIndCallVar{}};
+
+\path[->,bend left=15] (Lfun) edge [above] node
+     {\ttfamily\footnotesize shrink} (Lfun-2);
+\path[->,bend left=15] (Lfun-2) edge [above] node
+     {\ttfamily\footnotesize ~~reveal\_functions} (F1-1);
+\path[->,bend left=15] (F1-1) edge [above] node
+     {\ttfamily\footnotesize limit\_functions} (F1-2);
+\path[->,bend left=15] (F1-2) edge [right] node
+     {\ttfamily\footnotesize expose\_alloc.} (F1-4);
+\path[->,bend right=15] (F1-4) edge [above] node
+     {\ttfamily\footnotesize remove\_complex.} (F1-5);
+\path[->,bend right=15] (F1-5) edge [right] node
+     {\ttfamily\footnotesize explicate\_control} (C3-2);
+\path[->,bend left=15] (C3-2) edge [right] node
+     {\ttfamily\footnotesize select\_instr.} (x86-2);
+\path[->,bend right=15] (x86-2) edge [right] node
+     {\ttfamily\footnotesize uncover\_live} (x86-2-1);
+\path[->,bend right=15] (x86-2-1) edge [below] node 
+     {\ttfamily\footnotesize build\_inter.} (x86-2-2);
+\path[->,bend right=15] (x86-2-2) edge [right] node
+     {\ttfamily\footnotesize allocate\_reg.} (x86-3);
+\path[->,bend left=15] (x86-3) edge [above] node
+     {\ttfamily\footnotesize patch\_instr.} (x86-4);
+\path[->,bend left=15] (x86-4) edge [right] node {\ttfamily\footnotesize prelude.} (x86-5);
+\end{tikzpicture}
+\fi}
   \end{tcolorbox}
 
   \caption{Diagram of the passes for \LangFun{}, a language with functions.}
@@ -16559,6 +16631,7 @@ $58$ from the tag.}
 
 \begin{figure}[p]
   \begin{tcolorbox}[colback=white]
+{\if\edition\racketEd    
 \begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.85]
 \node (Lfun) at (0,2)  {\large \LangLam{}};
 \node (Lfun-2) at (3,2)  {\large \LangLam{}};
@@ -16612,6 +16685,59 @@ $58$ from the tag.}
 \path[->,bend left=15] (x86-4) edge [right] node
      {\ttfamily\footnotesize prelude\_and\_conc.} (x86-5);
 \end{tikzpicture}
+\fi}
+{\if\edition\pythonEd
+\begin{tikzpicture}[baseline=(current  bounding  box.center),scale=0.85]
+\node (Lfun) at (0,2)  {\large \LangLam{}};
+\node (Lfun-2) at (3,2)  {\large \LangLam{}};
+\node (Lfun-3) at (6,2)  {\large \LangLam{}};
+\node (F1-0) at (9,2)  {\large \LangLamFunRef{}};
+\node (F1-1) at (12,2)  {\large \LangLamFunRef{}};
+\node (F1-2) at (9,0)  {\large \LangFunRef{}};
+\node (F1-3) at (6,0)  {\large \LangFunRef{}};
+\node (F1-5) at (3,0)  {\large \LangFunRefAlloc{}};
+\node (F1-6) at (0,0)  {\large \LangFunANF{}};
+\node (C3-2) at (0,-2)  {\large \LangCFun{}};
+
+\node (x86-2) at (0,-4)  {\large \LangXIndCallVar{}};
+\node (x86-2-1) at (0,-6)  {\large \LangXIndCallVar{}};
+\node (x86-2-2) at (3,-6)  {\large \LangXIndCallVar{}};
+\node (x86-3) at (3,-4)  {\large \LangXIndCallVar{}};
+\node (x86-4) at (6,-4) {\large \LangXIndCall{}};
+\node (x86-5) at (6,-6) {\large \LangXIndCall{}};
+
+\path[->,bend left=15] (Lfun) edge [above] node
+     {\ttfamily\footnotesize shrink} (Lfun-2);
+\path[->,bend left=15] (Lfun-2) edge [above] node
+     {\ttfamily\footnotesize uniquify} (Lfun-3);
+\path[->,bend left=15] (Lfun-3) edge [above] node
+     {\ttfamily\footnotesize reveal\_functions} (F1-0);
+\path[->,bend left=15] (F1-0) edge [above] node
+     {\ttfamily\footnotesize convert\_assign.} (F1-1);
+\path[->,bend left=15] (F1-1) edge [left] node
+     {\ttfamily\footnotesize convert\_to\_clos.} (F1-2);
+\path[->,bend left=15] (F1-2) edge [below] node
+     {\ttfamily\footnotesize limit\_fun.} (F1-3);
+\path[->,bend right=15] (F1-3) edge [above] node
+     {\ttfamily\footnotesize expose\_alloc.} (F1-5);
+\path[->,bend right=15] (F1-5) edge [above] node
+     {\ttfamily\footnotesize remove\_complex.} (F1-6);
+\path[->,bend right=15] (F1-6) edge [right] node
+     {\ttfamily\footnotesize explicate\_control} (C3-2);
+\path[->,bend left=15] (C3-2) edge [right] node
+     {\ttfamily\footnotesize select\_instr.} (x86-2);
+\path[->,bend right=15] (x86-2) edge [right] node
+     {\ttfamily\footnotesize uncover\_live} (x86-2-1);
+\path[->,bend right=15] (x86-2-1) edge [below] node 
+     {\ttfamily\footnotesize build\_inter.} (x86-2-2);
+\path[->,bend right=15] (x86-2-2) edge [right] node
+     {\ttfamily\footnotesize allocate\_reg.} (x86-3);
+\path[->,bend left=15] (x86-3) edge [above] node
+     {\ttfamily\footnotesize patch\_instr.} (x86-4);
+\path[->,bend left=15] (x86-4) edge [right] node
+     {\ttfamily\footnotesize prelude\_and\_conclusion} (x86-5);
+\end{tikzpicture}
+\fi}
   \end{tcolorbox}
 
   \caption{Diagram of the passes for \LangLam{}, a language with lexically-scoped