Abstract [eng] |
Tools for transforming tree-like data structures are used for solving a range of different problems, such as creation of compilers, code optimizers, documentation and code generation tools, etc. But none of these existing tools seem to be specialized in transforming abstract syntax trees to a language-independent format or from it. This master‘s thesis describes a system that takes concrete abstract syntax trees (ASTs that represent the structure of code written in a real programming language, such a C#, Java, Ruby, etc.) and transforms them into language-independent abstract syntax trees, and vice versa. Rules for mapping one AST to the other are defined in XML-based configuration files that have a simple and clear structure. The system can be used as a stand-alone tool or used as component in third party software. Both the system’s core libraries and tools are written in Java. The purpose of the system’s investigation was to prove two things: that the system can correctly transform a given specific AST to an equivalent generic AST, and vise versa; and that the transformation execution time is within an acceptable range. Both goals were met. This led to a conclusion that the system is a suitable candidate for use by third party tools that handle code migration, refactoring, model transformation and other types of similar tasks. |