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.13.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.13-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.13-cp313-cp313-macosx_11_0_arm64.whl (803.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.13-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.13-cp312-cp312-macosx_11_0_arm64.whl (803.5 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.13-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.13-cp311-cp311-macosx_11_0_arm64.whl (843.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.13-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.13-cp310-cp310-macosx_11_0_arm64.whl (803.3 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.13-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.13-cp39-cp39-macosx_11_0_arm64.whl (803.4 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pypddl-1.0.13.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.13.tar.gz
Algorithm Hash digest
SHA256 eb5bf2d0d75874d53f02e08b4c8f02d2907db06078d12a799c831132a329a728
MD5 9610cdebaaa1e3eb0bd1dc05c1bd04ce
BLAKE2b-256 6e7a612010dd2f62651c7caf67dd33130f936165490be4d4b1fbb6f962851533

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13.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.13-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b810786c35b2aaf6cb79b081ff1e87af293b330bb7b968186a69ba429cc290b3
MD5 c1671cf603147cc36b02432f9e84e223
BLAKE2b-256 64df198aef97b891435f71dea0fd1dc14f2b79e1fed68b4011dd33989bd9e574

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 70653166ba434d60ce624a7d7f881889daa7b8a251c2ababa8df34d0bb261f18
MD5 f445394182c47d94b01a16bff2e2d7a1
BLAKE2b-256 6b89cdde0944d02f976fc25924483a888fa49688564981edf7de9a535ce0a38f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0f4b1148c5bc5b42fcbabed318b376a362341b1e1e7e66b4bfdae1956b725ec3
MD5 5556a84c724917db26347ef82efa2833
BLAKE2b-256 cc311485f46468828207efe986767951d9e7ef9388e4900c66efef1761962c20

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3802b7fb674906aba91cfeaef7481b94d035fe9d2c6e93371db233ec3134e391
MD5 7c6bc45ddccb849b91a635855cfbeb0b
BLAKE2b-256 3745bd97742538568cdee82f59d0d3ac0e24065525eb03afd70ea89a75f62934

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f1d1f09a44798130af4895d3e404cb4c7c40ee715a20875351a21cdeed544623
MD5 1c1cd91ed82b8a53cfd3ff95a2fbbfeb
BLAKE2b-256 831e49c92dd3a7bf5ba060723dc1a1dd1d96e37e8addaab033e0ef4cf0ef2eac

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b04c85d315b0ae38294ebc325c58e498315782fe51ba1ca44705e1a7484ed310
MD5 faa1c11e1e04bd10606f9dc8e72b37f4
BLAKE2b-256 49f6438131eeee7e39347158604c602aa73e66ba3d53849d4ea2890d1fbf3d45

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ae476474718d6e97cac6e8545a6492347da59d68f8b75d8cebb86852b5cf51e3
MD5 54b2af49d14d432b03e83cec5fd643a4
BLAKE2b-256 528b4ce5506c9f22dba488fee428a022df1b389ba93728e85e18af32843d1162

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 849a080a796e7dd2a403d4264b7807e1995952ac7c354758de8fac3af95df970
MD5 26d543984ca32c41c6b55e6787078967
BLAKE2b-256 0d5c84ef0786a43b4d857ac0583b1f3c8d349a2414d7f1a44d76252db49cbdd0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 616cdb6bb90ad44ec6b40b3d7bcc5a59e0d967594526993743df5b87695bca7d
MD5 7838500a30f31609d016e6b4612638e5
BLAKE2b-256 548613db4079fec99d4fd31cb2c72c45dd6076f461a910af0f534a65185f6a0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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.13-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pypddl-1.0.13-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dfea29b9c5ea25b28059ee8bfe89f042551261428e160e451c1c3cea6b6e3d58
MD5 bd5ae85631ae1738266fd6e25b8cc84e
BLAKE2b-256 c68cb8a43a6979bac8bb72c721935fcf43993f432a382aa0bb542de37246947b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypddl-1.0.13-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