Development of a PHP Compiler for Mono

  • This diploma thesis is about developing a compiler that enables building PHP applications for the development environment Mono or the compatible Microsoft .NET Framework. It contains extensive information about the compiler’s source (PHP) and target language (CIL), the translation of PHP’s language elements to CIL and the Mono Project. Besides that it explains in detail the compiler’s structure, functionality and applications. PHP is a widely-used scripting language especially suited for web development. Scripts written in PHP aren’t standalone applications, but are embedded into HTML. Syntax and semantics are similar to the programming languages C and Perl. PHP also offers modern object oriented features. A great strength is the availability of a large number of libraries which enable accessing databases, handling XML documents, dynamic image editing and much more. A recent survey indicates that PHP is used on more than 20 million domains worldwide, so it is the most widely usedThis diploma thesis is about developing a compiler that enables building PHP applications for the development environment Mono or the compatible Microsoft .NET Framework. It contains extensive information about the compiler’s source (PHP) and target language (CIL), the translation of PHP’s language elements to CIL and the Mono Project. Besides that it explains in detail the compiler’s structure, functionality and applications. PHP is a widely-used scripting language especially suited for web development. Scripts written in PHP aren’t standalone applications, but are embedded into HTML. Syntax and semantics are similar to the programming languages C and Perl. PHP also offers modern object oriented features. A great strength is the availability of a large number of libraries which enable accessing databases, handling XML documents, dynamic image editing and much more. A recent survey indicates that PHP is used on more than 20 million domains worldwide, so it is the most widely used scripting language on the internet. Mono is an open source implementation of Microsoft's .NET Framework. In contrast to its Microsoft pendant Mono isn’t just available on Windows, but also on the other common operating systems Linux, UNIX, MacOS and Solaris. This is why applications developed on Mono can be used cross platform. The main focus is on the C# language, but more and more languages such as Java and Python are being supported. Libraries can also be shared between languages. Like that Mono allows developers to choose the programming language depending on the task to be solved. The goal of this diploma thesis is making PHP available as further language on Mono. Like that lots of new possibilities will turn up. Developers can use PHP as a fully-fledged programming language for developing standalone applications outside of web pages. In order to achieve this goal a compiler is being developed which translates PHP scripts into Common Intermediate Language (CIL). CIL is a low level language, is entirely stack based and executed by Mono’s virtual machine. When performing the translation, PHP’s language elements need to be reproduced exactly using only CIL’s features. Up to now PHP hasn’t been supported by Mono. This gap shall be closed by this diploma thesis. For this purpose the author also implemented the compiler as described in the thesis. The implementation is called PHP4Mono and can be downloaded at http://php4mono.sourceforge.net.show moreshow less
  • Die vorliegende Diplomarbeit beschreibt die Entwicklung eines Compilers, der es ermöglicht, Anwendungen für die Entwicklungsplattform Mono oder das kompatible Microsoft .NET Framework in der Sprache PHP zu entwickeln. Sie enthält ausführliche Informationen über die Quellsprache (PHP) und Zielsprache (CIL) des Compilers, die Übersetzung der Sprachkonstrukte und das Mono-Projekt. Außerdem werden Aufbau, Funktionsweise und Anwendungsmöglichkeiten des Compilers detailliert erläutert. PHP ist eine beliebte und weitverbreitete Skript-Sprache, die besonders für Webentwicklung geeignet ist. In PHP geschriebene Skripte sind keine eigenständigen Anwendungen, sondern werden in HTML-Seiten eingebettet. Syntax und Semantik sind durch die Programmiersprachen C und Perl geprägt. Seit kurzem sind auch moderne objektorientierte Konzepte Bestandteil des Sprachschatzes von PHP. Eine große Stärke besteht darin, dass eine Vielzahl von Bibliotheken frei verfügbar sind, die den Zugriff auf DatenbankenDie vorliegende Diplomarbeit beschreibt die Entwicklung eines Compilers, der es ermöglicht, Anwendungen für die Entwicklungsplattform Mono oder das kompatible Microsoft .NET Framework in der Sprache PHP zu entwickeln. Sie enthält ausführliche Informationen über die Quellsprache (PHP) und Zielsprache (CIL) des Compilers, die Übersetzung der Sprachkonstrukte und das Mono-Projekt. Außerdem werden Aufbau, Funktionsweise und Anwendungsmöglichkeiten des Compilers detailliert erläutert. PHP ist eine beliebte und weitverbreitete Skript-Sprache, die besonders für Webentwicklung geeignet ist. In PHP geschriebene Skripte sind keine eigenständigen Anwendungen, sondern werden in HTML-Seiten eingebettet. Syntax und Semantik sind durch die Programmiersprachen C und Perl geprägt. Seit kurzem sind auch moderne objektorientierte Konzepte Bestandteil des Sprachschatzes von PHP. Eine große Stärke besteht darin, dass eine Vielzahl von Bibliotheken frei verfügbar sind, die den Zugriff auf Datenbanken ermöglichen oder auch das Verarbeiten von XML-Dokumenten, dynamische Bildbearbeitung und vieles mehr. Eine aktuelle Umfrage belegt, dass PHP auf über 20 Millionen Domains weltweit eingesetzt wird und somit die beliebteste Skriptsprache im Internet darstellt. Mono ist eine Open-Source-Implementierung des Microsoft .NET Framework. Im Gegensatz zum .NET Framework ist Mono allerdings nicht nur für das Betriebssystem Windows verfügbar, sondern auch für die anderen verbreiteten Betriebssysteme Linux, UNIX, MacOS und Solaris. Somit können mit Mono entwickelte Programme plattformübergreifend eingesetzt werden. Dabei unterstützt Mono nicht nur die klassische .NET-Sprache C#, sondern auch andere wichtige Sprachen wie Java oder Python. Ein Entwickler kann somit je nach Problemstellung diejenige Sprache verwenden, die ihm am geeignetsten erscheint, und dabei auch auf Bibliotheken zurückgreifen, die in anderen Sprachen geschrieben wurden. Das Ziel der Diplomarbeit besteht darin, PHP als weitere Sprache für Mono verfügbar zu machen. Auf diese Weise ergeben sich viele neue Möglichkeiten. Entwickler können PHP nicht mehr nur als Skript-Sprache für Webseiten einsetzen, sondern ebenso als vollwertige Programmiersprache für die Entwicklung eigenständiger Anwendungen. Um dies zu erreichen, wird ein Compiler entwickelt, der PHP-Skripte in eine Zwischensprache, die Common Intermediate Language (CIL) übersetzt. CIL ist eine maschinennahe Stack-basierte Sprache und wird von Monos virtueller Maschine ausgeführt. Bei dieser Übersetzung müssen die Sprachkonstrukte von PHP exakt mit den Möglichkeiten von CIL nachgebildet werden. Bislang wird PHP von Mono nicht unterstützt, was durch die vorliegende Arbeit geändert werden soll. Hierfür hat der Autor auch eine Referenzimplementierung realisiert. Sie ist unter dem Namen PHP4Mono bekannt und steht unter der Adresse http://php4mono.sourceforge.net zur freien Verfügung.show moreshow less

Download full text files

Export metadata

Statistics

Number of document requests

Additional Services

Share in Twitter Search Google Scholar
Metadaten
Author:Raphael Romeikat
URN:urn:nbn:de:bvb:384-opus4-2281
Frontdoor URLhttps://opus.bibliothek.uni-augsburg.de/opus4/282
Type:Diploma Thesis
Language:English
Publishing Institution:Universität Augsburg
Granting Institution:Universität Augsburg, Fakultät für Angewandte Informatik
Release Date:2006/07/19
GND-Keyword:Compiler; Übersetzerbau; PHP; Mono-Framework; Microsoft dot net
Note:
Unter dem Titel "A PHP Compiler for the .NET Platform. Basics, Concepts and Translation" erschienen in Saarbrücken: VDM Verlag Dr. Müller, ISBN 978-3-8364-1470-8
Institutes:Fakultät für Angewandte Informatik
Fakultät für Angewandte Informatik / Institut für Informatik
Dewey Decimal Classification:0 Informatik, Informationswissenschaft, allgemeine Werke / 00 Informatik, Wissen, Systeme / 004 Datenverarbeitung; Informatik