Recursive decent parser mapped out in Ruby