Ported Peter Norvig's parse into ruby.