ger: Obwohl Microsoft Office derzeit das am häufigsten verwendete Office-Paket ist, wechseln immer mehr Personen zu alternativen Programmen wie Apache OpenOffice oder LibreOffice, um Lizenzgebühren zu sparen. Während die Datenformate für Dokumente häufig von diesen alternativen Office-Paketen unterstützt werden, können die Makros, welche die Durchführung von komplexen Operationen auf den Daten der Dokumente ermöglichen, nicht automatisch wiederverwendet werden. Der in VBA verfasste Quellcode der Makros muss in Code für die Sprache StarBasic, welche von OpenOffice und LibreOffice verwendet wird, übersetzt werden. Diese manuelle Übersetzung erfordert somit Aufwand und Zeit, was wiederum hohe Kosten verursachen kann. Diese Arbeit legt den Fokus auf die Implementierung eines Transpilers, welcher Code für Makros von Microsoft Excel in Quellcode für ein anderes Tabellenkalkulationsprogramm übersetzt. Es wird zudem überprüft, ob eine automatisierte Übersetzung zweier ähnlicher Programmiersprachen ohne weiterer manueller Schritte möglich ist. Es werden Unterschiede dieser beiden BASIC-Dialekte bezüglich Syntax und Semantik untersucht. Mögliche Lösungen für fehlende Features, welche für eine vollständige Portierung des Codes in die Zielsprache notwendig sind, werden evaluiert. Zudem werden die Unterschiede der APIs erwähnt, die den Zugriff auf Elemente der Dokumente ermöglichen. Ansätze zur Behebung dieser Unterschiede werden auf deren Umsetzbarkeit geprüft. Basierend auf diesen Erkenntnissen wird ein Parser-Tool zur Generierung des Quellcodes der Zielsprache implementiert. Dieser Parser wird anschließend in ein Batch-Skript integriert, welches alle notwendigen Operationen für eine automatisierte Übersetzung durchführt. Zusätzlich werden mehrere Iterationen von Tests durchgeführt, um die Qualität des Transpilers zu verbessern. Diese Tests haben gezeigt, dass die fehlenden Features der Ausgangssprache erfolgreich ersetzt werden konnten. Jedoch ist der Ansatz zum Ersetzen der API fehlerbehaftet und der Transpiler dadurch nicht vollständig kompatibel. eng: Although Microsoft Office is currently the most commonly used office suite, an increasing number of users are switching to alternative programs like Apache OpenOffice or LibreOffice to save expensive license fees. While the data formats for documents are often supported by these alternative suites, the macros used to perform complex operations on the data provided in the documents cannot be reused automatically. The source code written in Microsoft’s VBA needs to be ported to StarBasic which is used by OpenOffice and LibreOffice. Therefore, this manual code translation requires time and effort which can be costly. This thesis focuses on the implementation of a transpiler which translates code for macros of Microsoft’s Excel into source code for another spreadsheet application. It also verifies whether an automated translation without further human interaction of two similar programming languages is possible. Differences in syntax and semantics between these BASIC dialects are investigated. Possible solutions for missing features which are required for a full porting of the code into the target language are evaluated. Furthermore, the differences of the APIs which are responsible for accessing elements of the spreadsheet documents are mentioned. Approaches to fix these differences are evaluated regarding their practicability. Based on these findings a parser tool to generate the target source code is implemented. This parser is then integrated into a batch script which performs the operations necessary for the automated translation. Additionally, multiple iterations of tests are performed to improve the quality of the transpiler. These tests show that the missing language features of the source language are replaced successfully. However the approach of replacing the API is errorprone and not fully compatible.
|