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.
- 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.
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.
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),
}
}
The library includes tests that you can run to ensure the parser works as expected:
cargo test
Contributions are welcome! Please open an issue or pull request on GitHub.
This project is licensed under the MIT License - see the LICENSE file for details.