Download Psaltis, Panayiotis (ACS) - School of Computer Science

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
TRANSLATING BETWEEN
OBJECT-ORIENTED
LANGUAGES
A DISSERTATION SUBMITTED TO THE UNIVERSITY OF
MANCHESTER FOR THE DEGREE OF MASTER OF SCIENCE
IN THE FACULTY OF ENGINEERING AND PHYSICAL
SCIENCES
-2015-
By
Panayiotis Psaltis
School of Computer Science
Abstract
In this project, we develop an extension of the Java2python translation tool which provides
translation between two of the most widely used languages in programming: the Java language
and the Python language. An important characteristic of this translator tool is its design.
Java2python tool, is an open source community-based project, which was developed through
the years by the GitHub community.
Despite the Java features that have been included by the community, the Java2python does not
handle various collection types. Collections are abstractions which provide containers for
storing elements. Java and Python have multiple data types to represent collections according
to the use. Collection management occurs through methods and iterators. Methods are lines of
code that provide specific functionalities whereas iterators are objects that traverse through
collections.
There are three forms of data types used to represent collection, those based upon List data
types, Hashing data types and Link data types. Therefore, the extension we develop, deals
with one data type in each of these categories to show how we may translate collections
between the two programming languages. To achieve the translation, the Java2python uses the
Another Tool for Language Recognition (ANTLR) parser generator. ANTLR is used in
lexer/lexical analysis, parser/syntax analysis and abstract syntax trees.
The extended translator was evaluated, both in terms of its correctness and performance. The
correctness of the generated Python file compare to the input Java file was asserted along with
an evaluation of the performance of each collection type translation in terms of execution time
in regards on the lines of code.
Keywords: [Java, Python, Object-oriented, grammar, lexer, parser, abstract syntax tree,
translation, collections, data-types, data-structures, methods, iterator, ArrayList, HashMap,
HashSet, List, Dictionary, Set, LinkedList].
P a g e 9 | 93