# thesis / extcore.tex

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 %---------------------------- \chapter{GHC's external core} %---------------------------- \label{sec:extcore} 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: http://hackage.haskell.org/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} %------------------------------- \label{sec: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. %http://hackage.haskell.org/trac/ghc/wiki/ExternalCore %getting External Core and Core back in sync \section{Improvements and solutions} %----------------------------------- \subsection{GHC API} Why not GHC API. \section{Future work} %--------------------