diff options
author | Camil Staps | 2016-06-07 15:51:04 +0200 |
---|---|---|
committer | Camil Staps | 2016-06-07 15:51:04 +0200 |
commit | a82dc42e7c07fa47d2dab0cbe26a31e080ae9952 (patch) | |
tree | f2f7ec0b7851bfc4ed1887f66c254904e7b27487 /paper | |
parent | Finishing first version paper (diff) |
Processed feedback
Diffstat (limited to 'paper')
-rw-r--r-- | paper/ast.tex | 4 | ||||
-rw-r--r-- | paper/eval.tex | 4 | ||||
-rw-r--r-- | paper/ftypes.tex | 3 | ||||
-rw-r--r-- | paper/interp.tex | 15 | ||||
-rw-r--r-- | paper/intro-org.tex | 23 | ||||
-rw-r--r-- | paper/intro-while.tex | 7 | ||||
-rw-r--r-- | paper/intro.tex | 12 | ||||
-rw-r--r-- | paper/paper.bib | 2 |
8 files changed, 36 insertions, 34 deletions
diff --git a/paper/ast.tex b/paper/ast.tex index 97feb04..6b5ab8b 100644 --- a/paper/ast.tex +++ b/paper/ast.tex @@ -13,8 +13,8 @@ in the grammar of \autoref{sec:intro:while}. These operators could also be constructed from other boolean expressions. We have also added \CI{Div} for integer division. -As an example, the example program from \autoref{sec:intro:while} would be -stored in the AST as follows: +As an example, the program from \autoref{sec:intro:while} would be stored in +the AST as follows: \begin{lstlisting} Compose diff --git a/paper/eval.tex b/paper/eval.tex index 969a82d..36ff225 100644 --- a/paper/eval.tex +++ b/paper/eval.tex @@ -21,7 +21,7 @@ looking up the variable in the state fails, a \CI{Left Error} will be returned. The last case is more interesting, however. Here, we use bind (\CI{>>=}) to simulate exception handling: the two evaluations of \CI{a1} and \CI{a2} may fail, as may the application of the operator to its two arguments. Even though -we don't know at this point \emph{why} or \emph{where} the evaluation failed, +we do not know at this point \emph{why} or \emph{where} the evaluation failed, \CI{>>=} will conveniently pass through any errors. The abstraction of monad binding allows us to work with data or errors, without @@ -42,7 +42,7 @@ to model it as a lookup table: :: State :== [(Var, Int)] \end{lstlisting} -While possible, this has several drawbacks. First of all, we would need a +Though possible, this has several drawbacks. First of all, we would need a separate function to look up a variable in this store. We could implement that function as follows: diff --git a/paper/ftypes.tex b/paper/ftypes.tex index 803182f..8561b51 100644 --- a/paper/ftypes.tex +++ b/paper/ftypes.tex @@ -1,8 +1,5 @@ \section{Used functions and types} \label{sec:ftypes} -The following functions are considered known. If not, looking them up is easy -using Cloogle~\citep{cloogle}. - \lstinputlisting[firstline=5,lastline=23,xleftmargin=0pt]{While/Common.dcl} \lstinputlisting[firstline=34,lastline=34,xleftmargin=0pt]{While/Common.dcl} diff --git a/paper/interp.tex b/paper/interp.tex index 5b8db03..f5101e5 100644 --- a/paper/interp.tex +++ b/paper/interp.tex @@ -15,9 +15,10 @@ $$ \end{prooftree} $$ -This specifies nothing else than the intuition: if the execution of statement -$S_1$ in state $s$ yields state $s'$, and $S_2$ in $s'$ yields $s''$, then -$\whcomp{S_1}{S_2}$ in $s$ yields $s''$. +This derivation rule consists of two premises, above the line, and one +conclusion, beneath the line. It specifies nothing else than the intuition: if +the execution of statement $S_1$ in state $s$ yields state $s'$, and $S_2$ in +$s'$ yields $s''$, then $\whcomp{S_1}{S_2}$ in $s$ yields $s''$. The translation of this rule in a functional program looks as follows: @@ -50,7 +51,8 @@ $$ \end{cases} $$ -This gives the assignment rule: +This gives the assignment axiom\footnote{An axiom, in this context, is nothing +else than a derivation rule with zero premises.}: $$ \begin{prooftree} @@ -106,8 +108,9 @@ $$ \end{prooftree} $$ -A similar rule exists for $S_2$ in the case that $\mathcal B\llbracket -b\rrbracket s$ does not hold. +This derivation rule has one premise, but can only be applied when the +condition $\mathcal B\llbracket b\rrbracket s$ holds. A similar rule exists +for $S_2$ in the case that the condition does not hold. The problem with these rules is that they can only be applied when some condition is met. In this case, the condition is still relatively easy. In diff --git a/paper/intro-org.tex b/paper/intro-org.tex index 70c5099..3fba1d3 100644 --- a/paper/intro-org.tex +++ b/paper/intro-org.tex @@ -1,17 +1,18 @@ -\subsection{Paper organistation} +\subsection{Paper organisation} \label{sec:intro:org} In this paper we present different advantages of working with imperative code in a functional style. We do this by means of a case study, an interpreter of -the language While~\citep{proganal}. We will describe this example language -briefly in \autoref{sec:intro:while}. Before discussing our interpreter, we -will discuss basic definition that will be helpful in \autoref{sec:predefs}. -Since extensive research has already been done into lexing and parsing -\citep[see e.g.][]{yard}, will skip these steps and assume we already have an -abstract syntax tree (AST). This AST is described in \autoref{sec:ast}. In -\autoref{sec:eval} we will discuss different possibilities of evaluating -mathematical expressions. Finally, in \autoref{sec:interp} we will propose a -While interpreter. We finish by articulating the advantages of functional +the language While~\citep{proganal}. This example language is briefly described +in \autoref{sec:intro:while}. Before discussing our interpreter, we discuss +basic definitions that will be helpful in \autoref{sec:predefs}. Since +extensive research has already been done into lexing and parsing \citep[see +e.g.][]{yard}, we skip these steps and assume we already have an abstract +syntax tree (AST). This AST is described in \autoref{sec:ast}. In +\autoref{sec:eval} we discuss different possibilities of evaluating +mathematical expressions. Finally, in \autoref{sec:interp} we propose a While +interpreter. We finish by articulating the advantages of functional interpretation in \autoref{sec:concl}. \autoref{sec:ftypes} lists the functions and types that the reader is supposed -to know. +to know. If this is not the case: they can easily be looked up using +Cloogle~\citep{cloogle}. diff --git a/paper/intro-while.tex b/paper/intro-while.tex index 128244a..77251bd 100644 --- a/paper/intro-while.tex +++ b/paper/intro-while.tex @@ -1,7 +1,7 @@ \subsection{The language While} \label{sec:intro:while} -We will use the language While described by~\cite{proganal} as a running -example. In its definition, we use the following meta-variables: +We use the language While described by~\cite{proganal} as a running example. In +its definition, the following meta-variables are used: \begin{tabbing} \qquad \= $n$ \enspace\= denotes an integer; \\ @@ -57,4 +57,5 @@ after executing the following program, \verb$y$ will have been divided by $2$: } \end{while} -While programs are executed in a \emph{state} which maps variables to integers. +Programs in While are executed in a \emph{state} which maps variables to +integers. diff --git a/paper/intro.tex b/paper/intro.tex index 2d44b4a..8d76100 100644 --- a/paper/intro.tex +++ b/paper/intro.tex @@ -4,15 +4,15 @@ Compilers and interpreters are among the most complex pieces of software written to date. Due to the rapid technological development of the last decades, programming languages have become increasingly complex, semantically speaking. It has become impossible for a programmer to keep in mind the impact -of their changes on the generated machine code. Developers now constantly rely on assumptions about how -the language that they write in works. Intuitive semantics may change over -time, however, and proper definitions are required now that our world relies so -principally on software. +of their changes on the generated machine code. Developers now constantly rely +on assumptions about how the language they are using actually works. Intuitive +semantics may change over time, however, and proper definitions are required +now that our world relies so principally on software. Nowadays, programming languages have semantical specifications as the main link between programmers and compiler designers. This solves the problem on the -programmer's side. However, now that programming languages become increasingly -complex, another problem occurs on the compiler designer's side: the +programmer's side. However, with the increasing complexity of programming +languages, another problem occurs on the compiler designer's side: the specification has become too complex to efficiently translate it into imperative code, and writing a correct compiler or interpreter is no longer a trivial task. diff --git a/paper/paper.bib b/paper/paper.bib index a0a462f..616c45c 100644 --- a/paper/paper.bib +++ b/paper/paper.bib @@ -35,7 +35,7 @@ @misc{cloogle, author = {Lubbers, M. and Staps, C.}, - title = {Cloogle}, + title = {Cloogle, the {C}lean search engine}, year = {2016}, howpublished = "\mbox{\url{http://cloogle.org/}}", note = "Accessed June 2, 2016" |