thesis / extcore.tex

Full commit
\chapter{GHC's external core}
This chapter describes \gls{ghc}'s external core functionality, its limitations
and issues (\autoref{sec:issues}), and what needs to be done to improve it.

External core is an external representation of the Core data-structure used in
\gls{ghc}'s compilation process\footnote{\gls{ghc}'s compilation process can be
seen in \mypref{fig:ghc-compilation}.}. As explained in \autoref{sec:ghc},
\gls{ghc} desugar Haskell to Core, after which \gls{ghc}'s main optimizations
are performed as semantics-preserving transformations on Core. The language
that the Core data-structure implements is described in \mypref{sec:core}.

External core representation of a Haskell source file is produced by giving
\gls{ghc} the flag \mycode{-fext-core}. \gls{ghc} also supports parsing
external core back into Core, and there is a Haskell package for parsing
and working with external core called \textit{extcore}\footnote{External core
parser package extcore:}.

PyHaskell takes Haskell code converted to external core as input, which it
then converts to a \gls{json} representation before it parses and evaluates
it. PyHaskell's pipeline is explained in detail in \mypref{sec:pipeline}.

\section{Limitations and issues}
While Core has been improved and upgraded to different iterations based of
\sysf (currently \sysfp), external core has been neglected and drifted out of
sync with Core.

\citet{eisenberg} have presented a formal definition of Core/\sysfp for the
latest \gls{ghc} version, 7.6, while \citet{tolmach} describe a precise
definition of external core that was last updated for \gls{ghc} version 6.10.
The time period between these two versions are about four years. In these four
years core has seen significant work, while external core has not.

TODO: Describe what doesn't work, and some of the issues this creates.

%getting External Core and Core back in sync

\section{Improvements and solutions}

\subsection{GHC API}
Why not GHC API.

\section{Future work}