Original title:
Kompilace generátorů dynamického jazyka PHP do MSIL
Translated title:
Kompilace generátorů dynamického jazyka PHP do MSIL
Authors:
Houška, Petr ; Míšek, Jakub (advisor) ; Ježek, Pavel (referee) Document type: Bachelor's theses
Year:
2017
Language:
eng Abstract:
[eng][cze] The goal of this thesis is to design and implement the support for generators within the Peachpie framework, a PHP to CIL compiler. Generators are the simplest form of methods that resume from the same state in which they returned earlier when called repeatedly. The reference PHP interpreter Zend engine supports generators natively. Due to that fact that generators in PHP support a number of features that are not common in other languages. CIL, on the other hand, does not have a native support for generators. Therefore, languages built on top of CIL (e.g. C#, F#) have to implement them by other means, such as by rewriting the original generator methods into state machines. In this thesis, we will design and implement the support for generators through semantic tree transformations. All this is handled with the intention of keeping the maximum possible compatibility with reference PHP generators. We will also make a comparison to generators in C#, whose main implementation also uses CIL as a backend. 1Cílem této práce je navrhnout a implementovat podporu pro generátory v rámci Peachpie projektu, kompilátoru z PHP do CIL. Generátory jsou nejjednodušší formou metod, které při opětovném zavolání pokračují ze stejného stavu, ve kterém dříve skončily. Referenční interpretr jazyka PHP Zend Engine podporuje generátory nativně. Nejen kvůli tomu jsou generátory v PHP poměrně silné a umožňují například přerušení vykonávání prakticky na jakémkoliv místě. CIL naopak přímou pod- poru pro generátory nemá, jazyky nad ním postavené (např. C# či F#) je tedy musí implementovat kupříkladu přepisem generátorových metod na stavové au- tomaty. V práci rozebereme návrh a následnou implementaci generátorů pomocí trans- formace sémantického stromu a konkrétní CIL reprezentaci případných nových sémantických objektů s cílem zachovat maximální možnou kompatibilitu se sémantikou PHP generátorů. Také je srovnáme s generátory v jazyce C#, jehož hlavní im- plementace je taktéž postavena nad CIL. 1
Keywords:
compiler,php,msil,.net,roslyn,dynamic language; kompilátor,php,msil,.net,roslyn,dynamické jazyky
Institution: Charles University Faculties (theses)
(web)
Document availability information: Available in the Charles University Digital Repository. Original record: http://hdl.handle.net/20.500.11956/90380