Enumerated Types in C∀

dc.contributor.authorLiang, Jiada
dc.date.accessioned2024-09-23T20:03:08Z
dc.date.available2024-09-23T20:03:08Z
dc.date.issued2024-09-23
dc.date.submitted2024-09-18
dc.description.abstractAn enumeration is a type defining a (ordered) set of named constant values. enum Week { Mon, Tue, Wed, Thu, Fri, Sat, Sun }; enum Math { PI = 3.14159, Tau = 6.28318, Phi = 1.61803 }; enum RGB { Red = 100b, Green = 010b, Blue = 001b }; 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. Thereafter, associating a name to a different value automatically distributes this rebinding, preventing errors. One of the key properties of an enumeration is the ability to enumerate (iterate) through the constants, and hence, access their values, if present. C restricts an enumeration to the integral type signed int, while C++ extends enumerations to all integral types, meaning enumeration names must bind to integer constants. Other modern programming languages provide bindings to any type and additional features to extend enumeration capabilities for better software engineering practices. The C∀ (C-for-all) programming language is an evolutionary refinement of the C programming language. One of its distinctive features is a parametric-polymorphic generic type. However, legacy data types from C, such as enumerations, do not adapt well to the C∀ generic type system. This thesis extends the simple and unsafe enumeration type in the C programming language into a complex and safe enumeration type in the C∀ programming-language, while maintaining backwards compatibility with C. The major contribution is an adaptation of enumerated types with the C∀ type-system in a way that integrates naturally with the generic types. This thesis also presents several smaller refinements to the C∀ overload resolution rules for enumerated types, each of which improves the intuitive nature of enumeration name resolution by the compiler. Finally, this work adds other useful features to enumerations that better support software engineering practices and simplify program development.
dc.identifier.urihttps://hdl.handle.net/10012/21067
dc.language.isoen
dc.pendingfalse
dc.publisherUniversity of Waterlooen
dc.subjectprogramming languages
dc.subjectlanguage design
dc.subjectlanguage implementation
dc.subjectenumerated types
dc.titleEnumerated Types in C∀
dc.typeMaster Thesis
uws-etd.degreeMaster of Mathematics
uws-etd.degree.departmentDavid R. Cheriton School of Computer Science
uws-etd.degree.disciplineComputer Science
uws-etd.degree.grantorUniversity of Waterlooen
uws-etd.embargo.terms0
uws.contributor.advisorBuhr, Peter
uws.contributor.affiliation1Faculty of Mathematics
uws.peerReviewStatusUnrevieweden
uws.published.cityWaterlooen
uws.published.countryCanadaen
uws.published.provinceOntarioen
uws.scholarLevelGraduateen
uws.typeOfResourceTexten

Files

Original bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
Liang_Jiada.pdf
Size:
658.62 KB
Format:
Adobe Portable Document Format

License bundle

Now showing 1 - 1 of 1
No Thumbnail Available
Name:
license.txt
Size:
6.4 KB
Format:
Item-specific license agreed upon to submission
Description: