Literal BNF (LBNF) ------------------ By Ronald Koster (www.ronaldkoster.net), 2008-09-19. Literal Backus-Naur Form (BNF) is a modified form of BNF. An LBNF specification is a set of derivation rules, written as: ${symbol} = __expression__ where ${symbol} is a variable defined by the __expression__ on the right hand side. The following rules apply to the __expression__: + All characters after the last white space on the right hand side are significant. Hence, the name Literal BNF. + Special, ie. non-literal, characters are: $, {, }, (, ), *, +, ?, \, | . + ... is also a literal. + Special characters can be made literal by prefixing them with \. Example \$ is a literal $, \( a literal (, etc. + Or operator: |. + Grouping: use (). + Zero or more operator: * (appended). + One or more operator: + (appended). + Zero or one operator: ? (appended). + {} are optional. So if not ambiguous: ${xxx} == $xxx. + Lines starting with // are comment lines. Example: $letter = a|b|...|z|A|B|...|Z $word = $letter+ $digit = 0|1|...|9 $number = $digit+ // Alternative equivalent notation: $number = $digit$digit* $sentence = ($word|$number)+ $zipCode = ${digit}${digit}${digit}${digit}${letter}${letter} $houseNumberWithSuffix = $number$letter? ${pipe symbol} = \| $backslash = \\