APICe » Publications » Integrating Java and Prolog through Generic Methods and Type Inference

Integrating Java and Prolog through Generic Methods and Type Inference

Maurizio Cimadamore, Mirko Viroli
P@J is a framework, based on the tuProlog open-source engine, allowing Prolog code to be used as possible implementation of a Java method: Java annotations are used for specifying all the necessary information to fill the Java-Prolog gap. This framework is useful to inject a declarative, logic-based paradigm into mainstream ob ject-oriented programming, so as to easily code functionalities related to automatic reasoning, adaptivity, and conciseness in expressing algorithms.

In this paper, an extension of P@J is presented which improves the invocation technique for such Prolog-implemented methods. Java type inference of generic method calls is intensively used to automatically infer all the necessary paradigm mismatch information: this results in an elegant and concise invocation style, which further reduces the gap between Prolog goal satisfaction and Java method invocation. This new approach inspires some interesting applications: we show examples related to the implementation of abstract data types and parsers for context-free grammars.

Keywords: Generics, Java, Multiparadigm, Prolog, Wildcards
23th ACM Symposium on Applied Computing (SAC 2008), pages 198-205, 16-20 March 2008.
Roger L. Wainwright, Hisham M. Haddad, Ronaldo Menezes, Mirko Viroli (eds.), ACM, Fortaleza, CearĂ¡, Brazil
Special Track on Programming Languages
	Address = {Fortaleza, Cear{\'a}, Brazil},
	Author = {Cimadamore, Maurizio and Viroli, Mirko},
	Booktitle = {23th ACM Symposium on Applied Computing (SAC 2008)},
	Doi = {10.1145/1363686.1363740},
	Editor = {Wainwright, Roger L. and Haddad, Hisham M. and Menezes, Ronaldo and Viroli, Mirko},
	Isbn = {978-1-59593-753-7},
	Keywords = {Generics, Java, Multiparadigm, Prolog, Wildcards},
	Month = {16--20~} # mar,
	Note = {Special Track on Programming Languages},
	Pages = {198--205},
	Publisher = {ACM},
	Title = {Integrating {J}ava and {P}rolog through Generic Methods and Type Inference},
	Volume = 1,
	Year = 2008}