Index: doc/theses/jiada_liang_MMath/CFAenum.tex
===================================================================
--- doc/theses/jiada_liang_MMath/CFAenum.tex	(revision 6c8b76be93b407a63a16e71fb725c33f92b4303b)
+++ doc/theses/jiada_liang_MMath/CFAenum.tex	(revision a8853574dd2ba32ccb73b2d92c8ae8d2996bc657)
@@ -128,4 +128,8 @@
 Note, the enumeration type can be a structure (see @Person@ in Figure~\ref{f:EumeratorTyping}), so it is possible to have the equivalent of multiple arrays of companion data using an array of structures.
 
+While the enumeration type can be any C aggregate, the aggregate's \CFA constructors are not used to evaluate an enumerator's value.
+\CFA enumeration constants are compile-time values (static);
+calling constructors happens at runtime (dynamic).
+
 
 \section{Pure Enumerators}
Index: doc/theses/jiada_liang_MMath/relatedwork.tex
===================================================================
--- doc/theses/jiada_liang_MMath/relatedwork.tex	(revision 6c8b76be93b407a63a16e71fb725c33f92b4303b)
+++ doc/theses/jiada_liang_MMath/relatedwork.tex	(revision a8853574dd2ba32ccb73b2d92c8ae8d2996bc657)
@@ -1,4 +1,13 @@
 \chapter{Related Work}
 \label{s:RelatedWork}
+
+An algebraic data type (ADT) can be viewed as a recursive sum of product types.
+A sum type lists values as members.
+A member in a sum type definition is known as a data constructor.
+For example, C supports sum types union and enumeration (enum).
+An enumeration in C can be viewed as the creation of a list of zero-arity data constructors.
+A union instance holds a value of one of its member types.
+Defining a union does not generate new constructors.
+The definition of member types and their constructors are from the outer lexical scope.
 
 In general, an \Newterm{algebraic data type} (ADT) is a composite type, \ie, a type formed by combining other types.
@@ -66,5 +75,5 @@
 \end{ada}
 Like \CFA, Ada uses an advanced type-resolution algorithm, including the left-hand side of assignment, to disambiguate among overloaded names.
-\VRef[Figure]{f:AdaEnumeration} shows how ambiguity is handled using a cast, \eg \lstinline[language=ada]{RGB'(Red)}.
+\VRef[Figure]{f:AdaEnumeration} shows how ambiguity is handled using a cast, \ie \lstinline[language=ada]{RGB'(Red)}.
 
 \begin{figure}
@@ -254,5 +263,5 @@
 enum E { A, B, C };
 E e = A;
-int i = A;   i = e;	 					$\C{// implicit casts to int}$
+int i = A;    i = e; 					$\C{// implicit casts to int}$
 \end{c++}
 \CC{11} added a scoped enumeration, \lstinline[language=c++]{enum class} (or \lstinline[language=c++]{enum struct}), where the enumerators are accessed using type qualification.
@@ -266,6 +275,5 @@
 enum class E { A, B, C };
 @using enum E;@
-E e = A;	 							$\C{// direct access}$
-e = B;	 								$\C{// direct access}$
+E e = A;    e = B;						$\C{// direct access}$
 \end{c++}
 \CC{11} added the ability to explicitly declare the underlying \emph{integral} type for \lstinline[language=c++]{enum class}.
@@ -2454,72 +2462,56 @@
 
 
-\section{OCamal}
+\section{OCaml}
+\lstnewenvironment{ocaml}[1][]{\lstset{language=ML,escapechar=\$,moredelim=**[is][\color{red}]{@}{@},}\lstset{#1}}{}
+
 An enumerated data types is a list of named values.
-\begin{python}
->>> type weekday =
-... | Monday
-... | Tuesday 
-... | Wednesday 
-... | Thursday 
-... | Friday 
-... | Saturday 
-... | Sunday
-\end{python}
-Enumerated data types are the simplest subset of Variants types. Because weekday is a summantion of values Monday to Sunday,
-enumerated data types are often call a sum type in turns of functional programming paradigm. 
-
-The values defined in an enumerated type are called data constructors. The data constructors of an enumerated data type 
-takes no value as parameter. They are known as 0-arity constructor.
+\begin{ocaml}
+type weekday = Mon | Tue | Wed | Thu | Fri | Sat | Sun
+\end{ocaml}
+Enumerated data types are the simplest subset of variants types.
+Because @weekday@ is a summantion of values @Mon@ to @Sun@, enumerated data types are often call a sum type in turns of functional programming paradigm. 
+
+The values defined in an enumerated type are called data constructors.
+The data constructors of an enumerated data type takes no value as parameter.
+They are known as 0-arity constructor.
 
 A more generic variant type has n-ary constructors. 
-\begin{python}
->>> type color =
-... | Red
-... | Green of string
-... | Blue of int * float
-\end{python}
-The color type can be constructed as a combination of a value from an int and a blue, using 
-the Blue data constructor. Mathematically, a Blue value is a Cartesian product of the int type and the bool. 
-Color type is a summation of a nullary type, an unary product type, and a cross product of int and bool. The 
-OCamal variant type can be create as a sum of product of different types.
+\begin{ocaml}
+type colour = Red | Green of string | Blue of int * float
+\end{ocaml}
+The @colour@ type can be constructed as a combination of a value from an @int@ and a @blue@, using the @Blue@ data constructor.
+Mathematically, a @Blue@ value is a Cartesian product of the @int@ type and the @bool@. 
+@Colour@ type is a summation of a nullary type, a unary product type, and a cross product of @int@ and @bool@.
+The OCaml variant type can be create as a sum of product of different types.
 
 A variant type can have a recursively definition.
-\begin{python}
->>> type stringList =
-... | Empty
-... | Pair of string * stringList
-\end{python}
-
-OCaml's variant types are recusrive sum of product of types, which are known as Algebraic Data Types. Programming languages
-follows the functional programming paradigm often supports algebraic data types, and supports Pattern Matching against 
-algebraic data type.
-
-\begin{python}
->>> let take_class = functio
-... | Monday | Wednesday -> "CS442"
-... | Tuesday | Thursday -> "CS343"
-... | Friday -> "Tutorial"
-... | _ -> "Take a break";;
-\end{python}
-
-The function a weekday as parameter, and returns "CS442" if the weekday value is Monday or Wednesday, "CS343"
-if the value is Tuesday or Thursday, "Tutorial" if it is Friday. The @_@ is wildcard, and it can match any weekday value.
-If the value is Saturday or Sunday, which are not matched by the previous cases, it will be matched by the @_@ and the 
-function returns "Take a break".
+\begin{ocaml}
+type stringList = Empty | Pair of string * stringList
+\end{ocaml}
+OCaml's variant types are recusrive sum of product of types, which are known as Algebraic Data Types.
+Programming languages follows the functional programming paradigm often supports algebraic data types, and supports pattern matching against algebraic data type.
+\begin{ocaml}
+let take_class = function
+	Mon | Wed -> "CS442" |
+	Tue | Thu -> "CS343" |
+	Fri -> "Tutorial" |
+	_ -> "Take a break"
+\end{ocaml}
+The function has a @weekday@ as parameter, and returns @"CS442"@, if the weekday value is @Mon@ or @Wed@, @"CS343"@, if the value is @Tue@ or @Thu@, and @"Tutorial"@ for @Fri@.
+The @_@ is a wildcard matching any @weekday@ value, so the function returns @"Take a break"@ for values @Sat@ or @Sun@, which are not matched by the previous cases.
 
 Values of a product type can be named.
-\begin{python}
->>> let check_color (c: color): string =
-... match c with
-... | Red -> "Red"
-... | Green g -> g
-... | Blue (i, f) -> string_of_int i ^ string_of_float f;;
-\end{python}
-
-Recurisve function are often used to pattern match against a recurisve variant type.
-\begin{python}
->>> let rec len_of_string_list(l: stringList): int =
-... match l with
-... | Empty -> 0
-... | Pair (_ , r) -> 1 + len_of_string_list r
-\end{python}
+\begin{ocaml}
+let check_colour (c: colour): string =
+	 match c with
+		Red -> "Red" |
+		Green g -> g |
+		Blue(i, f) -> string_of_int i ^ string_of_float f
+\end{ocaml}
+A recurisve function is often used to pattern match against a recurisve variant type.
+\begin{ocaml}
+let rec len_of_string_list(l: stringList): int =
+	match l with
+		Empty -> 0 |
+		Pair(_ , r) -> 1 + len_of_string_list r
+\end{ocaml}
Index: doc/theses/jiada_liang_MMath/uw-ethesis.tex
===================================================================
--- doc/theses/jiada_liang_MMath/uw-ethesis.tex	(revision 6c8b76be93b407a63a16e71fb725c33f92b4303b)
+++ doc/theses/jiada_liang_MMath/uw-ethesis.tex	(revision a8853574dd2ba32ccb73b2d92c8ae8d2996bc657)
@@ -89,9 +89,10 @@
 \usepackage[labelformat=simple,aboveskip=0pt,farskip=0pt,font=normalsize]{subfig}
 \renewcommand\thesubfigure{(\alph{subfigure})}
+
 % cfa macros used in the document
 \input{common}
 %\usepackage{common}
 \CFAStyle						% CFA code-style
-\lstset{language=cfa,belowskip=-1pt}					% set default language to CFA
+\lstset{language=cfa,belowskip=-1pt} % set default language to CFA
 
 \newcommand{\newtermFont}{\emph}
@@ -108,5 +109,5 @@
 \usepackage[dvips,pagebackref=true]{hyperref} % with basic options
 %\usepackage[pdftex,pagebackref=true]{hyperref}
-		% N.B. pagebackref=true provides links back from the References to the body text. This can cause trouble for printing.
+% N.B. pagebackref=true provides links back from the References to the body text. This can cause trouble for printing.
 \hypersetup{
     plainpages=false,       % needed if Roman numbers in frontpages
@@ -116,5 +117,5 @@
     pdffitwindow=false,     % window fit to page when opened
     pdfstartview={FitH},    % fits the width of the page to the window
-    pdftitle={Type Resolution in \CFA}, % title: CHANGE THIS TEXT!
+    pdftitle={\CFA Enumerations}, % title: CHANGE THIS TEXT!
     pdfauthor={Jiada Liang},    % author: CHANGE THIS TEXT! and uncomment this line
     pdfsubject={Cforall},  % subject: CHANGE THIS TEXT! and uncomment this line
