#language-model #parser #pddl #planning #domain #input #generated

pddl-ish-parser

A Rust library for parsing a relaxed version of the Planning Domain Definition Language (PDDL), designed to handle PDDL-like inputs generated by autoregressive language models like ChatGPT

2 releases

0.0.4 Nov 18, 2023
0.0.3 Nov 18, 2023

#4 in #pddl

Download history 26/week @ 2023-12-18 2/week @ 2023-12-25 15/week @ 2024-01-01 17/week @ 2024-01-08 14/week @ 2024-01-15 19/week @ 2024-01-22 21/week @ 2024-01-29 10/week @ 2024-02-05 17/week @ 2024-02-12 124/week @ 2024-02-19 102/week @ 2024-02-26 58/week @ 2024-03-04 32/week @ 2024-03-11 62/week @ 2024-03-18 50/week @ 2024-03-25 121/week @ 2024-04-01

268 downloads per month

MIT license

21KB
436 lines

PDDL-ish Parser

The PDDL-ish Parser is a Rust library designed for parsing a relaxed version of the Planning Domain Definition Language (PDDL). This parser is particularly tailored for handling PDDL-like inputs that may be generated by autoregressive language models such as ChatGPT.

Features

  • Parse non-standard PDDL files with flexibility.
  • Extract domains, objects, and actions from PDDL-like structured text.
  • Error handling to provide context for parsing failures.
  • Support for common PDDL constructs with leniency in syntax.

Installation

To install the PDDL-ish Parser, you can use cargo add command:

cargo add pddl-ish-parser

Or add the following to your Cargo.toml file:

pddl-ish-parser = "0.0.3"

You may want to check on the latest available version on crates.io.

Usage

Here is a basic example of how to use the PDDL-ish Parser:

use pddl_ish_parser::parser::problem_parser::parse_problem;

fn main() {
    let input = r#"(define (problem your-problem)
        ...
    )"#;

    match parse_problem(input) {
        Ok((_, problem)) => println!("{:?}", problem),
        Err(e) => eprintln!("Error parsing problem: {:?}", e),
    }

    let domain_input = r#"(define (domain your-domain)
        ...
    )"#;

    match parse_domain_types(domain_input) {
        Ok((_, domain_types)) => println!("Parsed domain types: {:?}", domain_types),
        Err(e) => eprintln!("Error parsing domain types: {:?}", e),
    }
}

Testing

The library includes tests that you can run to ensure the parser works as expected:

cargo test

Contributions

Contributions are welcome! Please open an issue or pull request on GitHub.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Dependencies

~3–4MB
~71K SLoC