% T I T L E P A G E % ------------------- % 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 \CFA{} Type System Implementation } \vspace*{1.0cm} \normalsize by \\ \vspace*{1.0cm} \Large Aaron Moss \\ \vspace*{3.0cm} \normalsize A thesis \\ presented to the University of Waterloo \\ in fulfillment of the \\ thesis requirement for the degree of \\ Doctor of Philosophy \\ in \\ Computer Science \\ \vspace*{2.0cm} Waterloo, Ontario, Canada, 2019 \\ \vspace*{1.0cm} \copyright\ Aaron Moss 2019 \\ \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. % E X A M I N I N G C O M M I T T E E % ------------------------------------- \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: \> Doug Lea \\ \> Professor, Computer Science Department, \\ \> State University of New York at Oswego \\ \end{tabbing} \bigskip \noindent \begin{tabbing} Internal-External Member: \= \kill % using longest text to define tab length Supervisor: \> Peter Buhr \\ \> Associate Professor, School of Computer Science, \\ \> University of Waterloo \\ \end{tabbing} \bigskip \noindent \begin{tabbing} Internal-External Member: \= \kill % using longest text to define tab length Internal Members: \> Ond\v{r}ej Lhot\a'ak \\ \> Associate Professor, School of Computer Science, \\ \>University of Waterloo \\ \\ \> Gregor Richards \\ \> Assistant Professor, School of Computer Science, \\ \> University of Waterloo \\ \end{tabbing} \bigskip \noindent \begin{tabbing} Internal-External Member: \= \kill % using longest text to define tab length Internal-External Member: \> Werner Dietl \\ \> Assistant Professor, Electrical and Computer Engineering, \\ \> 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 % 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. \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 C programming language has been an important software development tool for decades. \CFA{} is a new programming language designed with strong backwards-compatibility to take advantage of widely distributed C programming expertise and the large deployed base of C code, paired with modern language features to improve developer productivity. This thesis presents a number of improvements to \CFA{}. The author has developed one major new language feature, generic types, in a way that integrates naturally with both the existing polymorphism features of \CFA{} and the translation-unit-based encapsulation model of C. This thesis also presents a number of smaller refinements to the \CFA{} overload resolution rules, each of which improves the expressivity or intuitive nature of the language. This thesis also includes a number of practical improvements to \CFA{} compilation performance, focused on the expression resolution pass, which is the main bottleneck. These include better algorithms for argument-parameter matching and type assertion satisfaction, as well as a new type-environment data-structure based on a novel variant of union-find. The compilation performance improvements have all been experimentally validated with a new prototype system that encapsulates the key aspects of the \CFA{} language; this prototype is a promising basis for future research and a technical contribution of this work. \CFA{}, extended and refined in this thesis, presents both an independently interesting combination of language features and a comprehensive approach to the modernization of C. This work demonstrates the hitherto unproven compiler-implementation viability of the \CFA{} language design, and provides a number of useful tools to implementors of other languages. \cleardoublepage % A C K N O W L E D G E M E N T S % ------------------------------- \begin{center}\textbf{Acknowledgements}\end{center} Though a doctoral thesis is an individual project, I could not have completed it without the help and support of many members of my community. This thesis would not exist in the form it does without the mentorship of my advisor, Peter Buhr, who has ably led the \CFA{} team while giving me both the advantage of his decades of experience and the freedom to follow my own interests. My work on \CFA{} does not exist in a vacuum, and it has been a pleasure and a privilege to collaborate with the members of the \CFA{} team: Andrew Beach, Richard Bilson, Michael Brooks, Bryan Chan, Thierry Delisle, Glen Ditchfield, Brice Dobry, Rob Schluntz, and others. I gratefully acknowledge the financial support of the National Science and Engineering Council of Canada and Huawei Ltd.\ for this project. I would also like to thank of my thesis committee, Werner Dietl, Doug Lea, Ond\v{r}ej Lhot\a'ak, and Gregor Richards, for the time and effort they have invested in providing constructive feedback to refine this work. I am indebted to Peter van Beek and Ian Munro for their algorithmic expertise and willingness to share their time with me. I have far too many colleagues in the Programming Languages Group and School of Computer Science to name, but I deeply appreciate their camaraderie; specifically with regard to the production of this thesis, I would like to thank Nathan Fish for recommending my writing soundtrack, and Sharon Choy for her unfailing supply of encouraging rabbit animations. Finally, to all my friends and family who have supported me and made Kitchener-Waterloo home these past seven years, thank you, I could not have done it without you; most especially, Christina Moss, you are the best of wives and best of women, your support has kept me going through the ups and downs of research, and your partnership is key to all my successes. \cleardoublepage % D E D I C A T I O N % ------------------- % \begin{center}\textbf{Dedication}\end{center} % To Christina, who has spent too many hours politely listening to me work out the technical minutiae of this thesis, I love you, and I won't make you read it. % \cleardoublepage % 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 T A B L E S % --------------------------- \addcontentsline{toc}{chapter}{List of Tables} \listoftables \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 % GLOSSARIES (Lists of definitions, abbreviations, symbols, etc. provided by the glossaries-extra package) % ----------------------------- % \printglossaries % \cleardoublepage % \phantomsection % allows hyperref to link to the correct page % Change page numbering back to Arabic numerals \pagenumbering{arabic}