Skip to content

Instantly share code, notes, and snippets.

@yuga
Created March 12, 2013 02:00
Show Gist options
  • Save yuga/5139681 to your computer and use it in GitHub Desktop.
Save yuga/5139681 to your computer and use it in GitHub Desktop.
An unserious BNF of the GNU sort command. Redundant separators are placed deliberately.
<key> := <startf> <separator>*
(<dot> <separator>* <startc> <separator>*)?
(<option> <separator>*)*
((<comma> <separator>* <endf> <separator>*)?
(<dot> <separator>* <endc> <seprator>*)?
(<option> <separator>*)*
)?
<startf> := <num>+
<startc> := <num>+
<endf> := <num>+
<endc> := <num>+
<option> := ('r'|'n')
<num> := ('0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9')
<separator> := (' '|'\t')
<dot> := '.'
<comma> := ','
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment