This file is part of Logtalk https://logtalk.org/
SPDX-FileCopyrightText: 1998-2025 Paulo Moura [email protected]
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Install Logtalk by using either the installer
provided for your operating-system or by following the manual installation
instructions in the INSTALL.md
file. An alternative to installing
Logtalk (and backend and tools dependencies) locally in your system is to use one
of the Docker images available from the Docker Hub.
On POSIX operating-systems, the following shell scripts are installed by default for running Logtalk with the supported backend Prolog compilers (which must be installed and up-to-date before running these scripts):
- B-Prolog:
bplgt
(experimental) - Ciao Prolog:
ciaolgt
(experimental; first run may requiresudo
) - CxProlog:
cxlgt
- ECLiPSe:
eclipselgt
- GNU Prolog:
gplgt
- JIProlog:
jiplgt
(first run may requiresudo
) - Quintus Prolog:
quintuslgt
(experimental) - SICStus Prolog:
sicstuslgt
- SWI-Prolog:
swilgt
- Tau Prolog:
taulgt
- Trealla Prolog:
tplgt
- XSB:
xsblgt
(first run may requiresudo
) - XVM:
xvmlgt
- YAP:
yaplgt
Man pages for all scripts are also provided on POSIX systems. HTML versions of the man pages are available in the Logtalk website.
On macOS systems, /opt/local/bin
must be in your PATH
to run the scripts
when using the provided installer. Terminal command files for running Logtalk
with selected backend Prolog compilers are also available on the Logtalk
installation folder (by default, /opt/local/share/logtalk/scripts/macos/command_files
).
For easy access, the installer creates an alias to the Logtalk folder in
the Applications folder.
On Windows systems, shortcuts for running Logtalk with selected backend
Prolog compilers are created in the Start Menu/Programs/Logtalk
menu.
The first run of the JIProlog and XSB integration shortcuts may require
administrator privileges depending on the JIProlog and XSB installation
(right-click on the shortcut and select the "Run as administrator" option).
PowerShell versions of the scripts listed above are also available (e.g.,
gplgt.ps1
). PowerShell 7.3 or later version is required for running
these scripts.
If you get an unexpected failure when using one of the Prolog integration
scripts or shortcuts, consult the adapters/NOTES.md
file in the Logtalk installation folder for compatibility notes. For the
integration scripts, see also the integration script man
page.
For a quick overview of some of the main Logtalk concepts, see the
at Learn X in Y minutes Where X=Logtalk
tutorial. See also the bundled Handbook
by opening the ~/logtalk/manuals/index.html
file with a web browser (the
~/logtalk
directory is created when you run Logtalk for the first time). The
Installing Logtalk and
Writing and running applications
sections in the User Manual will provide you with a basic understanding of how
to start Logtalk as well as how to compile and load Logtalk code.
Start Logtalk and call the goal {help(loader)}
followed by help::help
.
This will provide you with an overview of how to get help and how to load
and debug your code.
Start Logtalk and call the goal {tutor(loader)}
. The tutor
tool will
augment compiler errors and warnings with explanations and suggestions on
how to solve the reported problems.
From within a source file, use the goal logtalk_load(<name>(loader))
. For
example, logtalk_load(optionals(loader))
. At the top-level interpreter, a
{<name>(loader)}
shortcut is available. For example, {debugger(loader)}
.
You may now try some examples. The examples/NOTES.md
file contains a brief description of each example. The
learning guide includes a suggested
walkthrough.
-
Select an example and open its directory.
-
Read the example
NOTES.md
file for a description of the example. -
Open the
SCRIPT.txt
file for instructions on how to load the example and for sample queries that you may try by copying and pasting them to your Prolog interpreter top-level.
Ready to start writing your own programs?
-
Read the Handbook sections on "Writing and running applications" and "Debugging". If you want to use your Prolog backend resources, read also the section on "Prolog integration and migration".
-
Take a look at the
coding
directory. There you will find syntax support files for popular text editors that enable syntax coloring and other text services when editing Logtalk source files. There's also support for syntax highlighters used for publishing source code and for source code versioning systems. -
The
tools
directory contains a comprehensive set of developer tools to help you test, debug, analyze, and document your applications. -
Create a directory (preferably outside of your Logtalk user folder, which is updated when you update Logtalk) with a suitable name to hold all the files of your application.
-
Copy or rename the
settings-sample.lgt
file tosettings.lgt
, and modify it to preload developer tools (e.g., thehelp
anddebugger
tools), to define library aliases for your applications, to define default compiler flags, and more (see the comments in the file itself and theCUSTOMIZE.md
file for details). -
Copy to your application directory the
loader-sample.lgt
file, rename it toloader.lgt
, and modify it to load your application source files. You may also copy thetester-sample.lgt
andtests-sample.lgt
files, renaming them totester.lgt
andtests.lgt
, and editing them to define and run your application unit tests. -
Have fun!