Skip to content

Instantly share code, notes, and snippets.

@shivamMg
Created November 18, 2018 09:39
Show Gist options
  • Select an option

  • Save shivamMg/e64fd2b9410fa157a1ceaee4b5987e43 to your computer and use it in GitHub Desktop.

Select an option

Save shivamMg/e64fd2b9410fa157a1ceaee4b5987e43 to your computer and use it in GitHub Desktop.
EBNF for domain names (copied from https://www.ietf.org/rfc/rfc1035.txt)
<domain> ::= <subdomain> | " "
<subdomain> ::= <label> | <subdomain> "." <label>
<label> ::= <letter> [ [ <ldh-str> ] <let-dig> ]
<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>
<let-dig-hyp> ::= <let-dig> | "-"
<let-dig> ::= <letter> | <digit>
<letter> ::= any one of the 52 alphabetic characters A through Z in
upper case and a through z in lower case
<digit> ::= any one of the ten digits 0 through 9
@shivamMg

Copy link
Copy Markdown
Author

or better yet, since it's producing strings of the form: <label> ("." <label>)* just write it as:

<subdomain> ::= <label> {"." <label>}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment