BNF for specific URL schemes

This is a BNF-like description of the Uniform Resource Locator syntax. A vertical line "|" indicates alternatives, and [brackets] indicate optional parts. Spaces are represented by the word "space", and the vertical line character by "vline". Single letters stand for single letters. All words of more than one letter below are entities described somewhere in this description.

The current IETF URI working group preference is for the prefixedurl production. (Nov 1993. July 93: url).

The "national" and "punctuation" characters do not appear in any productions and therefore may not appear in URLs.

The "afsaddress" is left in as historical note, but is not a url production

prefixedurl
u r l : url
ur l
httpaddress | ftpaddress | newsaddress | nntpaddress | prosperoaddress | telnetaddress | gopheraddress | waisaddress | mailtoaddress | midaddress | cidaddress
scheme
ialpha
httpaddress
h t t p : / / hostport [ / path ] [ ? search ]
ftpaddress
f t p : / / login / path [ ; ftptype ]
afsaddress
a f s : / / cellname / path
newsaddress
n e w s : groupart
nntpaddress
n n t p : group / digits
midaddress
m i d : addr-spec
cidaddress
c i d : content-identifier
mailtoaddress
m a i l t o : xalphas @ hostname
waisaddress
waisindex | waisdoc
waisindex
w a i s : / / hostport / database [ ? search ]
waisdoc
w a i s : / / hostport / database / wtype / wpath
wpath
digits = path ; [ wpath ]
groupart
* | group | article
group
ialpha [ . group ]
article
xalphas @ host
database
xalphas
wtype
xalphas
prosperoaddress
prosperolink
prosperolink
p r o s p e r o : / / hostport / hsoname [ % 0 0 version [ attributes ] ]
hsoname
path
version
digits
attributes
attribute [ attributes ]
attribute
alphanums
telnetaddress
t e l n e t : / / login
gopheraddress
g o p h e r : / / hostport [/ gtype [ gcommand ] ]
login
[ user [ : password ] @ ] hostport
hostport
host [ : port ]
host
hostname | hostnumber
ftptype
A formcode | E formcode | I | L digits
formcode
N | T | C
cellname
hostname
hostname
ialpha [ . hostname ]
hostnumber
digits . digits . digits . digits
port
digits
gcommand
path
path
void | segment [ / path ]
segment
xpalphas
search
xalphas [ + search ]
user
alphanum2 [ user ]
password
alphanum2 [ password ]
fragmentid
xalphas
gtype
xalpha
alphanum2
alpha | digit | - | _ | . | +
xalpha
alpha | digit | safe | extra | escape
xalphas
xalpha [ xalphas ]
xpalpha
xalpha | +
xpalphas
xpalpha [ xpalphas ]
ialpha
alpha [ xalphas ]
alpha
a | b | c | d | e | f | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v | w | x | y | z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z
digit
0 |1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
safe
$ | - | _ | @ | . | & | + | -
extra
! | * | " | ' | ( | ) | ,
reserved
= | ; | / | # | ? | : | space
escape
% hex hex
hex
digit | a | b | c | d | e | f | A | B | C | D | E | F
national
{ | } | vline | [ | ] | \ | ^ | ~
punctuation
< | >
digits
digit [ digits ]
alphanum
alpha | digit
alphanums
alphanum [ alphanums ]
void
(end of URL BNF)