I am creating a formal specification for a very simple rule language, very simple. I want to use EBNF as it is a standard, but I cannot figure out how to specify the order of operations. Here is the specification so far.
rule = statement, { ('AND'|'OR'), statement}; variable = '$',alphabetic character, {alphabetic character | digit}; statement = variable, [ 'count',[white space ],'>',[white space],number ]; alphabetic character = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" ; number = [ "-" ] , digit , { digit } ; digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; white space = ? white space characters ? ;
The question I have is how to show that things should be evaluated in brackets first. So something like this
$strap AND ($greenSticker count > 5 OR ($greenSticker AND $redSticker))
Most languages โโseem to have a common feature, but my Google skills don't let me, and I can't find an example.
source share