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>
-
<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.
-
-
<cmd>
-
Definition:
<deviceName> ">" <instructionList>
-
Meaning: A command consists of a device name followed by a
>
and an instruction list.
-
-
<instructionList>
-
Definition:
<instruction> [";" <instruction>]
-
Meaning: An instruction list can contain one or more instructions separated by semicolons.
-
-
<instruction>
-
Definition: ` |
-
Meaning: An instruction can be a delay, a simple instruction, or a panel instruction.
-
-
<delay>
-
Definition:
"#" <num>
-
Meaning: A delay is indicated by a
#
followed by a number, representing the delay in milliseconds.
-
-
<simpleInstruction>
-
Definition:
<instructionStart> <instructionBody>
-
Meaning: A simple instruction starts with any character other than
#
followed by the instruction body.
-
-
<instructionStart>
-
Definition:
NOT "#"
-
Meaning: The starting character of a simple instruction can be any character other than a
#
.
-
-
<instructionBody>
-
Definition:
<stringNoSemi>
-
Meaning: The body of an instruction, represented as a string without semicolons.
-
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.