Make parse_grammar parse rules in a loop
Make parsing functions capable of returning errors