CommandBNF - kizmit99/MechMind GitHub Wiki

BNF description of the MechMind command strings:

<cmdList> ::= <cmd> [";" <cmd>]
<cmd> ::= <deviceName> ">" <instructionList>
<instructionList> ::= <instruction> [";" <instruction>]
<instruction> ::= <delay> | <simpleInstruction>
<delay> ::= "#" <num>
<simpleInstruction> ::= <instructionStart> <instructionBody>
<instructionStart> ::= NOT "#"
<instructionBody> ::= <stringNoSemi>

BNF Breakdown

  1. <cmdList>

    • Definition: <cmd> [";" <cmd>]

    • Meaning: A list of commands separated by semicolons. The [] denotes an optional part, implying a single command or multiple commands separated by semicolons.

  2. <cmd>

    • Definition: <deviceName> ">" <instructionList>

    • Meaning: A command consists of a device name followed by a > and an instruction list.

  3. <instructionList>

    • Definition: <instruction> [";" <instruction>]

    • Meaning: An instruction list can contain one or more instructions separated by semicolons.

  4. <instruction>

    • Definition: ` |

    • Meaning: An instruction can be a delay, a simple instruction, or a panel instruction.

  5. <delay>

    • Definition: "#" <num>

    • Meaning: A delay is indicated by a # followed by a number, representing the delay in milliseconds.

  6. <simpleInstruction>

    • Definition: <instructionStart> <instructionBody>

    • Meaning: A simple instruction starts with any character other than # followed by the instruction body.

  7. <instructionStart>

    • Definition: NOT "#"

    • Meaning: The starting character of a simple instruction can be any character other than a #.

  8. <instructionBody>

    • Definition: <stringNoSemi>

    • Meaning: The body of an instruction, represented as a string without semicolons.

Example

Let's consider an example to see how it would be structured:

device1>:TURN_ON;#1000;SET_TEMP 22
  • device1: The target device.

  • :TURN_ON: A simple instruction starting with :.

  • #1000: A delay instruction with a delay of 1000 milliseconds.

  • SET_TEMP 22: A simple instruction.

⚠️ **GitHub.com Fallback** ⚠️