From 14ec0ad883bc51fb16c72472e060ff0443e29533 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Fri, 3 Jun 2016 13:31:46 +0200 Subject: Finishing first version paper --- paper/concl.tex | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 paper/concl.tex (limited to 'paper/concl.tex') diff --git a/paper/concl.tex b/paper/concl.tex new file mode 100644 index 0000000..502a5ad --- /dev/null +++ b/paper/concl.tex @@ -0,0 +1,27 @@ +\section{Conclusion} +\label{sec:concl} + +Walking through the implementation of a While interpreter we have seen +different advantages of doing this in a functional style. + +First of all, the syntax could be translated directly from grammar to type +definitions. It is true that simple algebraic data types, as used in +\autoref{sec:ast}, could be simulated with enumeration types and pointers in +an imperative style. However, any one will agree that the functional +definitions are better readable, making their usage less error-prone. + +Secondly, in \autoref{sec:eval} we saw that functional programming languages +allow us to easily work with higher order functions: we did not need to +implement the state as a lookup table but could simply use a function. + +We then discussed the use of the \CI{Either} monad for error reporting. Monadic +binding lets us work easily with calculations that may fail. Moreover, in +\autoref{sec:interp} we saw that monads also let us specify execution order. + +In general, we have seen that a functional style allows us to stay close to the +semantic definitions of a language. This makes it very easy to verify that our +implementation of the semantics is correct. Proofs that hold for the semantics +(like completeness or correctness with respect to axiomatic semantics) easily +apply to the interpreter as well, once the correctness of the interpreter has +been established --- this is generally a trivial task. Furthermore, the final +implementation is better readable and thus easier to maintain. -- cgit v1.2.3