Backus-Naur-Form

Backus-Naur-Form

Basic BNF

The basic form of a grammar rule

symbol0: symbol1 symbol2 ... symboln

Symbols represent sets of strings and come in 2 flavors

  • Non-terminal symbols: Can expand into either non-terminal symbols or terminals
  • Terminal symbols: Strings or regular expressions
item* items: |items item
item+ items: item | items item
item? optitem: | it