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.15.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.15-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

pypddl-1.0.15-cp313-cp313-macosx_11_0_arm64.whl (847.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

pypddl-1.0.15-cp312-cp312-macosx_11_0_arm64.whl (886.8 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

pypddl-1.0.15-cp311-cp311-macosx_11_0_arm64.whl (847.6 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.15-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

pypddl-1.0.15-cp310-cp310-macosx_11_0_arm64.whl (886.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.15-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.1 MB view details)

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

pypddl-1.0.15-cp39-cp39-macosx_11_0_arm64.whl (847.6 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pypddl-1.0.15.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.15.tar.gz
Algorithm Hash digest
SHA256 65ec4fd91e6e06feefacc9ae07d4177e1012165ccf0c322ffefcaca9622498c5
MD5 d26919431e39a2410478f98824c9ed88
BLAKE2b-256 ffc81585e5fbfbadacc4c57810dbcd3af0546198781f70dec785a551eecb02ff

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 32149bd0958ae826204f77ad3cd0a81a44a64dcf7bd5a18c2bd54a28175223b0
MD5 22206d417c2ad6d25fe3ec0f6e7df9d8
BLAKE2b-256 fc30f2d1fef583114a612765d9d4056fd9fd4a3a980c559fc439e34ee8c3dac5

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 84b32df18c507ae47d6af18e1573ecef5f87386ef70ebe16eee067de8a152b31
MD5 8a5009c88a871403abef611cc8359261
BLAKE2b-256 e81ee0f8e20b9258739c4f0dd0b558fbc35c1f5e980b44a9870c913459032ed3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8c959acc3ccf727d9cdcb6fc33abf81ea76669a5646fc6c3ade54f309db9907b
MD5 bc95fb6c6f1ff49f8398b033acada939
BLAKE2b-256 a985d43d6ff05478de0f6b7e82624d62be19c6fec8b810e4229cfa22e86f94ab

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 10203f5692d72bc28daf1155f7d4e07c8d4b4d77a539f5e6b518782e43342662
MD5 051d46b42c505960cfe91f353ef832f0
BLAKE2b-256 a4131aa16bc290b2802e7016122f9f14ba3d413bd70774a614becb3b69648b34

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90f00089bb16aa37aa0197b23eaeb046ba1f8913ef3f0f5a9d80a9402e50b672
MD5 bf86f689386d12d89f7567507702569d
BLAKE2b-256 dc6da5a944abda0f6cd8b78136ee1ddaa6f010dce322f09dc1ca999adcd62c66

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a31aebaaad2b3d16f779bd2b60eecef77d7c3efe7a07fc200d4346ecac0d189d
MD5 2d0a1e8971813dbc16132c7db10224d0
BLAKE2b-256 fdc9a40f9ff0a762d2f49a423a367be5020dccca54a0ad4706d36e1174e41bbb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3beb4bc96445dab79cf038b357175b28ca8dae6b803769a1932947c3a089ca81
MD5 281e7f1dd5a1caa488133aa06a93f313
BLAKE2b-256 f05a64e9deb0f5f839353e98954da91d571db6afccb61a20af3d334c2814d85e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 468403cc77a9176ebac516f821ed505bb9663c4d98f5f2270086eb229cc645ed
MD5 635d0fc68a1ee17a9ea0107534293a4e
BLAKE2b-256 c8e5dea511f1c233eb95c2aedb4848b72927a72ee9af1b03c1dd89f49a7ccd90

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6efa355687fd1bc16051f826665fe6dad5c2dc255f925a776973f10ce6f182e9
MD5 fae4b25adb43a6f21717d41ac9551907
BLAKE2b-256 c30a10dc6e02aa4c425ff8236d77f582e63dad69e79174ee4a270654df0cb278

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.15-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 45ffe0997f48bbbeea50816512d1ec8067968b0b4b45f654d2b32a2c0d57683d
MD5 a13df7665fc24db374420ea8d5da9782
BLAKE2b-256 97519c767128660a0bf1d2d27b8cb3b53b7cd7fb0dfe67ebbdc5f3fd3383d3c7

See more details on using hashes here.

Provenance

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