X-Git-Url: https://git.martlubbers.net/?a=blobdiff_plain;f=dsl%2Fclass.tex;h=30df865630358a8f6ace91c4edd57e0776541003;hb=9778c30bde0ac05c50b7664aba1f3faad6682ef3;hp=9490d19bad5925b9870672ea3cbbe9e1b4cf7c10;hpb=55d92612436b8bed8a114e6dc49ce86d7cb96bea;p=phd-thesis.git diff --git a/dsl/class.tex b/dsl/class.tex index 9490d19..30df865 100644 --- a/dsl/class.tex +++ b/dsl/class.tex @@ -58,7 +58,7 @@ with Class'': TFP 2022.\ DANS.\ \url{https://doi.org/10.5281/zenodo.5081386}.} \section{Deep embedding} Pick a \gls{DSL}, any \gls{DSL}, pick the language of literal integers and addition. In deep embedding, terms in the language are represented by data in the host language. -Hence, defining the constructs is as simple as creating the following algebraic data type\footnote{All data types and functions are subscripted to indicate the evolution.}. +Hence, defining the constructs is as simple as creating the following algebraic data type\footnote{All data types and functions are subscripted to indicate the evolution. When definitions are omitted for version $n$, version $n-1$ is assumed.}. \begin{lstHaskellLhstex} data Expr_0 @@ -553,7 +553,7 @@ e3 = neg_4 (Lit_4 42 `sub_4` Lit_4 38) `Add_4` Lit_4 1 Leveraging \glspl{GADT}, deeply embedded \glspl{DSL} can be made statically type safe even when different value types are supported. Even when \glspl{GADT} are not supported natively in the language, they can be simulated using embedding-projection pairs or equivalence types \citep[\citesection{2.2}]{cheney_lightweight_2002}. Where some solutions to the expression problem do not easily generalise to \glspl{GADT} (see \cref{sec:cde:related}), classy deep embedding does. -Generalising the data structure of our \gls{DSL} is fairly straightforward and to spice things up a bit, we add an equality and boolean not language construct. +Generalising the data structure of our \gls{DSL} is fairly straightforward and to spice things up a bit, we add an equality and boolean negation language construct. To make the existing \gls{DSL} constructs more general, we relax the types of those constructors. For example, operations on integers now work on all numerals instead. Moreover, the \haskelllhstexinline{Lit_g} constructor can be used to lift values of any type to the \gls{DSL} domain as long as they have a \haskelllhstexinline{Show} instance, required for the printer. @@ -710,10 +710,10 @@ For example, hybrid embedding requires a transcoding step between the deep synta & \CIRCLE{}\tnote{3}\\ Simple type system & \CIRCLE{} & \CIRCLE{} & \Circle{} & \CIRCLE{} & \CIRCLE{} & \Circle{} - & \LEFTcircle{}\tnote{4}\\ + & \textcolor{gray}{\CIRCLE{}}\tnote{4}\\ Little boilerplate & \CIRCLE{} & \CIRCLE{} & \Circle{} & \CIRCLE{} & \CIRCLE{} & \Circle{} - & \LEFTcircle{}\tnote{4}\\ + & \textcolor{gray}{\CIRCLE{}}\tnote{4}\\ \bottomrule \end{tabular} \begin{tablenotes}