This replaces all user-defined variable names with continuously numbered
ones so that they don’t lead to syntax problems in ASP, while still
unique and distinguishable. For instance, this avoids problems when
variable names contain hyphens, which are allowed in PDDL identifiers
but not in ASP variables.
Previously, variables referenced within values were unpacked within
values. This was inconsistent, because all predicates are usually used
in their unpacked form in the rest of the output format. This commit
makes this consistent by using variables in their packed form within
values, making it more compact to handle them.
Due to a mistake in commit 6d07fcb, the closing parenthesis and period
at the end of initial state facts was omitted. This adds these back in
order to solve this syntax error.
Even though the parser shouldn’t be able to put variables into the goal
description, the AST theoretically allows for this case. This commit
adds a defensive check that goal descriptions are variable-free.
By accident, the support for derived predicates in goals was missing.
This commit adds this, in a very similar way to how normal predicates
are handled in the goal description.