Good point, leatherback; I just went for the 'string processing' interpretation of the problem, and neglected to mention that. One is going to have to look at the TLD, and if it's national (.nl, .uk, .de, .au) and then look under that - keeping in mind that .uk and .au further subdivide their name space into things like .co and .ac (in the UK) or .com and .edu (in Australia), while others (the Netherlands and Germany) don't.
Once you've got that out of the way, the last piece would be the domain, while all the bits below it (there might be more than one) are parts of the subdomain. And again, as you've pointed out, there might not be any bits left, and the server would be assuming a default subdomain.
It should be noted that the W3C recommends not assuming anything about a URL's domain name actually means anything beyond the claim that that the thing is a domain name (at least for http). All the detail below that level is supposed to be treated as "opaque", without further interpretation.