pellierd / pddl4j

PDDL4J is an open source library under LGPL license whose purpose of PDDL4J is to facilitate the development of JAVA tools for Automated Planning based on PDDL language (Planning Domain Description Language).
https://lig-membres.imag.fr/pellier/
GNU Lesser General Public License v3.0
147 stars 68 forks source link

Parser problem #74

Closed GustavTaxen closed 4 years ago

GustavTaxen commented 4 years ago

New to PDDL, so this may be a rookie error!

The domain file below fails to parse in pddl4j. It runs properly at http://editor.planning.domains.

I use

java -jar build/libs/pddl4j-3.8.3.jar -o gt/domain.pddl -f gt/problem.pddl

and get the error

Lexical error at line 10, column 3, file (gt/domain.pddl) : unexpected token "(".

(define (domain gt)
    (:requirements :strips :typing)
    (:types person
        location)

    (:predicates (person-at ?p - person ?loc - location))

    (:action go-to
        :parameters (?p - person ?loc - location)
        :precondition (not (person-at ?p ?loc))
        :effect (person-at ?p ?loc))
)
pellierd commented 4 years ago

Planning domain editor is more permissive than PDDL4J.

You use negation in the precondition of the action goto without using the requirement :negative_preconditions.

fdouglis commented 1 year ago

I encountered the same issue. I didn't realize I needed to require negative preconditions but when I added what you mentioned here, with an underscore, it simply added to the errors. I found that changing _ to - got it to parse.

fdouglis commented 1 year ago

I'll add that while it is fine to say that the requirement should be included, I wonder if it's possible for the lexer to be a bit more informative. Simply saying things like a paren unexpected didn't tell me anything -- I'm glad I thought to search closed issues for someone who encountered it before me.