Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes and improvements in the parsing of typed lists #82

Merged
merged 51 commits into from
Jun 13, 2023

Commits on Jun 6, 2023

  1. Configuration menu
    Copy the full SHA
    e3a249e View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2023

  1. Configuration menu
    Copy the full SHA
    658dc62 View commit details
    Browse the repository at this point in the history
  2. test: fix blocksworld_fond/p01.pddl goal

    The goal was just '(and )', restore the original reachability goal.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    d7d0534 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d5b509c View commit details
    Browse the repository at this point in the history
  4. feat: add TypesIndex class

    This commit adds the parsing utility class "TypesIndex".
    
    TypesIndex is an index for PDDL types and PDDL names/variables. It is used to index PDDL names and variables by their types. OrderedDict is used to preserve the order of the types and the names, e.g. for predicate variables. Other types of validations are performed to ensure that the types index is consistent.
    
    In this commit, it is used only to parse typed lists of names (not variables).
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    3c53e3f View commit details
    Browse the repository at this point in the history
  5. feat: changing domain parser behaviour on typed_list_name (backward c…

    …ompatible)
    
    This commit changes the way typed_list_name rule is parsed. This does not change the parsing behaviour from the user perspective, but it is a non-functional change to improve the performances of the Lark parser.
    
    With the previous version of the rule 'typed_list_name: NAME+ TYPE_SEP primitive_type (typed_list_name)', the Lark parser internals would perform a recursive call whenever a typed_list_name is matched. This might cause an arbitrarily long stack of calls whenever the parser got an input like:
    
    ```
    element1 - t1 element2 - t1 element3 t1 ...
    ```
    
    The above list of tokens is parsed as:
    
    ```
    element1 - t1 <typed_list_name>
        element2 - t1 <typed_list_name>
            element3 - t1 <typed_list_name>
                ...
    ```
    
    For large inputs, this will easily hit the recursion depth limit.
    
    With the new approach, the entire list of tokens is parsed at once. This adds some complexity in the parsing function for the typed_list_name rule, but we have more control in how the parsing is performed; in particular, we can parse the tokens *iteratively* rather than *recursively*.
    
    Finally, the NAME* pattern is appended at the end of the typed_list_name rule. This is because, according to the syntax specification, the last sublist of names might be non-typed.
    
    The implementation exploits the newly added TypesIndex class which handles corner cases and syntax errors (e.g. duplicated entries in the list).
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    3cf8cb4 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    cf25df5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ccb5097 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    7a7836c View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    f1e3316 View commit details
    Browse the repository at this point in the history
  10. chore: sort Symbols in alphanumerical order

    The order is taken from pag. 168 of the PDDL textbook, where colon ':' is ignored in determining the order.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    48ffa56 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    976f481 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    889b3fc View commit details
    Browse the repository at this point in the history
  13. Configuration menu
    Copy the full SHA
    73e4fac View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    d2dded9 View commit details
    Browse the repository at this point in the history
  15. docs: fix types argument passed to Domain in README

    The value of type dict passed to the Domain constructor in the README is set to None, denoting the fact that the type has no parent type.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    67d3b1d View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    124a60a View commit details
    Browse the repository at this point in the history
  17. Configuration menu
    Copy the full SHA
    03abf7d View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    04fe2f8 View commit details
    Browse the repository at this point in the history
  19. refactor: more Requirements to its own module pddl.requirements

    This is needed to accomodate future changes and to avoid circular imports.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    1a35939 View commit details
    Browse the repository at this point in the history
  20. Configuration menu
    Copy the full SHA
    c3ab1aa View commit details
    Browse the repository at this point in the history
  21. Configuration menu
    Copy the full SHA
    35f333b View commit details
    Browse the repository at this point in the history
  22. chore: used 'validate' instead of 'assert_'

    in this way, PDDLValidationError is raised, rather than the generic AssertionError.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    529d35d View commit details
    Browse the repository at this point in the history
  23. Configuration menu
    Copy the full SHA
    0d264a8 View commit details
    Browse the repository at this point in the history
  24. chore: change the way requirements are set in a Problem object

    If the requirements set is given, use it. Otherwise, take the requirements from the domain.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    03e632b View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    f232127 View commit details
    Browse the repository at this point in the history
  26. feat: add TypeChecker utility class and use it for checking (both dom…

    …ain and problem) constants
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    1586db1 View commit details
    Browse the repository at this point in the history
  27. fix: improve Problem initialize regarding requirements and domain_nam…

    …e vs domain
    
    Problem objects can be instantiated in two ways: either with a domain object, or without it.
    
    If with a domain object, then both the attributes/args domain_name and requirements must be validated against the provided domain.
    Otherwise, the provided arguments are used to set the attributes.
    
    The domain setter will reset both requirements and domain_name attributes.
    The property getter of requirements will return empty set even when it was not specified (therefore, interpreting absence of requirements section as empty set of requirements).
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    e879efb View commit details
    Browse the repository at this point in the history
  28. test: refactor parametrized tests

    - The parser tests are split in two modules: one for domain's, the other for problem's parser tests.
    - The parametrization over PDDL fixture files of the parser tests is changed. Now we iterate over all problems, and for each problem we also parse the respective domain, and then we check the validity of the problem against the domain (via the implicit call to the Problem.check method, triggered by the Problem.domain property setter).
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    771c6fc View commit details
    Browse the repository at this point in the history
  29. build: bump minimum Python interpreter supported to 3.8

    The main motivation is that Python 3.7 is going to reach the end of life at the end of June 2023.
    
    Another reason is that we are going to use some language features available only for >=3.8 (e.g. functools.singledispatchmethod).
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    2d35e8c View commit details
    Browse the repository at this point in the history
  30. Configuration menu
    Copy the full SHA
    190a7c5 View commit details
    Browse the repository at this point in the history
  31. Configuration menu
    Copy the full SHA
    4376e54 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    a511022 View commit details
    Browse the repository at this point in the history
  33. refactor: move Action class in its own module core.action

    Needed to avoid circular imports.
    marcofavorito committed Jun 7, 2023
    Configuration menu
    Copy the full SHA
    3d02538 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    617cfd7 View commit details
    Browse the repository at this point in the history
  35. Configuration menu
    Copy the full SHA
    bdddfbf View commit details
    Browse the repository at this point in the history
  36. Configuration menu
    Copy the full SHA
    7b3e7ad View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2023

  1. fix: move keyword validation inside class contructors

    This commit adds keyword validation for 'name' types. In particuar, instead of using the raw 'name' constructor, we added 'parse_name' and use it across modules. The same is done for 'types', except that the 'object' keyword should be ignored.
    
    This change is very helpful as the input validation is done during the initialization of the PDDL objects.
    
    The keyword validation functions have been moved to the pddl.custom_types module.
    marcofavorito committed Jun 8, 2023
    Configuration menu
    Copy the full SHA
    a12e34b View commit details
    Browse the repository at this point in the history

Commits on Jun 9, 2023

  1. Configuration menu
    Copy the full SHA
    f0e79af View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8c41830 View commit details
    Browse the repository at this point in the history
  3. feat: allow repetition in variable list

    Although not very common, a list of variables might contain duplicated entries.
    
    For example, this allows to define a predicate like P(?x, ?x).
    marcofavorito committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    eb2429d View commit details
    Browse the repository at this point in the history
  4. test: improve 'test_variables_repetition_allowed_if_same_type'

    add tests on multi-types, predicates, action parameters/preconditions/effects.
    marcofavorito committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    9a16858 View commit details
    Browse the repository at this point in the history
  5. Update .github/workflows/docs.yml

    from @francescofuggitti PR comment
    
    Co-authored-by: Francesco Fuggitti <francesco.fuggitti@gmail.com>
    marcofavorito and francescofuggitti committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    a6367ba View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2c67fde View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    b8e0a2b View commit details
    Browse the repository at this point in the history
  8. feat: check terms consistency wrt type tag

    i.e. terms with the same name should have the same type tags.
    marcofavorito committed Jun 9, 2023
    Configuration menu
    Copy the full SHA
    3661f64 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    924c88c View commit details
    Browse the repository at this point in the history
  10. Configuration menu
    Copy the full SHA
    f7996d1 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    f5858b3 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2023

  1. fix formatting of typed lists

    - types are now printed correctly in the :constants section
    - in the :objects section, the objects are grouped by type (as in constants)
    - minor fixes in how :init and :goal are printed (they are always printed even if empty).
    
    The code changes added here are to be considered temporary, since a refactoring of the formatting module is required. Nevertheless, the printing of the typing information of constants will remain.
    marcofavorito committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    edcc295 View commit details
    Browse the repository at this point in the history
  2. fix: update error message in case a name inherits from multiple types

    This should make the error more clear to the user: instead of just saying that the name is "already present" in the list, we clarify that the problem is that not only it occurs, but it is because it occurs (again) as inheriting name.
    marcofavorito committed Jun 13, 2023
    Configuration menu
    Copy the full SHA
    97b379f View commit details
    Browse the repository at this point in the history