[18ebc28] | 1 | % T I T L E P A G E
|
---|
| 2 | % -------------------
|
---|
| 3 | % Last updated August 16, 2022, by IST-Client Services
|
---|
| 4 | % The title page is counted as page `i' but we need to suppress the
|
---|
| 5 | % page number. Also, we don't want any headers or footers.
|
---|
| 6 | \pagestyle{empty}
|
---|
| 7 | \pagenumbering{roman}
|
---|
| 8 |
|
---|
| 9 | % The contents of the title page are specified in the "titlepage"
|
---|
| 10 | % environment.
|
---|
| 11 | \begin{titlepage}
|
---|
| 12 | \begin{center}
|
---|
| 13 | \vspace*{1.0cm}
|
---|
| 14 |
|
---|
| 15 | \Huge
|
---|
| 16 | {\bf Enumerated Types in \CFA}
|
---|
| 17 |
|
---|
| 18 | \vspace*{1.0cm}
|
---|
| 19 |
|
---|
| 20 | \normalsize
|
---|
| 21 | by \\
|
---|
| 22 |
|
---|
| 23 | \vspace*{1.0cm}
|
---|
| 24 |
|
---|
| 25 | \Large
|
---|
| 26 | Jiada Liang \\
|
---|
| 27 |
|
---|
| 28 | \vspace*{3.0cm}
|
---|
| 29 |
|
---|
| 30 | \normalsize
|
---|
| 31 | A thesis \\
|
---|
[caaf424] | 32 | presented to the University of Waterloo \\
|
---|
[18ebc28] | 33 | in fulfillment of the \\
|
---|
| 34 | thesis requirement for the degree of \\
|
---|
| 35 | Master of Mathematics \\
|
---|
| 36 | in \\
|
---|
| 37 | Computer Science \\
|
---|
| 38 |
|
---|
| 39 | \vspace*{2.0cm}
|
---|
| 40 |
|
---|
| 41 | Waterloo, Ontario, Canada, \the\year \\
|
---|
| 42 |
|
---|
| 43 | \vspace*{1.0cm}
|
---|
| 44 |
|
---|
| 45 | \copyright{} Jiada Liang \the\year \\
|
---|
| 46 | \end{center}
|
---|
| 47 | \end{titlepage}
|
---|
| 48 |
|
---|
| 49 | % The rest of the front pages should contain no headers and be numbered using Roman numerals starting with `ii'
|
---|
| 50 | \pagestyle{plain}
|
---|
| 51 | \setcounter{page}{2}
|
---|
| 52 |
|
---|
| 53 | \cleardoublepage % Ends the current page and causes all figures and tables that have so far appeared in the input to be printed.
|
---|
| 54 | % In a two-sided printing style, it also makes the next page a right-hand (odd-numbered) page, producing a blank page if necessary.
|
---|
| 55 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 56 |
|
---|
| 57 | \begin{comment}
|
---|
| 58 | % E X A M I N I N G C O M M I T T E E (Required for Ph.D. theses only)
|
---|
| 59 | % Remove or comment out the lines below to remove this page
|
---|
| 60 | \addcontentsline{toc}{chapter}{Examining Committee}
|
---|
| 61 | \begin{center}\textbf{Examining Committee Membership}\end{center}
|
---|
| 62 | \noindent
|
---|
| 63 | The following served on the Examining Committee for this thesis. The decision of the Examining Committee is by majority vote.
|
---|
| 64 | \bigskip
|
---|
[caaf424] | 65 |
|
---|
[18ebc28] | 66 | \noindent
|
---|
| 67 | \begin{tabbing}
|
---|
| 68 | Internal-External Member: \= \kill % using longest text to define tab length
|
---|
[caaf424] | 69 | External Examiner: \> Bruce Bruce \\
|
---|
[18ebc28] | 70 | \> Professor, Dept. of Philosophy of Zoology, University of Wallamaloo \\
|
---|
[caaf424] | 71 | \end{tabbing}
|
---|
[18ebc28] | 72 | \bigskip
|
---|
[caaf424] | 73 |
|
---|
[18ebc28] | 74 | \noindent
|
---|
| 75 | \begin{tabbing}
|
---|
| 76 | Internal-External Member: \= \kill % using longest text to define tab length
|
---|
| 77 | Supervisor(s): \> Ann Elk \\
|
---|
| 78 | \> Professor, Dept. of Zoology, University of Waterloo \\
|
---|
| 79 | \> Andrea Anaconda \\
|
---|
| 80 | \> Professor Emeritus, Dept. of Zoology, University of Waterloo \\
|
---|
| 81 | \end{tabbing}
|
---|
| 82 | \bigskip
|
---|
[caaf424] | 83 |
|
---|
[18ebc28] | 84 | \noindent
|
---|
| 85 | \begin{tabbing}
|
---|
| 86 | Internal-External Member: \= \kill % using longest text to define tab length
|
---|
| 87 | Internal Member: \> Pamela Python \\
|
---|
| 88 | \> Professor, Dept. of Zoology, University of Waterloo \\
|
---|
| 89 | \end{tabbing}
|
---|
| 90 | \bigskip
|
---|
[caaf424] | 91 |
|
---|
[18ebc28] | 92 | \noindent
|
---|
| 93 | \begin{tabbing}
|
---|
| 94 | Internal-External Member: \= \kill % using longest text to define tab length
|
---|
| 95 | Internal-External Member: \> Meta Meta \\
|
---|
| 96 | \> Professor, Dept. of Philosophy, University of Waterloo \\
|
---|
| 97 | \end{tabbing}
|
---|
| 98 | \bigskip
|
---|
[caaf424] | 99 |
|
---|
[18ebc28] | 100 | \noindent
|
---|
| 101 | \begin{tabbing}
|
---|
| 102 | Internal-External Member: \= \kill % using longest text to define tab length
|
---|
| 103 | Other Member(s): \> Leeping Fang \\
|
---|
| 104 | \> Professor, Dept. of Fine Art, University of Waterloo \\
|
---|
| 105 | \end{tabbing}
|
---|
| 106 |
|
---|
| 107 | \cleardoublepage
|
---|
| 108 | \end{comment}
|
---|
| 109 |
|
---|
| 110 | % D E C L A R A T I O N P A G E
|
---|
| 111 | % -------------------------------
|
---|
| 112 | % The following is a sample Declaration Page as provided by the GSO
|
---|
| 113 | % December 13th, 2006. It is designed for an electronic thesis.
|
---|
| 114 | \addcontentsline{toc}{chapter}{Author's Declaration}
|
---|
| 115 | \begin{center}\textbf{Author's Declaration}\end{center}
|
---|
[caaf424] | 116 |
|
---|
[18ebc28] | 117 | \noindent
|
---|
| 118 | 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.
|
---|
| 119 |
|
---|
| 120 | \bigskip
|
---|
[caaf424] | 121 |
|
---|
[18ebc28] | 122 | \noindent
|
---|
| 123 | I understand that my thesis may be made electronically available to the public.
|
---|
| 124 |
|
---|
| 125 | \cleardoublepage
|
---|
| 126 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 127 |
|
---|
| 128 | % A B S T R A C T
|
---|
| 129 | % ---------------
|
---|
| 130 | \addcontentsline{toc}{chapter}{Abstract}
|
---|
| 131 | \begin{center}\textbf{Abstract}\end{center}
|
---|
| 132 |
|
---|
[433e2c3] | 133 | An \emph{enumeration} is a type defining a (ordered) set of named constant values.
|
---|
| 134 | \begin{cfa}
|
---|
| 135 | enum Week { Mon, Tue, Wed, Thu, Fri, Sat, Sun };
|
---|
| 136 | enum Math { PI = 3.14159, Tau = 6.28318, Phi = 1.61803 };
|
---|
| 137 | enum RGB { Red = 100b, Green = 010b, Blue = 001b };
|
---|
| 138 | \end{cfa}
|
---|
| 139 | Its purpose is for readability: replacing constant values in a program with symbolic names that are more meaningful to programmers in the context of the application.
|
---|
| 140 | Thereafter, associating a name to a different value automatically distributes this rebinding, preventing errors.
|
---|
| 141 | One of the key properties of an enumeration is the ability to enumerate (iterate) through the constants, and hence, access their values, if present.
|
---|
| 142 | C restricts an enumeration to the integral type @signed int@, while \CC extends enumerations to all integral types, meaning enumeration names must bind to integer constants.
|
---|
[ab11ab1] | 143 | Other modern programming languages provide bindings to any type and additional features to extend enumeration capabilities for better software engineering practices.
|
---|
[433e2c3] | 144 |
|
---|
[ab11ab1] | 145 | The \CFA (C-for-all) programming language is an evolutionary refinement of the C programming language.
|
---|
| 146 | One of its distinctive features is a parametric-polymorphic generic type.
|
---|
[c1c0efdb] | 147 | However, legacy data types from C, such as enumerations, do not adapt well to the \CFA generic type-system.
|
---|
[433e2c3] | 148 |
|
---|
| 149 | This thesis extends the simple and unsafe enumeration type in the C programming language into a complex and safe enumeration type in the \CFA programming-language, while maintaining backwards compatibility with C.
|
---|
| 150 | The major contribution is an adaptation of enumerated types with the \CFA type-system in a way that integrates naturally with the generic types.
|
---|
[ab11ab1] | 151 | This thesis also presents several smaller refinements to the \CFA overload resolution rules for enumerated types, each of which improves the intuitive nature of enumeration name resolution by the compiler.
|
---|
[433e2c3] | 152 | Finally, this work adds other useful features to enumerations that better support software-engineering practices and simplify program development.
|
---|
| 153 |
|
---|
[18ebc28] | 154 | \cleardoublepage
|
---|
| 155 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 156 |
|
---|
| 157 | % A C K N O W L E D G E M E N T S
|
---|
| 158 | % -------------------------------
|
---|
| 159 | \addcontentsline{toc}{chapter}{Acknowledgements}
|
---|
| 160 | \begin{center}\textbf{Acknowledgements}\end{center}
|
---|
| 161 |
|
---|
[433e2c3] | 162 | To begin, I would like to thank my supervisor Professor Peter Buhr.
|
---|
| 163 | Thank you for your guidance and support throughout my study and research.
|
---|
| 164 | I would not be here without you.
|
---|
[9476549] | 165 |
|
---|
[c329bca] | 166 | Thanks to Gregor Richards and Yizhou Zhang for reading my thesis.
|
---|
[9476549] | 167 |
|
---|
[ab11ab1] | 168 | Special thanks to Andrew James Beach for your insight on the theory development of the thesis.
|
---|
[9476549] | 169 |
|
---|
| 170 | Thanks to Michael Brooks, Fangran Yu, Colby Parsons, Thierry Delisle, Mubeen Zulifiqar,
|
---|
[ab11ab1] | 171 | and the entire \CFA team for the development of the \CFA language, making it the best language it can be.
|
---|
[18ebc28] | 172 |
|
---|
| 173 | Finally, a special thank you to Huawei Canada for funding this work.
|
---|
| 174 |
|
---|
| 175 | \cleardoublepage
|
---|
| 176 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 177 |
|
---|
| 178 | \begin{comment}
|
---|
| 179 | % D E D I C A T I O N
|
---|
| 180 | % -------------------
|
---|
| 181 | \addcontentsline{toc}{chapter}{Dedication}
|
---|
| 182 | \begin{center}\textbf{Dedication}\end{center}
|
---|
| 183 |
|
---|
| 184 | This is dedicated to the one I love.
|
---|
| 185 | \cleardoublepage
|
---|
| 186 | \end{comment}
|
---|
| 187 |
|
---|
| 188 | % T A B L E O F C O N T E N T S
|
---|
| 189 | % ---------------------------------
|
---|
| 190 | \renewcommand\contentsname{Table of Contents}
|
---|
| 191 | \tableofcontents
|
---|
| 192 | \cleardoublepage
|
---|
| 193 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 194 |
|
---|
| 195 | % L I S T O F F I G U R E S
|
---|
| 196 | % -----------------------------
|
---|
| 197 | \addcontentsline{toc}{chapter}{List of Figures}
|
---|
| 198 | \listoffigures
|
---|
| 199 | \cleardoublepage
|
---|
| 200 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 201 |
|
---|
| 202 | % L I S T O F T A B L E S
|
---|
| 203 | % ---------------------------
|
---|
| 204 | \addcontentsline{toc}{chapter}{List of Tables}
|
---|
| 205 | \listoftables
|
---|
| 206 | \cleardoublepage
|
---|
| 207 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 208 |
|
---|
[caaf424] | 209 | \begin{comment}
|
---|
[18ebc28] | 210 | % L I S T O F A B B R E V I A T I O N S
|
---|
| 211 | % ---------------------------
|
---|
| 212 | \renewcommand*{\abbreviationsname}{List of Abbreviations}
|
---|
| 213 | \printglossary[type=abbreviations]
|
---|
| 214 | \cleardoublepage
|
---|
| 215 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 216 |
|
---|
| 217 | % L I S T O F S Y M B O L S
|
---|
| 218 | % ---------------------------
|
---|
| 219 | \printglossary[type=symbols]
|
---|
| 220 | \cleardoublepage
|
---|
| 221 | \phantomsection % allows hyperref to link to the correct page
|
---|
| 222 | \end{comment}
|
---|
| 223 |
|
---|
| 224 | % Change page numbering back to Arabic numerals
|
---|
| 225 | \pagenumbering{arabic}
|
---|