Add a group-by generator

This adds a group-by generator, along with documentation and a test
case.

Signed-off-by: Gergely Nagy <algernon@madhouse-project.org>