X-Prolog is a lightweight Prolog implementation intended to facilitate programming in logic on Android. This app runs Prolog programs in a console view or as a bound service to a client app. A sample client is available at https://github.com/xprolog/sample-client.
Prolog programs may be developed using any main-stream Prolog system, including SICStus, SWI-Prolog, YAP, etc. The advantage of using X-Prolog is the ability to export programs in a quick-load format.
Code snippets may be shared with X-Prolog app. A shared snippet is either consulted into a running meta-interpreter or run as a standalone program.
A program may be associated with a run configuration, which describes how the program is run, including the top-level goal and whether the program is thread-safe.
A thread-safe program runs in a console view on first launch like any other program; however, any subsequent launch of the program runs in a terminal view, sharing the database of the console view.
X-Prolog benefited from works by Richard O'Keefe, Jan Wielemaker, Jack Palevich and others.
Known issues include occurs check, logical-update view, module-sensitive built-ins and so forth.
Got Tool? The app depends on user-defined tools for editing and building projects. The tools are written in Prolog and are visible on devices with developer options. The app and tools exchange data through transfer variables and formatted output. This app release includes trivial tools intended to demonstrate the app's tooling feature.
The app defines extension points at which transfer variables are available (to tools) and formatted output (from tools) is recognized. A tool may be configured to contribute to one or more extension points by specifying a context term.
A context term is read-term of the form context(Name, FileTypes, Priority), where Name is the name of an extension point, FileTypes is a list of acceptable file types and Priority is an integer not less than zero, the effective meaning of which varies depending on the extension point.
This release defines three extension points: build, edit and reconcile, which allow tools to contribute to, respectively, building projects, editing source files and reconciling source models.
To build a project, open a file in the top directory of the project and select menu option Build. To export the project into a runnable object file on the local file system, select menu option Export. To run the object file, select menu option Run.
A file is considered source-file if there exists one or more tools that build the file, possibly transforming it into another source file.
This release includes three build tools: Compile, Expand and Test. Compile translates a Prolog source file (.pl) into a quick-load file (.ql). Expand translates a definite-clause grammar file (.dcg) into a Prolog source file. Test runs unit and integration tests contained in designated files (.plt).