Emit start_grouping as well as end_grouping. Fixed a bug with consecutive end_groupings.

For bulletproofing, generate fake start_grouping elements, so that we
can fail correctly if we don't recognize an element that takes a
subgroup. While fixing this I found a problem with nested groups ending
simultaneously and fixed that.