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.

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

Giovanni Ciatto;Roberta Calegari;Enrico Denti;Andrea Omicini
2020

Abstract

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.
WOA 2020 – Proceedings of the 21st Workshop "From Objects to Agents"
219
236
Giovanni Ciatto, Roberta Calegari, Enrico Siboni, Enrico Denti, Andrea Omicini
File in questo prodotto:
File Dimensione Formato  
paper14.pdf

accesso aperto

Descrizione: PDF editoriale
Tipo: Versione (PDF) editoriale
Licenza: Licenza per Accesso Aperto. Creative Commons Attribuzione (CCBY)
Dimensione 1.32 MB
Formato Adobe PDF
1.32 MB Adobe PDF Visualizza/Apri

I documenti in IRIS sono protetti da copyright e tutti i diritti sono riservati, salvo diversa indicazione.

Utilizza questo identificativo per citare o creare un link a questo documento: https://hdl.handle.net/11585/781391
Citazioni
  • ???jsp.display-item.citation.pmc??? ND
  • Scopus 6
  • ???jsp.display-item.citation.isi??? ND
social impact