Skip to main content

Loki: PDDL Parsing and Translation in C++ and Python

Loki is a C++20 library with Python bindings for parsing and translation of PDDL files. Loki separates the parsing and translation of domain and problem files, allowing users to effectively work with collection of problems.

The parser is based on the canonical parser structure proposed in the Boost Spirit X3 library.

The translator is based on the method presented in section four of the paper "Concise finite-domain representations for PDDL planning tasks by Malte Helmert (AIJ 2009)".

Supported PDDL Requirements

  • :strips
  • :typing
  • :negative-preconditions
  • :disjunctive-preconditions
  • :equality
  • :existential-preconditions
  • :universal-preconditions
  • :quantified-preconditions
  • :conditional-effects
  • :numeric-fluents
  • :adl
  • :derived-predicates
  • :action-costs
  • :non-deterministic (unsupported in the translator)
  • :probabilistic-effects (unsupported in the translator)

Dependencies

Loki depends on a fraction of Boost's header-only libraries (Fusion, Spirit x3, Container), its performance benchmarking framework depends on GoogleBenchmark, and its testing framework depends on GoogleTest.

Loki consumes native dependencies from Python packages:

  • pyyggdrasil >= 0.0.18, < 0.1 for shared third-party native dependencies.

The shared workspace layout, layered install order, and the common build-from-source and CMake-integration patterns are documented in the Planning and Learning build instructions; the sections below cover loki/pypddl-specific details.

For offline/local development, install pyyggdrasil from the sibling source checkout instead:

cd ../yggdrasil
uv pip install --python ../loki/.venv/bin/python .

Build C++

Install Loki's native dependency providers into the active Python environment, then configure CMake with their native prefixes:

python -m pip install 'pyyggdrasil>=0.0.18,<0.1'

cmake -S . -B build

CMake discovers the installed pyyggdrasil automatically through cmake/bootstrap_pyyggdrasil.cmake (which locates the package and adds its native prefix to CMAKE_PREFIX_PATH, after which find_package(yggdrasil) provides the shared helper functions) and links against the yggdrasil::yggdrasil target. To point at a different prefix explicitly:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -m pyyggdrasil --prefix)"

cmake --build build -j4

CMake options:

Option Default Description
LOKI_BUILD_TESTS OFF Build Loki tests.
LOKI_BUILD_EXECUTABLES OFF Build Loki executables.
LOKI_BUILD_PROFILING OFF Build Loki profiling targets.
LOKI_BUILD_PYPDDL OFF Build Loki for the pypddl Python wheel.
LOKI_ENABLE_FMT_FORMATTERS ON Enable the public fmt::formatter specializations of Loki and yggdrasil (LOKI_/YGG_ENABLE_FMT_FORMATTERS macros, both default-on in the headers).

Run tests from a build configured with -DLOKI_BUILD_TESTS=ON:

ctest --test-dir build --output-on-failure

Install Loki from a configured build directory with:

cmake --install build --prefix=<path/to/installation-directory>

Build Python

python -m pip install .

Python API

The Python package exposes the semantic parser, translator, and reparseable PDDL formatter through pypddl.formalism:

from pypddl import formalism as pddl

parser = pddl.Parser("""
(define (domain ready-domain)
  (:predicates (ready))
)
""")

translation = pddl.translate_domain(parser.domain())
domain_text = pddl.format_domain(translation.translated_domain)
reparsed = pddl.Parser(domain_text)
assert reparsed.domain().get_name() == "ready-domain"

C++ API

The umbrella header exposes the semantic parser, translator, and reparseable PDDL formatter through the top-level loki namespace:

#include <loki/loki.hpp>

#include <string>

int main()
{
    auto parser = loki::Parser(std::string { "(define (domain ready-domain) (:predicates (ready)))" });
    const auto translation = loki::translate_domain(parser.get_domain());
    const auto domain_text = loki::format_domain(translation.get_translated_domain());
    auto reparsed = loki::Parser(domain_text);
    return reparsed.get_domain().get_name() == "ready-domain" ? 0 : 1;
}

CMake Integration

This section covers pypddl-specific paths and targets; the general pattern for consuming the native prefixes from CMake is in the common CMake integration instructions.

The Python package pypddl installs Loki's native headers, shared library, and CMake package config under pypddl.native_prefix(). It depends on pyyggdrasil>=0.0.18,<0.1 for third-party native dependencies:

import pypddl
import pyyggdrasil

print(pypddl.cmake_prefix())       # prefix to put on CMAKE_PREFIX_PATH
print(pypddl.cmake_dir())          # directory containing lokiConfig.cmake
print(pyyggdrasil.cmake_prefix())

The same paths are available from the shell via python -m pypddl --prefix, --cmake-dir, --include-dir, and --version.

Downstream CMake projects should include the native prefixes of pypddl and its native package dependencies in CMAKE_PREFIX_PATH:

cmake -S . -B build \
  -DCMAKE_PREFIX_PATH="$(python -m pypddl --prefix);$(python -m pyyggdrasil --prefix)"

Loki exports the loki::parsers target.

Running the Executables

The executable illustrates how to use Loki. It is disabled by default and can be enabled with -DLOKI_BUILD_EXECUTABLES=ON. Example PDDL inputs are available from the benchmark submodule:

git submodule update --init --recursive data/planning-benchmarks
./build/exe/loki \
  data/planning-benchmarks/tests/classical/gripper/domain.pddl \
  data/planning-benchmarks/tests/classical/gripper/test-1.pddl

Citing Loki

If you use Loki in your research, please cite it as follows:

@misc{drexler-zenodo2026,
  author =       "Dominik Drexler",
  title =        "{Loki}: A {PDDL} Parser and Normalizer",
  publisher =    "Zenodo",
  year =         "2026",
  doi =          "10.5281/zenodo.20081136",
  url =          "https://doi.org/10.5281/zenodo.20081136",
}

Acknowledgements

This work was partially supported by the Wallenberg AI, Autonomous Systems and Software Program (WASP) funded by the Knut and Alice Wallenberg Foundation.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypddl-1.0.12.tar.gz (3.8 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pypddl-1.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.12-cp313-cp313-macosx_11_0_arm64.whl (860.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.12-cp312-cp312-macosx_11_0_arm64.whl (860.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.12-cp311-cp311-macosx_11_0_arm64.whl (859.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.12-cp310-cp310-macosx_11_0_arm64.whl (859.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pypddl-1.0.12-cp39-cp39-macosx_11_0_arm64.whl (859.7 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pypddl-1.0.12.tar.gz.

File metadata

  • Download URL: pypddl-1.0.12.tar.gz
  • Upload date:
  • Size: 3.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pypddl-1.0.12.tar.gz
Algorithm Hash digest
SHA256 96b3f3dc55067093df810d85bb1c215be6a4b2782dfed61989c683a5f1557ade
MD5 b6d07580d834f44dabb07606abf96d67
BLAKE2b-256 d70834b7d89b3aa89d2713459a985f2770f5df5b23b4812cf78177b4fc4e2a0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12.tar.gz:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6c1c050fc550ab7128eda4627987405802e144b10f3732364c7a2a21050f3a88
MD5 1520d9941b18b762c139f76b5cfbf115
BLAKE2b-256 b0bde557bbc70358752987ca91467efba2c0a0c2b382e6b960692c744894fbaa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a9ec3e2edc2ad10bd357829d3c338041df3f57503fa8d27778b591ea14ead225
MD5 dbd7c8bc87a8aca5f4a7f8f0a908be8c
BLAKE2b-256 02ac8ec83e90a148f327e449eb72e37a2fb3fb7c733fd62c84b2dde9392ac983

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 87b45de446e93345b619eea17a4721626efa18163930fc608fa5881f3c8b522c
MD5 a7ece7a697fdab41a181395ea4c193db
BLAKE2b-256 095bfe5ea4862d43a50a94030a32413ef6e7b74be3ec7fd43c303aaaf6e866a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ff0b3739d067b908bc92e2521db3a00e094a13d7756ce9f6d60595c76550db8c
MD5 3c9515e4f2b1b134791d0ad5440d42be
BLAKE2b-256 ae422a43cf2884de3f05a2e67cd2f2684f4eaf20170f191196c3b72c322669fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b754cb8e31f9ded0460dbb4b2137440c0135401d67c02b915b7d5076d3c5182d
MD5 38c5b3858c6f10aeb90f91065bbeb6df
BLAKE2b-256 c6d28ca16665a61f6c44cbaac7ea322e16e3f2ce9eeb2a6103045f0923ff8703

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a383b53726b9b88ef751d14d49780f691ca5251a44a1af4e0ff41b4eb98bb4b
MD5 8f485d5685b257908485caa73c0aecdf
BLAKE2b-256 756f5603d21bb1b1d5c04dfd500643507b5220e15c228e35142da1da5061fbe6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e861fec27fc1d7c6a746ae609cbdd43a75a5d73206f6b92edacb6806abdf25a5
MD5 9d7b9423305e5846e50d81f36e784bca
BLAKE2b-256 d37ac9523a045204ad6f446f94e55cd5a5639794d811887f0f25ece0db30c59a

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e9b48355cb77f5c6a241488fa67d253c4bf30c02fd4784ea9bba2e9c45517684
MD5 c8c7febf40b300d952d9bf075a1ad377
BLAKE2b-256 44d940d239794e3ec08680b50ad8b93ad087fe9f4839079d45d59797781b1089

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 58ce3ed189f3540ca849c7568da5dca3df663b724c2628267a018b4d1206e8ff
MD5 2906ea3a6fa51e73e47b3b8d50619e96
BLAKE2b-256 72ebe326b163ab6edae120b78cd83fd0d9e728f9509bd3938bf40a508d1ccfff

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pypddl-1.0.12-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.12-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 bb87f6530bb07629148aa944999a83cdbce9c5fc0bc2763232d8a3fcddf665cc
MD5 f7a9816d8a954fa06f0702a161af3955
BLAKE2b-256 d1bc6a3db182db2ff102542a79297a19a45c2695764742e45f3f762405cc73c5

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.12-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: release.yml on planning-and-learning/loki

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page