From 8ba7d975e0916eb8f06f11b1aa8350100dd497bb Mon Sep 17 00:00:00 2001 From: Mart Lubbers Date: Fri, 17 Jun 2016 20:16:28 +0200 Subject: [PATCH] fix nog meer boxen en referenties --- deliverables/report/gen.tex | 7 +++-- deliverables/report/report.tex | 2 +- deliverables/report/sem.tex | 53 +++++++++++++++++----------------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/deliverables/report/gen.tex b/deliverables/report/gen.tex index 17dacc0..fddc754 100644 --- a/deliverables/report/gen.tex +++ b/deliverables/report/gen.tex @@ -44,7 +44,10 @@ stack frame of that function. When plus has returned, the two arguments are popped of the stack and the value in \tt{RR} (for functions which do not return \tt{Void}) is placed on the stack. -\begin{SPLCode} \label{lst:stackFunCall} +\begin{lstlisting}[ + label={lst:stackFunCall}, + caption={Stack layout during function calls}, + language=SPLCode] plus(x, y}{ return x + y; } main(){ var a = plus(3, 4); } @@ -61,7 +64,7 @@ main(){ var a = plus(3, 4); } 117 | 003 ;x, loaded by ldl -3 118 | 004 ;y, loaded by ldl -2 */ -\end{SPLCode} +\end{lstlisting} \subsection{Generation} The code generation phase transforms a well typed \AST{} to either an error, diff --git a/deliverables/report/report.tex b/deliverables/report/report.tex index a82890a..de447ea 100644 --- a/deliverables/report/report.tex +++ b/deliverables/report/report.tex @@ -1,4 +1,4 @@ -\documentclass{article} +\documentclass[draft]{article} \usepackage{listings,clean,spl} %Sourcecode \usepackage[hidelinks]{hyperref} %Clickable references diff --git a/deliverables/report/sem.tex b/deliverables/report/sem.tex index cfb7cfb..9aa5af9 100644 --- a/deliverables/report/sem.tex +++ b/deliverables/report/sem.tex @@ -36,10 +36,7 @@ downside is that in the current implementation lambdas can not access variables in the scope in which they are declared. This could be solved by adding all free variables in the lambda expression as parameters to the lifted function. -\begin{lstlisting}[ - label={lst:lambdaLift}, - caption={SPLC types}, - language=SPLCode] +\begin{lstlisting}[label={lst:lambdaLift},caption={\SPLC{} types},language=SPLCode] main() { var x = \a b -> a + b; } @@ -186,19 +183,21 @@ and accumulating the resulting types, substitutions, etc. } \end{equation} -\begin{equation} \label{eq:inferAppN} - \infer[AppN] - {\Gamma \vdash \textit{id}(e^*).\textit{fs}^* \Rightarrow - ((\Gamma^\star, \star, \tau^r, - \textit{id}({e^*}').\textit{fs}^*)} - {\Gamma(id) = \lfloor \tau^e \rfloor - &\Gamma \vdash e^* \Rightarrow - (\Gamma^{\star_1}, \star_1, \tau^*, {e^*}') - &(\texttt{fold } (\rightarrow) \texttt{ } \alpha \texttt{ } \tau^*) - \unif \tau^e = \star_2 - &\star = \star_2 \cdot \star_1 - &\texttt{fold apfs } \tau \textit{ fs}^* = \tau^e +\begin{equation}\label{eq:inferAppN} + \resizebox{\linewidth}{!}{% + \infer[AppN] + {\Gamma \vdash \textit{id}(e^*).\textit{fs}^* \Rightarrow + ((\Gamma^\star, \star, \tau^r, + \textit{id}({e^*}').\textit{fs}^*)} + {\Gamma(id) = \lfloor \tau^e \rfloor + &\Gamma \vdash e^* \Rightarrow + (\Gamma^{\star_1}, \star_1, \tau^*, {e^*}') + &(\texttt{fold } (\rightarrow) \texttt{ } \alpha \texttt{ } \tau^*) + \unif \tau^e = \star_2 + &\star = \star_2 \cdot \star_1 + &\texttt{fold apfs } \tau \textit{ fs}^* = \tau^e } + } \end{equation} \paragraph{Return statements} @@ -235,15 +234,17 @@ selectors. \tt{unapfs} is a function which takes a type and a fieldselector and returns the type of the variable needed to assign to that fieldselector, i.e. \CI{unapfs a FieldHd = ListType a} \begin{equation} - \infer[Ass] - {\Gamma \vdash \textit{id.fs}^* \underline{=} e \Rightarrow - (\Gamma^\star.k:\tau_r^\star, \star, \textrm{Void}, - \textit{id.fs}^* \underline{=} e') - } - {\Gamma(\textit{id}) = \lfloor \tau_e \rfloor - &\Gamma \vdash e \Rightarrow (\Gamma^{\star_1}, \star_1, \tau_g, e') - &\texttt{fold unapfs } \tau_g \textit{ reverse fs} = \tau^r - &\tau_e \unif \tau_g = \star_2 - &\star = \star_2 \cdot \star_1 + \resizebox{\linewidth}{!}{% + \infer[Ass] + {\Gamma \vdash \textit{id.fs}^* \underline{=} e \Rightarrow + (\Gamma^\star.k:\tau_r^\star, \star, \textrm{Void}, + \textit{id.fs}^* \underline{=} e') + } + {\Gamma(\textit{id}) = \lfloor \tau_e \rfloor + &\Gamma \vdash e \Rightarrow (\Gamma^{\star_1}, \star_1, \tau_g, e') + &\texttt{fold unapfs } \tau_g \textit{ reverse fs} = \tau^r + &\tau_e \unif \tau_g = \star_2 + &\star = \star_2 \cdot \star_1 } + } \end{equation} -- 2.20.1