A Generalized Search Construct for Imperative Languages to Facilitate Declarative Programming

James Smith, Chris Henderson, Ajay Bansal

Research output: Contribution to journalArticlepeer-review

Abstract

Search is one of the more common strategies used by problem-solving agents. For many hard problems, a backtracking search can be the most effective approach for finding a solution. Logic programming languages provide, as a core feature of the language, the mechanics for the search behind the scenes without requiring the user to specify the algorithm. However, this functionality has been generally left out of the core features of imperative programming languages. In this work, we propose integrating a search agent into an imperative programming language through a search construct in the syntax. By doing so, our intention is that the user may apply a declarative approach to problem solving. We extend the Go programming language with this search construct and develop an agent to perform the search. The algorithm behind the search is implicitly handled by the agent. We demonstrate the effectiveness of this search construct through solutions to an exhaustive search over a file-system, the NQueens problem, and the monkey and the bananas problem. To evaluate the performance of our agent, we compare its runtime performance against two of the common Prolog implementations, SWI-Prolog and GNU Prolog.

Original languageEnglish (US)
Pages (from-to)315-338
Number of pages24
JournalInternational Journal of Semantic Computing
Volume16
Issue number3
DOIs
StatePublished - Sep 1 2022
Externally publishedYes

Keywords

  • Declarative programming
  • backtracking search
  • imperative programming
  • problem-solving agent
  • search agent

ASJC Scopus subject areas

  • Software
  • Information Systems
  • Linguistics and Language
  • Computer Science Applications
  • Computer Networks and Communications
  • Artificial Intelligence

Fingerprint

Dive into the research topics of 'A Generalized Search Construct for Imperative Languages to Facilitate Declarative Programming'. Together they form a unique fingerprint.

Cite this