|Title||Execution and Analysis of Prolog Programs in Java|
Prolog is a declarative programming language created in the early seventies. The computational model behind Prolog is based on the Horn clause formalism of first order logic.
In this thesis the construction of an analysis and execution framework for Prolog programs created in Java is presented. The base of this framework is built by a parser for Prolog. The parser provides support for metaprogramming and dynamic modifications to the grammar by supporting the definition of new and the redefinition of existing operators at runtime. At the same time the parser was implemented following object oriented principles and best practices in parser implementation to provide a fully typed abstract syntax tree of the parsing results used in the subsequent analysis and evaluation steps.
The construction of the components used to provide the execution and analysis tools based on the results of the parser is presented. Building on a concept of chained steps and the use of visitors the creation of a runtime for Prolog programs based on the abstract syntax tree produced by the parser will be shown. The implementation of the functionality required in each execution step, such as storing information in the internal database, extracting information from the abstract syntax tree, executing built-in predicates or creating graphical analysis tools and the resolution and unification algorithms will be described.
A set of analysis tools is presented in this thesis, showing their usage. Provided analysis modules allow to create graphical representations of the abstract syntax tree constructed by the parser, to create graphic representations of the module structure of complex programs, perform refactoring on source code, etc.
Also a description of how the framework can be extended with custom built-ins or analysis modules is given. The framework also provides a large set of unit tests and test helpers, which allow to safely extend and modify it.
|Advised by||Michael Leuschel|