When creating the grammar for parsing a list (something like “
ITEM*”) with a LALR(1) parser, this basically can be done in two ways:
list : list ITEM | ;
list : ITEM list | ;
What are the pros and cons of these two possibilities? In general, can an advice be given which one to choose, or does this depend on the complete grammar?
What about the case “
list : list ITEM | ITEM ;
list : ITEM list | ITEM ;
Do the same pros and cons apply here, or others?