A Construct-Based Evaluation of Kotlin-to-Swift and Swift-to-Kotlin Transpilers
Abschlussarbeit (Master)
Zusammenfassung
With Google’s Android and Apple’s iOS holding almost the entire market share for mobile operating systems, third-party app developers should address both platforms for reaching the most users possible. For developing natively, a platform-specific software development kit and a certain programming language is required. However, since no language can be used for both platforms, it is impossible to directly share code. Transpilers translating between the platform-specific languages offer the opportunity for cross-platform development while leveraging the advantages of programming natively. In order to gain insight into the current state of the art, this thesis evaluates such transpilers for Kotlin and Swift, the primary programming languages of Android and iOS respectively. Gryphon (Swift-to-Kotlin), Kotlift (Kotlin-to-Swift), SequalsK (both directions) and SwiftKotlin (Swift-to-Kotlin) were therefore examined w.r.t. their support of a set of basic constructs, taken from the overview chapters of the Kotlin and Swift documentations. In addition to the mere support of a construct, the readability of the output code was also examined by assessing it both manually and with a linter based on acknowledged style guidelines for that language. W.r.t. construct support, Gryphon's and SequalsK's good coverage classified them as the most mature for the Swift-to-Kotlin translation direction, while SwiftKotlin showed only satisfactory results. For the Kotlin-to-Swift translation direction, SequalsK achieved good coverage of the constructs, while Kotlift's results were merely sufficient. Ultimately, all transpilers generally respected the output language's style guidelines. The results on construct support were given more practical relevance by also considering the occurrence of a transpiler’s unsupported constructs in open-source app projects. Therefore, an assumption could be made about the effort required to manually correct a transpiler's output code. In the presented thesis, this effort is quantified by the score W, ranging from 0 to 1, with 0 being the worst possible score and 1 being the best possible score. Ultimately, SequalsK proved to be far more applicable than Kotlift, scoring a value of 0.964 for W while Kotlift only achieved 0.013. Regarding the Swift-to-Kotlin transpilers, Gryphon achieved a W score of 0.680 and SequalsK of 0.622, while SwiftKotlin scored last with a value of 0.263 for W.
Titelzusatz / Titel übersetzt
Eine konstrukt-basierte Evaluation von Kotlin-zu-Swift und Swift-zu-Kotlin Transpilern
Schlagworte
Transpiler, Transcompiler, Swift, Kotlin, Language Processing
Umfang
VIII, 108 S.
Link zur Veröffentlichung
Sammlungen