--- /dev/null
+\chapter{State}
+ \section{Introduction}
+ Provide some examples
+
+ \section{Approaches to state}
+ Explain impact of state (or rather, temporal behaviour) on function signature.
+ \subsection{Stream arguments and results}
+ \subsection{Explicit state arguments and results}
+ \section{Explicit state specification}
+ Note about semantic correctness of top level state.
+
+ Note about automatic ``down-pushing'' of state.
+
+ Note about explicit state specification as the best solution.
+
+ Note about substates
+
+ Note about conditions on state variables and checking them.
+
+ \section{Explicit state implementation}
+ Note about ignoring (sub)state components.
+
+ Note about extracting the state value from the return value.
+
+ \section{Initial state}
+ How to specify the initial state? Cannot be done inside a hardware
+ function, since the initial state is its own state argument for the first
+ call (unless you add an explicit, synchronous reset port).
+
+ External init state is natural for simulation.
+
+ External init state works for hardware generation as well.
+
+ Implementation issues: state splitting, linking input to output state,
+ checking usage constraints on state variables.
--- /dev/null
+\mainlanguage [en]
+\setuppapersize[A4][A4]
+
+\input Utils/Fonts
+\input Utils/Formats
+\input Utils/Lambda
+
+\usetypescript [Custom]
+
+% Use our custom typeface
+\switchtotypeface [Custom] [10pt]
+
+\starttext
+% TODO: Proper title page
+\title {From Haskell to Hardware - a Master's thesis}
+Matthijs Kooijman
+
+\completecontent
+\chapter{Introduction}
+\input Chapters/State
+\chapter{Normalization}
+\chapter{VHDL generation}
+\stoptext
--- /dev/null
+
+% Define a custom typescript. We could also have put the \definetypeface's
+% directly in the script, without a typescript, but I guess this is more
+% elegant...
+\starttypescript[Custom]
+% This is a sans font that supports greek symbols
+\definetypeface [Custom] [ss] [sans] [iwona] [default]
+\definetypeface [Custom] [rm] [serif] [antykwa-torunska] [default]
+\definetypeface [Custom] [tt] [mono] [modern] [default]
+\definetypeface [Custom] [mm] [math] [modern] [default]
+\stoptypescript
--- /dev/null
+%
+% Defines some useful formatting environments.
+%
+
+% A simple description format
+\definedescription
+ [desc]
+ [location=hanging,hang=20,width=broad]
+
+% An (invisible) frame to hold some expression. Used to treat multiple lines
+% as a single line and put it next to each other.
+\define[1]\hiddenframe{
+ % The align=right option really does left-alignment, but without it,
+ % all lines will end up on a single line. The strut=no option prevents
+ % a bunch of empty space at the start of the frame.
+ \framed[offset=0mm,location=middle,strut=no,align=right,frame=off]{#1}
+}
--- /dev/null
+%
+% Some utilities for formatting (extended) lambda calculus and
+% transformations.
+%
+
+% Install the lambda calculus pretty-printer, as defined in pret-lam.lua.
+\installprettytype [LAM] [LAM]
+% Define \startlambda \stoplambda
+\definetyping[lambda][option=LAM,style=sans]
+% Define \lam{} (since \lambda is taken)
+\definetype[lam][option=LAM,style=sans]
+
+% Install the transformation pretty-printer, as defined in pret-trans.lua.
+\installprettytype [TRANS] [TRANS]
+% Define \starttrans \stoptrans
+\definetyping[trans][option=TRANS,style=normal,before=,after=]
--- /dev/null
+%
+% This file defines some useful shortcut commands
+%
+
+
+% A shortcut for italicized e.g. and i.e.
+\define[0]\eg{{\em e.g.}}
+\define[0]\ie{{\em i.e.}}