Closed wmanning-cra closed 2 years ago
Yes, you'll need to add custom parsing logic. Consider referring to how action definitions are currently parsed: https://github.com/JuliaPlanners/PDDL.jl/blob/a46d3be2c2d7523999aa5b334ffebd957fcb347c/src/parser/domain.jl#L109-L119
You first have to write a function, e.g. parse_method
that takes in a Expr
that is returned by the parse_string
function at the end of https://github.com/JuliaPlanners/PDDL.jl/blob/master/src/parser/grammar.jl. After that, you have to tell that :method
is a field that exists in the body of a :domain
description by adding something like:
body_field_parsers[:domain][:method] = parse_method
Once you do this, the list of parsed methods should appear as a Vector
in the domain._extras
dictionary.
At some point, I'll document in more detail how one can extend the parser, but in the meantime I'd suggest looking at how things are currently implemented.
As for new fields in problems, you'll have to either modify the definition of GenericProblem
to have something similar to an _extras
field, or to add new explicit fields, or define a new concrete subtype of Problem
that contains all the fields you care about.
Thank you for the info! I guess we can consider this issue closed.
We are experimenting with hierarchical PDDL planning, using an extension that adds "Methods" to the domain alongside actions. I noticed a field in the domain called
_extras
, which seems to hold parsed data that doesn't fit into the other known fields (actions, requirements, types, constants, etc.). This would be usefulHowever, when I parse a domain containing methods, I can't find them within the structure. Is this a bug with
_extras
, or am I misunderstanding it (and do I need to add custom parsing logic to handle methods)?https://www.uni-ulm.de/fileadmin/website_uni_ulm/iui.inst.090/Publikationen/2020/Hoeller2020HDDL.pdf
Here is an example of the syntax for a method:
There are also new fields in the Problem as well, so I guess I have the same question for the Problem struct.