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

Uploaded CPython 3.13macOS 11.0+ ARM64

pypddl-1.0.14-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.14-cp312-cp312-macosx_11_0_arm64.whl (882.2 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pypddl-1.0.14-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.14-cp311-cp311-macosx_11_0_arm64.whl (882.2 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pypddl-1.0.14-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.14-cp310-cp310-macosx_11_0_arm64.whl (842.8 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pypddl-1.0.14-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.14-cp39-cp39-macosx_11_0_arm64.whl (882.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pypddl-1.0.14.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.14.tar.gz
Algorithm Hash digest
SHA256 cdeba7a82e1411a33ede69c67a4e42a17b1100141a95a68c9fc4757fcad5c7be
MD5 46b25338edcc066f59092d66254fa678
BLAKE2b-256 103f516265914d22b829515ad7c9efca00b586b8f0ca5e20aa20a51d4157b805

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 26224eec86a8c4aad8afa7c1fb0726b0905265994de4350f82926907246b4520
MD5 d355b29794e797ddb9c7832d91321ff5
BLAKE2b-256 dfb579ffefa7c72370c6b9514ec8647303af7892eea2b4fbc1a615901a73a841

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 427b42da03adc46000e91a69a18cc1fe4497788816389d25004c78cd5b0292b1
MD5 2afd37267fc2a09e1f7b5a3fd34bfd30
BLAKE2b-256 c70941f7ee7fce2b1e4a58f6774ae3fae125c4a14539f06f28524940ae5afbf6

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp312-cp312-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 598e98c4f4f99ae3f1b98d909693286f779be69afe189972b109084eabcf724a
MD5 b1cbde83587c04d29f7c8ec387e3f2d1
BLAKE2b-256 cc3d21c74a5443d05b97f2f3f75b9e4b67072040e2c4a3e897e6a3b59551fed1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0cb384ac74e7fb3465732c5ca4c8402471c4bee568fbc22dd270e4ed20cb1275
MD5 cf6e42fdde7c5084534b0b8b37c2b420
BLAKE2b-256 882ac7679e156d4d22a41e6208f19089f025ea7ba1ee079c7617bf510875ec54

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7834820e416fe977b641be28f5dcf7eb2029e76fc91793341605d47a25c3d101
MD5 aabbb25d9c5dae2ddd0611809580272a
BLAKE2b-256 ea98b88a985476277574716d47b293740f633ed5565a2486517abef28ecb35c0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 42be49431db250d34c95a63e10829e873a6585410cb0c03f4e05a48662c77d47
MD5 a92da003b83801d1908773c9bed188bb
BLAKE2b-256 f529d197c80ac72b96edb6fa6352ed1395fd4949db063669e50cb5f9c52b3c15

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5d377f8e14ea864221b0ab9813d151bb11536a42b98963e3386880d9342cfbd0
MD5 1edd2966a23404d4e2cb28a9a4cc00ea
BLAKE2b-256 c8fa6796597ce7eede1eb1cdeafbd4322e5a09c8ec570235694082ec851b7cdc

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c3b6da68e380426299d20758f269feb7501df78afcf1d60487a0774bd82cc7a1
MD5 fee1dd8848d0bfed05a08ca84c732fd1
BLAKE2b-256 4c9f3bd1012573c6b4c55ee8973be37b90fe57ef16f4be16226af8093bd85c04

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 de7ce3d3c333dc0a32a0995ed5ced6501bee0e58c4ad3db2d82f76946f6448fa
MD5 e86eb6cd1caf8468114b305ed5ecad74
BLAKE2b-256 3a0aa21d1ec6f335374a95288e104ddb2827d9809c645f5383a039b28dff8290

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for pypddl-1.0.14-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1a87acf8111f4ce6c747b452b7a0d4783da0effa02743be73d98da28a4e6dc1f
MD5 97696f133ad92ae71862933eb60e1c47
BLAKE2b-256 acb242907697d2079f269b1ef67a8941bc7fd32c55507edf0e0827e2ba8e8ec3

See more details on using hashes here.

Provenance

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