Original title:
Překlad podmnožiny jazyka PHP do C++
Translated title:
Translation of PHP Language Subset into C++
Authors:
Nechutný, Stanislav ; Matula, Peter (referee) ; Křivka, Zbyněk (advisor) Document type: Bachelor's theses
Year:
2016
Language:
cze Publisher:
Vysoké učení technické v Brně. Fakulta informačních technologií Abstract:
[cze][eng]
Tato práce se zaměřuje na návrh a tvorbu nástroje pro automatizovaný překlad funkcí napsaných v podmnožině jazyka PHP do C++. Vygenerovaný zdrojový kód je možno zkompilovat jako rozšíření PHP a zavést stejným způsobem jako například MySQL, PDO, GD apod. Ve výsledku je tedy možno zavolat tyto funkce z PHP, jako by se jednalo o původní interpretovanou funkci. Předpokladem je však rozdíl v rychlosti vykonávání, protože odpadá analýza zdrojových kódů, jejich interpretace, či režie způsobená správou paměti. Vytvořený nástroj provádí převod zdrojového kódu do abstraktního syntaktického stromu, staticky jej analyzuje pro určení datových typů proměnných, a následně provádí generování C++ kódu. Výsledné zrychlení pak záleží na charakteristice překládaného kódu a praktické použití je prozatím komplikované kvůli implementaci podmnožiny PHP.
My work is focused on design and execution of an automated translation for functions written in PHP into C++. Generated code may be compiled as a PHP extension and loaded the same way MySQL, PDO, GD or so. As a result these functions may be called from PHP as if they were the initial interpreted functions. Since there is no need for source code analysis, interpretation, nor staging by Garbage Collector general assumption would be a significant speed difference. Created tool executes source code transfer into abstract syntactic tree which is followed up by a static analysis of variable types and consequently generates C++ code. Final speed increase then depends on the particular code being translated and its practical use is slightly elaborate at the moment - owing to the implementation of PHP subset.
Keywords:
C++; C++11; code analysation; code generating; data type conversion; data types; expressions; extension; HHVM; HPHPc; module; optimization; PHC; PHP; PHP-CPP; precedence analysis; Test-driven development; tokens; transformation; translation; xdebug; analýza kódu; C++; C++11; datové typy; generování kódu; HHVM; HPHPc; konverze datových typů; modul; optimalizace; PHC; PHP; PHP-CPP; precedenční analýza; překlad; rozšíření; Testy řízené programování; tokeny; transformace; výrazy; xdebug
Institution: Brno University of Technology
(web)
Document availability information: Fulltext is available in the Brno University of Technology Digital Library. Original record: http://hdl.handle.net/11012/62122