Commits

Even Wiik Thomassen  committed e84d0ff

Added z-encoding table.

  • Participants
  • Parent commits fd15d5f

Comments (0)

Files changed (3)

File appendices.tex

+%===================
+\chapter{Appendices}
+%===================
+TODO
+
+
+%-------------------
+\section{Z-encoding}
+%-------------------
+\label{sec:zencoding}
+TODO
+
+\begin{table}[htbp] \footnotesize \center
+\caption{Z-encoding\label{tab:zencoding}}
+\begin{tabular}{c c}
+    \toprule
+    Characters & Code \\
+    \midrule
+    Tuples: & \\
+    () & Z0T \\
+    (,,) & Z3T \\
+    (\# \#) & Z1H \\
+    \addlinespace
+    Constructors: & \\
+    ( & ZL \\
+    ) & ZR \\
+    {[} & ZM \\
+    {]}     & ZN \\
+    : & ZC \\
+    Z & ZZ \\
+    \addlinespace
+    Variables: & \\
+    z & zz \\       
+    \& & za \\
+    | & zb \\
+    \^{} & zc \\
+    \$ & zd \\
+    = & ze \\
+    > & zg \\
+    \# & zh \\
+    . & zi \\
+    < & zl \\
+    - & zm \\
+    ! & zn \\
+    + & zp \\
+    \textbackslash & zq \\
+    \textbackslash\textbackslash & zr \\
+    / & zs \\
+    {*}     & zt \\
+    \_ & zu \\
+    \% & zv \\
+    char & znnnU \\
+    \bottomrule
+\end{tabular}
+\end{table}
+
 
 % Appendices
 %------------
-%\appendix
-%\include{appendices}
+\appendix
+\include{appendices}
 
 
 %=============

File pyhaskell.tex

 Consider the simple example of printing the string ``Hey'' to \mycode{stdout}:
 \mint{haskell}|main = putStrLn "Hey"|
 In the external core output produced by \gls{ghc}
-(\mylst{lst:putStrLn-extcore}), one might see that the example simply calls
-\mycode{putStrLn} with the unpacked string ``Hey''. PyHaskell converts this to
-a set of operations that it evaluates, and in line six of
+(\mylst{lst:putStrLn-extcore}\footnote{\mylst{lst:putStrLn-extcore} has been
+Z-decoded according to \mypref{tab:zencoding}}), one might see that the example
+simply calls \mycode{putStrLn} with the unpacked string ``Hey''. PyHaskell
+converts this to a set of operations that it evaluates, and in line six of
 \mylst{lst:putStrLn-evallog} the string is printed. The argument to
 \mycode{putStrLn} can be seen again in line seven, and it is given to
 \mycode{runMainIO} in line eight, where evaluation ends.
 \begin{listing}[htbp]
 \begin{lstlisting}[basicstyle=\footnotesize, numberstyle=\tiny\color{gray}, numbers=right]
 %module main:Main
-  main:Main.main :: (ghczmprim:GHCziTypes.IO
-                     ghczmprim:GHCziTuple.Z0T) =
-    base:SystemziIO.putStrLn
-    (ghczmprim:GHCziCString.unpackCStringzh
-     ("Hey"::ghczmprim:GHCziPrim.Addrzh));
-  main:ZCMain.main :: (ghczmprim:GHCziTypes.IO
-                       ghczmprim:GHCziTuple.Z0T) =
-    base:GHCziTopHandler.runMainIO @ ghczmprim:GHCziTuple.Z0T
+  main:Main.main :: (ghc-prim:GHC.Types.IO
+                     ghc-prim:GHC.Tuple.()) =
+    base:System.IO.putStrLn
+    (ghc-prim:GHC.CString.unpackCString#
+     ("Hey"::ghc-prim:GHC.Prim.Addr#));
+  main::Main.main :: (ghc-prim:GHC.Types.IO
+                       ghc-prim:GHC.Tuple.()) =
+    base:GHC.TopHandler.runMainIO @ ghc-prim:GHC.Tuple.()
     main:Main.main;
 \end{lstlisting}
 \caption{putStrLn example, GHC external core output\label{lst:putStrLn-extcore}}