Smart parsing (first pass) is done

Now parsing of grammars containing the empty string seems to work as well. It
spurred a bit of development of sorted streams too (the takeWhile method). It
was a little tricky but I think it's done now.