Browse Source

ch 4 edits

Jeremy Siek 3 years ago
parent
commit
415446f650
3 changed files with 335 additions and 315 deletions
  1. 8 2
      book.bib
  2. 263 252
      book.tex
  3. 64 61
      defs.tex

+ 8 - 2
book.bib

@@ -1,6 +1,12 @@
 
-
-
+@article{PeytonJones:1998,
+	author = {Simon L. {Peyton Jones} and Andr{\'e}L.M. Santos},
+	journal = {Science of Computer Programming},
+	number = {1},
+	pages = {3-47},
+	title = {A transformation-based optimiser for Haskell},
+	volume = {32},
+	year = {1998}}
 
 @Misc{Lehtosalo2021:MyPy,
   author = 	 {Jukka Lehtosalo},

File diff suppressed because it is too large
+ 263 - 252
book.tex


+ 64 - 61
defs.tex

@@ -3,70 +3,73 @@
 \newcommand{\itm}[1]{\ensuremath{\mathit{#1}}}
 \newcommand{\ttm}[1]{\ensuremath{\text{\texttt{#1}}}}
 
-\newcommand{\LangInt}{\ensuremath{L_{\mathsf{Int}}}} % R0
+\newcommand{\Lang}{\mathcal{L}}
+\newcommand{\CLang}{\mathcal{C}}
 
-\newcommand{\LangVar}{$L_{\mathsf{Var}}$} % R1
-\newcommand{\LangVarM}{L_{\mathsf{Var}}}
+\newcommand{\LangInt}{\ensuremath{\Lang_{\mathsf{Int}}}} % R0
 
-\newcommand{\LangVarANF}{\ensuremath{L^{\mathsf{ANF}}_{\mathsf{Var}}}}
-\newcommand{\LangVarANFM}{L^{\mathsf{ANF}}_{\mathsf{Var}}}
+\newcommand{\LangVar}{$\Lang_{\mathsf{Var}}$} % R1
+\newcommand{\LangVarM}{\Lang_{\mathsf{Var}}}
 
-\newcommand{\LangIf}{$L_{\mathsf{If}}$} %R2
-\newcommand{\LangIfM}{\ensuremath{L_{\mathsf{If}}}} %R2
-\newcommand{\LangIfANF}{\ensuremath{L^{\mathsf{ANF}}_{\mathsf{if}}}} %R2
+\newcommand{\LangVarANF}{\ensuremath{\Lang^{\mathsf{ANF}}_{\mathsf{Var}}}}
+\newcommand{\LangVarANFM}{\Lang^{\mathsf{ANF}}_{\mathsf{Var}}}
 
-\newcommand{\LangCVar}{$C_{\mathsf{Var}}$} % C0
-\newcommand{\LangCVarM}{C_{\mathsf{Var}}} % C0
-\newcommand{\LangCIf}{$C_{\mathsf{If}}$} %C1
-\newcommand{\LangCIfM}{\ensuremath{C_{\mathsf{If}}}} %C1
-\newcommand{\LangVec}{$L_{\mathsf{Vec}}$} %R3
-\newcommand{\LangVecM}{L_{\mathsf{Vec}}} %R3
-\newcommand{\LangStruct}{\ensuremath{L^{\mathsf{Struct}}_{\mathsf{Vec}}}} %L^s3
-\newcommand{\LangCVec}{$C_{\mathsf{Vec}}$} %C2
-\newcommand{\LangCVecM}{C_{\mathsf{Vec}}} %C2
-\newcommand{\LangVecANF}{\ensuremath{L^{\mathsf{ANF}}_{\mathsf{Vec}}}} %R3
-\newcommand{\LangVecANFM}{L^{\mathsf{ANF}}_{\mathsf{Vec}}} %R3
-\newcommand{\LangAlloc}{\ensuremath{L_{\mathsf{Alloc}}}} %R3'
-\newcommand{\LangFun}{$L_{\mathsf{Fun}}$} %R4
-\newcommand{\LangFunM}{L_{\mathsf{Fun}}} %R4
-\newcommand{\LangCFun}{$C_{\mathsf{Fun}}$} %C3
-\newcommand{\LangCFunM}{C_{\mathsf{Fun}}} %C3
-\newcommand{\LangFunANF}{\ensuremath{L^{\mathsf{ANF}}_{\mathsf{Fun}}}} %R4
-\newcommand{\LangFunRef}{$L_{\mathsf{FunRef}}$} %F1
-\newcommand{\LangFunRefM}{L_{\mathsf{FunRef}}} %F1
-\newcommand{\LangFunRefAlloc}{\ensuremath{L^{\mathsf{Alloc}}_{\mathsf{FunRef}}}} %R'4
-\newcommand{\LangLam}{$L_\lambda$} %R5
-\newcommand{\LangLamM}{\ensuremath{L_\lambda}} %R5
-\newcommand{\LangCLam}{$C_{\mathsf{Clos}}$} %C4
-\newcommand{\LangCLamM}{C_{\mathsf{Clos}}} %C4
-\newcommand{\LangAny}{$L_{\mathsf{Any}}$} %R6
-\newcommand{\LangAnyM}{L_{\mathsf{Any}}} %R6
-\newcommand{\LangAnyFunRef}{\ensuremath{L^{\mathsf{FunRef}}_{\mathsf{Any}}}} %R'6
-\newcommand{\LangAnyAlloc}{\ensuremath{L^{\mathsf{Alloc}}_{\mathsf{Any}}}} %R'6
-\newcommand{\LangCAny}{$C_{\mathsf{Any}}$} %C5
-\newcommand{\LangCAnyM}{C_{\mathsf{Any}}} %C5
-\newcommand{\LangDyn}{$L_{\mathsf{Dyn}}$} %R7
-\newcommand{\LangDynM}{L_{\mathsf{Dyn}}} %R7
-\newcommand{\LangDynFunRef}{\ensuremath{L^{\mathsf{FunRef}}_{\mathsf{Dyn}}}} %R'7
-\newcommand{\LangLoop}{$L_{\mathsf{While}}$} %R8
-\newcommand{\LangLoopM}{L_{\mathsf{While}}} %R8
-\newcommand{\LangLoopFunRef}{\ensuremath{L^{\mathsf{FunRef}}_{\mathsf{While}}}} %R'8
-\newcommand{\LangLoopAlloc}{\ensuremath{L^{\mathsf{Alloc}}_{\mathsf{While}}}} %R'8
-\newcommand{\LangCLoop}{$C_{\circlearrowleft}$} %C7
-\newcommand{\LangCLoopM}{C_{\circlearrowleft}} %C7
-\newcommand{\LangLoopANF}{\ensuremath{L^{\mathsf{ANF}}_{\mathsf{While}}}} %R8
-\newcommand{\LangArray}{\ensuremath{L^{\mathsf{Vecof}}_{\mathsf{While}}}} %L^s3
-\newcommand{\LangGrad}{$L_{\mathsf{?}}$} %R9
-\newcommand{\LangGradM}{L_{\mathsf{?}}} %R9
-\newcommand{\LangCast}{$L_{\mathsf{cast}}$} %R9'
-\newcommand{\LangCastM}{L_{\mathsf{cast}}} %R9'
-\newcommand{\LangProxy}{\ensuremath{L_{\mathsf{proxy}}}} %R8''
-\newcommand{\LangPVec}{\ensuremath{L_{\mathsf{PVec}}}} %R8''
-\newcommand{\LangPVecFunRef}{\ensuremath{L^{\mathsf{FunRef}}_{\mathsf{PVec}}}} %R8''
-\newcommand{\LangPVecAlloc}{\ensuremath{L^{\mathsf{Alloc}}_{\mathsf{PVec}}}} %R8''
-\newcommand{\LangPoly}{\ensuremath{L_{\mathsf{Poly}}}} %R10
-\newcommand{\LangInst}{\ensuremath{L_{\mathsf{Inst}}}} %R'10
-\newcommand{\LangCLoopPVec}{\ensuremath{C^{\mathsf{PVec}}_{\circlearrowleft}}} %Cp7
+\newcommand{\LangIf}{$\Lang_{\mathsf{If}}$} %R2
+\newcommand{\LangIfM}{\ensuremath{\Lang_{\mathsf{If}}}} %R2
+\newcommand{\LangIfANF}{\ensuremath{\Lang^{\mathsf{ANF}}_{\mathsf{if}}}} %R2
+
+\newcommand{\LangCVar}{$\CLang_{\mathsf{Var}}$} % C0
+\newcommand{\LangCVarM}{\CLang_{\mathsf{Var}}} % C0
+\newcommand{\LangCIf}{$\CLang_{\mathsf{If}}$} %C1
+\newcommand{\LangCIfM}{\ensuremath{\CLang_{\mathsf{If}}}} %C1
+\newcommand{\LangVec}{$\Lang_{\mathsf{Vec}}$} %R3
+\newcommand{\LangVecM}{\Lang_{\mathsf{Vec}}} %R3
+\newcommand{\LangStruct}{\ensuremath{\Lang^{\mathsf{Struct}}_{\mathsf{Vec}}}} %\Lang^s3
+\newcommand{\LangCVec}{$\CLang_{\mathsf{Vec}}$} %C2
+\newcommand{\LangCVecM}{\CLang_{\mathsf{Vec}}} %C2
+\newcommand{\LangVecANF}{\ensuremath{\Lang^{\mathsf{ANF}}_{\mathsf{Vec}}}} %R3
+\newcommand{\LangVecANFM}{\Lang^{\mathsf{ANF}}_{\mathsf{Vec}}} %R3
+\newcommand{\LangAlloc}{\ensuremath{\Lang_{\mathsf{Alloc}}}} %R3'
+\newcommand{\LangFun}{$\Lang_{\mathsf{Fun}}$} %R4
+\newcommand{\LangFunM}{\Lang_{\mathsf{Fun}}} %R4
+\newcommand{\LangCFun}{$\CLang_{\mathsf{Fun}}$} %C3
+\newcommand{\LangCFunM}{\CLang_{\mathsf{Fun}}} %C3
+\newcommand{\LangFunANF}{\ensuremath{\Lang^{\mathsf{ANF}}_{\mathsf{Fun}}}} %R4
+\newcommand{\LangFunRef}{$\Lang_{\mathsf{FunRef}}$} %F1
+\newcommand{\LangFunRefM}{\Lang_{\mathsf{FunRef}}} %F1
+\newcommand{\LangFunRefAlloc}{\ensuremath{\Lang^{\mathsf{Alloc}}_{\mathsf{FunRef}}}} %R'4
+\newcommand{\LangLam}{$\Lang_\lambda$} %R5
+\newcommand{\LangLamM}{\ensuremath{\Lang_\lambda}} %R5
+\newcommand{\LangCLam}{$\CLang_{\mathsf{Clos}}$} %C4
+\newcommand{\LangCLamM}{\CLang_{\mathsf{Clos}}} %C4
+\newcommand{\LangAny}{$\Lang_{\mathsf{Any}}$} %R6
+\newcommand{\LangAnyM}{\Lang_{\mathsf{Any}}} %R6
+\newcommand{\LangAnyFunRef}{\ensuremath{\Lang^{\mathsf{FunRef}}_{\mathsf{Any}}}} %R'6
+\newcommand{\LangAnyAlloc}{\ensuremath{\Lang^{\mathsf{Alloc}}_{\mathsf{Any}}}} %R'6
+\newcommand{\LangCAny}{$\CLang_{\mathsf{Any}}$} %C5
+\newcommand{\LangCAnyM}{\CLang_{\mathsf{Any}}} %C5
+\newcommand{\LangDyn}{$\Lang_{\mathsf{Dyn}}$} %R7
+\newcommand{\LangDynM}{\Lang_{\mathsf{Dyn}}} %R7
+\newcommand{\LangDynFunRef}{\ensuremath{\Lang^{\mathsf{FunRef}}_{\mathsf{Dyn}}}} %R'7
+\newcommand{\LangLoop}{$\Lang_{\mathsf{While}}$} %R8
+\newcommand{\LangLoopM}{\Lang_{\mathsf{While}}} %R8
+\newcommand{\LangLoopFunRef}{\ensuremath{\Lang^{\mathsf{FunRef}}_{\mathsf{While}}}} %R'8
+\newcommand{\LangLoopAlloc}{\ensuremath{\Lang^{\mathsf{Alloc}}_{\mathsf{While}}}} %R'8
+\newcommand{\LangCLoop}{$\CLang_{\circlearrowleft}$} %C7
+\newcommand{\LangCLoopM}{\CLang_{\circlearrowleft}} %C7
+\newcommand{\LangLoopANF}{\ensuremath{\Lang^{\mathsf{ANF}}_{\mathsf{While}}}} %R8
+\newcommand{\LangArray}{\ensuremath{\Lang^{\mathsf{Vecof}}_{\mathsf{While}}}} %\Lang^s3
+\newcommand{\LangGrad}{$\Lang_{\mathsf{?}}$} %R9
+\newcommand{\LangGradM}{\Lang_{\mathsf{?}}} %R9
+\newcommand{\LangCast}{$\Lang_{\mathsf{cast}}$} %R9'
+\newcommand{\LangCastM}{\Lang_{\mathsf{cast}}} %R9'
+\newcommand{\LangProxy}{\ensuremath{\Lang_{\mathsf{proxy}}}} %R8''
+\newcommand{\LangPVec}{\ensuremath{\Lang_{\mathsf{PVec}}}} %R8''
+\newcommand{\LangPVecFunRef}{\ensuremath{\Lang^{\mathsf{FunRef}}_{\mathsf{PVec}}}} %R8''
+\newcommand{\LangPVecAlloc}{\ensuremath{\Lang^{\mathsf{Alloc}}_{\mathsf{PVec}}}} %R8''
+\newcommand{\LangPoly}{\ensuremath{\Lang_{\mathsf{Poly}}}} %R10
+\newcommand{\LangInst}{\ensuremath{\Lang_{\mathsf{Inst}}}} %R'10
+\newcommand{\LangCLoopPVec}{\ensuremath{\CLang^{\mathsf{PVec}}_{\circlearrowleft}}} %Cp7
 
 \newcommand{\LangXVar}{$\mathrm{x86}_{\mathsf{Var}}$} % pseudo x86_0
 \newcommand{\LangXASTInt}{\ensuremath{\mathrm{x86}_{\mathsf{Int}}}} % x86_0
@@ -161,10 +164,10 @@
 \newcommand{\UNIOP}[2]{\key{UnaryOp}\LP #1 \code{,} #2 \RP}
 \newcommand{\CUNIOP}[2]{#1~#2}
 \newcommand{\BINOP}[3]{\key{BinOp}\LP #1 \code{,} #2 \code{,} #3 \RP}
+\newcommand{\CBINOP}[3]{#2~#1~#3}
 \newcommand{\CEQ}[2]{#1~\code{==}~#2}
 \newcommand{\BOOLOP}[3]{\key{BoolOp}\LP #1 \code{,} \LS #2 \code{,} #3 \RS \RP}
 \newcommand{\CMP}[3]{\key{Compare}\LP #1\code{,}\LS #2 \RS \code{,} \LS #3 \RS\RP}
-\newcommand{\CBINOP}[3]{#2~#1~#3}
 \newcommand{\TRUE}{\key{True}}
 \newcommand{\FALSE}{\key{False}}
 \newcommand{\IF}[3]{\key{IfExp}\LP #1 \code{,} #2 \code{,} #3 \RP}

Some files were not shown because too many files changed in this diff