Documentation

Validator.PlanningTask.Parser

Parser for STRIPS Planning Tasks #

This file contains some general parsing functions and a parser for STRIPS planning tasks.

General Parsing Functionality #

@[reducible, inline]
abbrev Validator.Parser (α : Type) :
Equations
Instances For
    def Validator.readLine {α : Type} (s : String) (p : Parser α) :
    Equations
    Instances For
      Equations
      Instances For
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          Equations
          Instances For
            @[reducible, inline]
            abbrev Validator.push? {α : Type u_1} :
            Array αOption αArray α
            Equations
            Instances For

              For each tuple (p, p', e) in the given list, try the parser p. If it succeeds, run the parser p', otherwise proceed with the next tuple in the list. The optional error messages e are combined into one error message if none of the parsers p succeed.

              Equations
              Instances For
                Equations
                Instances For
                  def Validator.parseCases {α : Type} (ps1 : List (String × Parser α)) (ps2 : List (Parser Unit × Parser α) := []) :

                  For each of the pairs (s, p) in ps1, try to parse the string s. If it succeeds, run the parser p, otherwise proceed with the next pair in the list. If none of parsers for s is successfull, continue with the list ps2. For each pair (p, p') in this list, try the parser p, and if it succeed, run p' and return its result. If it fails continue with the next pair. If all pairs fail, combine the strings in ps1 into one error message.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For

                    STRIPS Parser #

                    Try to read the file corresponding to the given path, and parse its content into a STRIPS planning task. The file is expected to have the following format:

                    begin_atoms: <#atoms>
                    <atom 0>
                    <atom 1>
                    ... (names of all atoms, one on each line)
                    end_atoms
                    begin_init
                    <initital state atom index 0>
                    <initital state atom index 1>
                    ... (indexes of atoms that are true in initial state, one on each line)
                    end_init
                    begin_goal
                    <goal atom index 0>
                    <goal atom index 1>
                    ... (indexes of atoms that are true in goal, one on each line)
                    end_goal
                    begin_actions: <#actions>
                    begin_action
                    <action_name>
                    cost: <action_cost>
                    PRE: <precondition atom index 0>
                    ADD: <added atom index 0>
                    DEL: <deleted atom index 0>
                    ... (more PRE, ADD and DEL in any order, one on each line)
                    end_action
                    ... (more actions)
                    end_actions
                    
                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For