Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Executing prolog code on an iPhone

I currently have the need to execute prolog code in an application I am making. I am aware that Apple probably never would allow something like this in the App Store, but that is not the intention either. This is more a private project that will never reach the App Store.

Purpose

In this case prolog is used to describe an object (like for example a telephone) and its properties. The object will be drawn with OpenGL using coordinates specified in the prolog script. The reason for using prolog is that I need the ability to query the program about some of the features this object has, and prolog eases this a lot. Bottom line: I "need" to query a prolog script from my app.

Possible solutions

  • Embed an already existing implementation written in C. I am unsure if this will even work.
  • Execute the prolog code on another machine and use the network to query prolog.
  • It seems that it is possible to run some sort Ruby VM inside the app (shinycocos uses this as far as I understand), could this be used to run one of the Ruby Prolog implementations?
  • Find some alternative to Prolog. This needs to give me some of the same possibilities I get with prolog.

Sadly, google gives me close to no results at all, so I have a feeling that I might be quite alone on this project. If anyone have any experience or clue at all, I would be very thankful.

like image 698
Bendik Avatar asked Oct 11 '10 10:10

Bendik


People also ask

How do I run the Prolog program in SWI-Prolog?

Open a terminal (Ctrl+Alt+T) and navigate to the directory where you stored your program. Open SWI-Prolog by invoking swipl . In SWI-Prolog, type [program] to load the program, i.e. the file name in brackets, but without the ending. In order to query the loaded program, type goals and watch the output.

Which software platforms can be used for Prolog?

SWI-Prolog runs on Unix, Windows, Macintosh and Linux platforms.

Is SWI-Prolog a compiler?

Online Prolog (swi) compiler.


1 Answers

Having faced similar difficulties calling prolog code, albeit in a different situation, I'd recommend checking out the castor c++ library. This allows you to write logic paradigm code in native c++ without needing to extend the language at all. As castor is a header only library it is easy to compile wherever c++ is available.
Castor website: http://www.mpprogramming.com/cpp/default.aspx

like image 53
shuttle87 Avatar answered Oct 21 '22 04:10

shuttle87