AI-Planning / pddl

Unquestionable PDDL 3.1 parser
https://ai-planning.github.io/pddl/
MIT License
85 stars 27 forks source link

Support equality comparison for numerics in problem goals #101

Closed MichaelJFishman closed 10 months ago

MichaelJFishman commented 10 months ago

Is your feature request related to a problem? Please describe. PddlParser cannot parse equality comparisons in goals.

Example problem:

(define (problem hello-3-times)
    (:domain hello-world-functions)

    (:init
        ; if this was undefined, some planners would not assumed `0`
        (= (hello_counter) 0)
    )

    (:goal
        (= (hello_counter) 3)
    )
)

Gives an error:

lark.exceptions.UnexpectedCharacters: No terminal matches '(' in the current parser context, at line 10 col 12

        (= (hello_counter) 3)
           ^
Expected one of: 
        * NAME

Previous tokens: Token('EQUAL_OP', '=')

During handling of the above exception, another exception occurred:

lark.exceptions.UnexpectedToken: Unexpected token Token('LPAR', '(') at line 10, column 12.
Expected one of: 
        * NAME
Previous tokens: [Token('EQUAL_OP', '=')]

Describe the solution you'd like I'd like this to parse.

Describe alternatives you've considered Use >= and <= in goals, instead of =.

haz commented 10 months ago

Fixed with #103

MichaelJFishman commented 10 months ago

Thanks!