Closed ssardina closed 8 months ago
OK I found out finally how to make this happen in a "clean" manner. Basically we need to merge the transformers for domain and problem, and Lark provides the merging mechanism. Also the lalr
grammar won´t work, it will give error if only a problem is given; I think it's because the 1 lookahead is not enough to know which rule to use. So I used earley
:
This domprob branch in the fork has the full solution. @marcofavorito , do you think it is worth allowing pddl to read files that can contain any combination of domain problem (domain alone, problem alone, domain and problem) and return a tuple [Domain, Problem]
(with None
when it corresponds).
Is your feature request related to a problem? Please describe.
We can now parse domain files, and problem files. But what if a file contain boths?
Describe the solution you'd like
At minimum a
DomProb
object that can capture files with domain + problem specsDescribe alternatives you've considered
I thought having this grammar that builds on top of domain + problem would work:
but it doesn't, and all the other symbols from
domain
say get the namedomain__X
, so I had to add one by one:and also for
problem
, but then they start clashing as some terms are duplicated in both!My whole implementation take can be seen in this branch (in a fork of pddl):
https://github.com/ssardina-research/pddl/tree/domprob
I mirrored how domain and problems were done to keep the same style. Then I did:
So, the question is we could combine the existing grammar for
domain
with the existing grammar fromproblem
to get a structure object/classDomProb
that has both?I know this is probably more about Lark than pddl, but I couldn't find ANY example of Lark that combines two grammar "in sequence". Do you know how? Thanks for any tips, I feel this should be easy/trivial and I am not getting how Lark works well. :-)