% T I T L E   P A G E
% -------------------
% Last updated October 23, 2020, by Stephen Carr, IST-Client Services
% The title page is counted as page `i' but we need to suppress the
% page number. Also, we don't want any headers or footers.
\pagestyle{empty}
\pagenumbering{roman}

% The contents of the title page are specified in the "titlepage"
% environment.
\begin{titlepage}
        \begin{center}
        \vspace*{1.0cm}

        {\Huge\bf Exception Handling in \CFA}

        \vspace*{1.0cm}

        by \\

        \vspace*{1.0cm}

        {\Large Andrew James Beach} \\

        \vspace*{3.0cm}

        A thesis \\
        presented to the University of Waterloo \\
        in fulfillment of the \\
        thesis requirement for the degree of \\
        Master of Mathematics \\
        in \\
        Computer Science \\

        \vspace*{2.0cm}

        Waterloo, Ontario, Canada, \the\year \\

        \vspace*{1.0cm}

        \copyright{} Andrew James Beach \the\year \\
        \end{center}
\end{titlepage}

% The rest of the front pages should contain no headers and be numbered using
% Roman numerals starting with `ii'.
\pagestyle{plain}
\setcounter{page}{2}

\cleardoublepage % Ends the current page and causes all figures and tables
% that have so far appeared in the input to be printed. In a two-sided
% printing style, it also makes the next page a right-hand (odd-numbered)
% page, producing a blank page if necessary.

\begin{comment}
% E X A M I N I N G   C O M M I T T E E (Required for Ph.D. theses only)
% Remove or comment out the lines below to remove this page
\begin{center}\textbf{Examining Committee Membership}\end{center}
  \noindent
The following served on the Examining Committee for this thesis.
The decision of the Examining Committee is by majority vote.
  \bigskip

  \noindent
\begin{tabbing}
Internal-External Member: \=  \kill % using longest text to define tab length
External Examiner: \>  Bruce Bruce \\
\> Professor, Dept. of Philosophy of Zoology, University of Wallamaloo \\
\end{tabbing}
  \bigskip

  \noindent
\begin{tabbing}
Internal-External Member: \=  \kill % using longest text to define tab length
Supervisor(s): \> Ann Elk \\
\> Professor, Dept. of Zoology, University of Waterloo \\
\> Andrea Anaconda \\
\> Professor Emeritus, Dept. of Zoology, University of Waterloo \\
\end{tabbing}
  \bigskip

  \noindent
  \begin{tabbing}
Internal-External Member: \=  \kill % using longest text to define tab length
Internal Member: \> Pamela Python \\
\> Professor, Dept. of Zoology, University of Waterloo \\
\end{tabbing}
  \bigskip

  \noindent
\begin{tabbing}
Internal-External Member: \=  \kill % using longest text to define tab length
Internal-External Member: \> Meta Meta \\
\> Professor, Dept. of Philosophy, University of Waterloo \\
\end{tabbing}
  \bigskip

  \noindent
\begin{tabbing}
Internal-External Member: \=  \kill % using longest text to define tab length
Other Member(s): \> Leeping Fang \\
\> Professor, Dept. of Fine Art, University of Waterloo \\
\end{tabbing}

\cleardoublepage
\end{comment}

% D E C L A R A T I O N   P A G E
% -------------------------------
  % The following is a sample Delaration Page as provided by the GSO
  % December 13th, 2006.  It is designed for an electronic thesis.
 \begin{center}\textbf{Author's Declaration}\end{center}

 \noindent
I hereby declare that I am the sole author of this thesis. This is a true copy
of the thesis, including any required final revisions, as accepted by my
examiners.

  \bigskip

  \noindent
I understand that my thesis may be made electronically available to the public.

\cleardoublepage

% A B S T R A C T
% ---------------

\begin{center}\textbf{Abstract}\end{center}

The \CFA (Cforall) programming language is an evolutionary refinement of
the C programming language, adding modern programming features without
changing the programming paradigms of C.
One of these modern programming features is more powerful error handling
through the addition of an exception handling mechanism (EHM).

This thesis covers the design and implementation of the \CFA EHM,
along with a review of the other required \CFA features.
The EHM includes common features of termination exception handling,
which abandons and recovers from an operation,
and similar support for resumption exception handling,
which repairs and continues with an operation.
The design of both has been adapted to utilize other tools \CFA provides,
as well as fit with the assertion based interfaces of the language.

The EHM has been implemented into the \CFA compiler and run-time environment.
Although it has not yet been optimized, performance testing has shown it has
comparable performance to other EHMs,
which is sufficient for use in current \CFA programs.

\cleardoublepage

% A C K N O W L E D G E M E N T S
% -------------------------------

\begin{center}\textbf{Acknowledgements}\end{center}

As is tradition and his due, I would like to begin by thanking my
supervisor Peter Buhr. From accepting me in a first place,
to helping me run performance tests, I would not be here without him.
Also if there was an ``artist" field here he would be listed there as well,
he helped me a lot with the diagrams.

I would like to thank the readers
Gregor Richards and Yizhou Zhang
for their feedback and approval.
The presentation of the thesis has definitely been improved with their
feedback.

I also thank the entire Cforall Team who built the rest of the
\CFA compiler. From the existing features I used in my work, to the
internal tooling that makes further development easier and the optimizations
that make running tests pass by quickly.
This includes: Aaron Moss, Rob Schluntz, Thierry Delisle, Michael Brooks,
Mubeen Zulfieqar \& Fangren Yu.

And thank-you Henry Xue, the co-op student who
converted my macro implementation of exception declarations into
the compiler features presented in this thesis.

Finally I thank my family, who are still relieved I learned how to read.

\cleardoublepage

\begin{comment}
% D E D I C A T I O N
% -------------------

\begin{center}\textbf{Dedication}\end{center}

This is dedicated to the one I love.
\cleardoublepage
\end{comment}

% T A B L E   O F   C O N T E N T S
% ---------------------------------
\renewcommand\contentsname{Table of Contents}
\tableofcontents
\cleardoublepage
\phantomsection    % allows hyperref to link to the correct page

% L I S T   O F   F I G U R E S
% -----------------------------
\addcontentsline{toc}{chapter}{List of Figures}
\listoffigures
\cleardoublepage
\phantomsection		% allows hyperref to link to the correct page

% L I S T   O F   T A B L E S
% ---------------------------
\addcontentsline{toc}{chapter}{List of Tables}
\listoftables
\cleardoublepage
\phantomsection		% allows hyperref to link to the correct page

% Change page numbering back to Arabic numerals
\pagenumbering{arabic}
