pucrs-automated-planning / pddl-parser

:snake: Classical Planning in Python
GNU General Public License v3.0
84 stars 23 forks source link

Constants #6

Closed bcorfman closed 3 years ago

Maumagnaguagno commented 3 years ago

From my experience there is no need to consider constants any differently from regular objects, see HDDL_Parser parse_objects. If someone really needs to distinguish them, they only need to copy the objects between domain and problem parsing. Do you need the constants attribute in a way that the previous solution is not enough?

Note that I will accept the PR, just want to understand your use case.

Maumagnaguagno commented 3 years ago

I am refactoring the code to merge the original parse objects block and parse_constants into parse_objects. This caught my attention: If I have a type a and two objects b - a a - a it generates a redefined constant a exception. It seems you are not considering name collisions, and this redefinition exception should only prevent objects/constants from multiple inheritance/typing. I will commit my current solution and then try to include this exception.

Maumagnaguagno commented 3 years ago

I am removing the redefinition exception as it would require traversing the entire object structure and matching with the types to see if something was defined twice and in a wrong way, even though it could still be valid as PDDL is a declarative language. Do you really need the constants as an attribute? https://github.com/pucrs-automated-planning/pddl-parser/blob/master/PDDL.py#L67