October 08, 2026

BNF grammar for instruction following of a kitchen robot

The communication between speaker and hearer can be formalized with a dialogue grammar which contains of objects and actions. The grammar stores a language in a compact format. Possible sentences are:

  1. Put the clean plate on the table.
  2. Place the large bowl beside the sink.
  3. Move the blue cup to the counter.
  4. Cut the small red tomato.
  5. Wash the dirty pan.
  6. Open the cabinet.
  7. Take the bottle from the refrigerator.
  8. Put the whole apple into the bowl.
  9. Clean the empty sink.
  10. Please place the warm bread on the table.
  11. ----
  12. Peel the small yellow potato.
  13. Place the clean glass on the counter.
  14. Move the large pan to the stove.
  15. Put the red pepper into the bowl.
  16. Wash the dirty spoon in the sink.
  17. Take the cold bottle from the refrigerator.
  18. Chop the whole onion on the worktop.
  19. Open the white cabinet.
  20. Fill the empty cup with water.
  21. Please serve the warm bread on the table.
  22. ----
  23. Slice the green tomato.
  24. Put the round plate onto the table.
  25. Clean the large sink.
  26. Bring the blue cup to the counter.
  27. Place the sharp knife beside the cutting board.
  28. Mix the ingredients in the bowl.
  29. Close the open cabinet.
  30. Empty the full container into the pan.
  31. Dry the clean glass near the sink.
  32. Heat the cold soup on the stove.


All these sentences doesn't require the full English vocabulary and the standard grammar for English but the sentences are formulated as a mini language specified in the BNF grammar. Such a mini language can be implemented easier as a parser for robot.

<instruction> ::= <command>
                 | <sequence>
                 | <conditional-command>

<command> ::= <imperative>
            | <polite-imperative>

<polite-imperative> ::= "please" <imperative>

<imperative> ::= <transitive-command>
                | <intransitive-command>
                | <movement-command>
                | <placement-command>
                | <cleaning-command>

<transitive-command> ::= <transitive-verb> <object-phrase>

<intransitive-command> ::= <intransitive-verb>
                          | <intransitive-verb> <location-phrase>

<movement-command> ::= <movement-verb> <location-phrase>
                     | <movement-verb> <object-phrase> <location-phrase>

<placement-command> ::= <placement-verb> <object-phrase>
                      | <placement-verb> <object-phrase> <location-phrase>

<cleaning-command> ::= <cleaning-verb> <object-phrase>
                     | <cleaning-verb> <location-phrase>

<sequence> ::= <command> "and then" <command>
             | <command> "," <command>
             | <command> "then" <command>

<conditional-command> ::= "if" <condition> "then" <command>

<condition> ::= <object-existence>
              | <state-condition>

<object-existence> ::= "there is" <object-phrase>
                      | "there are" <object-phrase>

<state-condition> ::= <object-phrase> <state-adjective>
                    | <location-phrase> <state-adjective>


<object-phrase> ::= <determiner> <adjective-sequence> <object-noun>
                   | <determiner> <object-noun>
                   | <possessive> <adjective-sequence> <object-noun>
                   | <possessive> <object-noun>

<location-phrase> ::= <preposition> <determiner> <adjective-sequence> <location-noun>
                    | <preposition> <determiner> <location-noun>
                    | <preposition> <location-noun>

<adjective-sequence> ::= <adjective>
                       | <adjective> <adjective-sequence>


<transitive-verb> ::= "wash"
                    | "cut"
                    | "chop"
                    | "slice"
                    | "peel"
                    | "mix"
                    | "stir"
                    | "pour"
                    | "fill"
                    | "empty"
                    | "open"
                    | "close"
                    | "pick up"
                    | "put down"
                    | "take"
                    | "bring"
                    | "place"
                    | "move"
                    | "put"
                    | "heat"
                    | "cool"
                    | "serve"

<intransitive-verb> ::= "wait"
                      | "stop"
                      | "start"
                      | "continue"
                      | "turn"
                      | "pause"

<movement-verb> ::= "go to"
                  | "move to"
                  | "take"
                  | "bring"
                  | "carry"

<placement-verb> ::= "place"
                   | "put"
                   | "set"
                   | "leave"

<cleaning-verb> ::= "clean"
                   | "wash"
                   | "dry"
                   | "wipe"


<object-noun> ::= "apple"
                 | "banana"
                 | "tomato"
                 | "potato"
                 | "onion"
                 | "carrot"
                 | "pepper"
                 | "bread"
                 | "cheese"
                 | "egg"
                 | "plate"
                 | "bowl"
                 | "cup"
                 | "glass"
                 | "pan"
                 | "pot"
                 | "knife"
                 | "spoon"
                 | "fork"
                 | "bottle"
                 | "container"
                 | "ingredient"
                 | "food"

<location-noun> ::= "kitchen"
                  | "counter"
                  | "table"
                  | "sink"
                  | "stove"
                  | "oven"
                  | "refrigerator"
                  | "drawer"
                  | "cabinet"
                  | "shelf"
                  | "dishwasher"
                  | "cupboard"
                  | "floor"
                  | "worktop"

<adjective> ::= <color-adjective>
              | <size-adjective>
              | <state-adjective>
              | <shape-adjective>
              | <temperature-adjective>
              | <quantity-adjective>

<color-adjective> ::= "red"
                    | "green"
                    | "yellow"
                    | "blue"
                    | "white"
                    | "black"

<size-adjective> ::= "small"
                    | "large"
                    | "big"
                    | "tiny"
                    | "deep"
                    | "shallow"

<state-adjective> ::= "clean"
                    | "dirty"
                    | "empty"
                    | "full"
                    | "open"
                    | "closed"
                    | "hot"
                    | "cold"
                    | "ready"
                    | "broken"

<shape-adjective> ::= "round"
                    | "square"
                    | "flat"
                    | "sharp"

<temperature-adjective> ::= "warm"
                          | "cool"
                          | "hot"
                          | "cold"

<quantity-adjective> ::= "single"
                       | "extra"
                       | "remaining"
                       | "whole"
                       | "half"

<determiner> ::= "the"
               | "a"
               | "an"
               | "this"
               | "that"
               | "these"
               | "those"

<possessive> ::= "my"
               | "your"
               | "the robot's"

<preposition> ::= "to"
                | "from"
                | "on"
                | "in"
                | "into"
                | "onto"
                | "under"
                | "beside"
                | "near"
                | "behind"
                | "inside"
                | "out of"
 

No comments:

Post a Comment