Skip to content

Instantly share code, notes, and snippets.

@wking
Created June 2, 2017 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wking/5cd4fe3bbf41e1bf46dc89ed724dba6f to your computer and use it in GitHub Desktop.
Save wking/5cd4fe3bbf41e1bf46dc89ed724dba6f to your computer and use it in GitHub Desktop.
*BNF comparison
Undefined
ref := component ["/" component]*
component := alphanum [separator alphanum]*
alphanum := /[A-Za-z0-9]+/
separator := /[-._:@+]/ | "--"
ABNF
ref = component *("/" component)
component = alphanum *(separator alphanum)
alphanum = 1*(ALPHA DIGIT)
separator = "--" / "-" / "." / "_" / ":" / "@" / "+"
PEG
start <- component ("/" component)*
component <- alphanum (separator alphanum)*
alphanum <- (letter / digit)+
separator <- "--" / "-" / "." / "_" / ":" / "@" / "+"
letter <- [A-Za-z]
digit <- [0-9]
XML 1.0 EBNF
ref ::= component ("/" component)*
component ::= alphanum (separator alphanum)*
alphanum ::= [a-zA-Z0-9]+
separator ::= [-._:@+] | "--"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment