2P-Kt: logic programming with objects & functions in Kotlin

Last modified by Andrea Omicini on 2020/11/24 09:05

Giovanni Ciatto, Roberta Calegari, Enrico Siboni, Enrico Denti, Andrea Omicini

Mainstream programming languages nowadays tends to be more and more multi-paradigm ones, by integrating diverse programming paradigms—e.g., object-oriented programming (OOP) and functional programming (FP). Logic-programming (LP) is a successful paradigm that has contributed to many relevant results in the areas of symbolic AI and multi-agent systems, among the others. Whereas Prolog, the most successful LP language, is typically integrated with mainstream languages via foreign language interfaces, in this paper we propose an alternative approach based on the notion of domain-specific language (DSL), which makes LP available to OOP programmers straightforwardly within their OO language of choice. In particular, we present a Kotlin DSL for Prolog, showing how the Kotlin multi-paradigm (OOP + FP) language can be enriched with LP in a straightforward and effective way. Since it is based on the interoperable 2P-Kt project, our technique also enables the creation of similar DSL on top of other high-level languages such as Scala or JavaScript—thus paving the way towards a more general adoption of LP in general-purpose programming environments.

(keywords) object-oriented programming, multi-paradigm languages, domain-specific languages, Kotlin
WOA 2020 – 21th Workshop “From Objects to Agents", CEUR Workshop Proceedings (AI*IA Series) 2706, pages 219–236, October 2020.
Roberta Calegari, Giovanni Ciatto, Enrico Denti, Andrea Omicini, Giovanni Sartor (eds.), Sun SITE Central Europe, RWTH Aachen University, Aachen, Germany
21st Workshop “From Objects to Agents" (WOA 2020), Bologna, Italy, 14–16 September 2020. Proceedings
address = {Aachen, Germany},
author = {Ciatto, Giovanni and Calegari, Roberta and Siboni, Enrico and Denti, Enrico and Omicini, Andrea},
booktitle = {WOA 2020 -- 21th Workshop ``From Objects to Agents''},
editor = {Calegari, Roberta and Ciatto, Giovanni and Denti, Enrico and Omicini, Andrea and Sartor, Giovanni},
keywords = {object-oriented program-ming, multi-paradigm languages, domain-specific languages, Kotlin},
iris-id = {11585/781391},
location = {Bologna, Italy},
month = oct,
note = {21st Workshop ``From Objects to Agents'' (WOA 2020), Bologna, Italy, 14--16~} # sep # {~2020. Proceedings},
pages = {219--236},
publisher = {Sun SITE Central Europe, RWTH Aachen University},
scopus-id = {2-s2.0-85095597762},
series = {CEUR Workshop Proceedings},
subseries = {AI*IA Series},
title = {{\sc {2P-Kt}}: logic programming with objects \& functions in Kotlin},
url = {http://ceur-ws.org/Vol-2706/paper14.pdf},
url-pdf = {http://ceur-ws.org/Vol-2706/paper14.pdf},
volume = 2706,
year = 2020}



2011 © aliCE Research Group @ DEIS, Alma Mater Studiorum-Università di Bologna