Typová inference a polymorfismus pro jazyk C
Type inference and polymorphism for C
bakalářská práce (OBHÁJENO)
Zobrazit/ otevřít
Trvalý odkaz
http://hdl.handle.net/20.500.11956/121006Identifikátory
SIS: 217818
Kolekce
- Kvalifikační práce [10932]
Autor
Vedoucí práce
Oponent práce
Šefl, Vít
Fakulta / součást
Matematicko-fyzikální fakulta
Obor
Obecná informatika
Katedra / ústav / klinika
Katedra softwarového inženýrství
Datum obhajoby
14. 9. 2020
Nakladatel
Univerzita Karlova, Matematicko-fyzikální fakultaJazyk
Čeština
Známka
Dobře
Klíčová slova (česky)
překladače, programovací jazyky, typové systémyKlíčová slova (anglicky)
compilers, programming languages, type systemsJazyk C, i přes své stáří, stále patří mezi přední jazyky programování počítačových systémů. Jeho ceněnou přednosti je, že uživateli poskytuje takřka úplnou kontrolu nad správou paměti a nad prováděnými výpočty. C však snáší kritiku za to, že v něm chybí prvky umožňující generické programování, což se v C kompenzuje používáním preprocesorových maker, což zvyšuje náchylnost na uživatelské chyby. Tento problém již řeší jazyk C++ už od počátků svého vývoje, ale spousta vývojářů počítačových systémů jej odmítá pro jeho komplexitu a netranspar- entnost kódu. Předkládáme tedy návrh na jednodušší řešení užitím typového systému Hindley-Milner. Toto řešení pak jen za drobých úprav syntaxe jazyka C poskytne mnohem vyšší expresivitu jazyka. 1
The C language, despite its age, is one of the main languages in systems development. It is valued for giving the user almost complete control over the memory management and the computations the program written in it performs. However, a large portion of criticism of C arises from the lack of generic programming features. C compensates that by utilizing preprocessor macros, which are prone to user errors. This problem has been addressed in the early stages of the development of the C++ language, but many systems developers refuse C++ because of its complexity and non-transparency of the code. We propose a simpler solution by applying the Hindley-Milner type sys- tem extended by Haskell type classes and type constructors. We will show that this approach is viable even with minimal changes to the syntax of C, but giving it much higher expressiveness. 1