BNF syntax

This is a BNF-like description of the Uniform Resource Locator syntax. A vertical line "|" indicates alternatives, and [brackets] indicate optional parts. Spaces are representated 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 "generic" production gives a higher level parsing of the same URLs as the other productions. The "national" and "punctuation" characters fo 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

fragmentaddress
uri [ # fragmentid ]
uri
url
ur
l
generic | httpaddress | ftpaddress | newsaddress | prosperoaddress | telnetaddress | gopheraddress | waisaddress | afsaddress
generic
scheme : path [ ? search ]
scheme
ialpha
httpaddress
h t t p : / / hostport [ / path ] [ ? search ]
ftpaddress
f t p : / / login / path
afsaddress
a f s : / / cellname / path
newsaddress
n e w s : groupart
waisaddress
waisindex | waisdoc
waisindex
w a i s : / / hostport / database [ ? search ]
waisdoc
w a i s : / / hostport / database / wtype / digits / path
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 [ selector ] ] [ ? search ]
login
[ user [ : password ] @ ] hostport
hostport
host [ : port ]
host
hostname | hostnumber
cellname
hostname
hostname
ialpha [ . hostname ]
hostnumber
digits . digits . digits . digits
port
digits
selector
path
path
void | xpalphas [ / path ]
search
xalphas [ + search ]
user
xalphas
password
xalphas
fragmentid
xalphas
gtype
xalpha
xalpha
alpha | digit | safe | extra | escape
xalphas
xalpha [ xalphas ]
xpalpha
xalpha | +
xpalphas
xpalpha [ xpalpha ]
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
! | * | " | ' | ( | ) | : | ; | , | 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