If you accidentally define two rules with the same name, the parser generator will generate faulty code making it very difficult to troubleshoot. It should throw an error instead.
Example grammar:
#go:build grammars
# +build grammars
package experiments
type Test Peg {}
Expression <-
FOO { fmt.Println("FOO") }
BAR { fmt.Println("BAR") } !.
FOO <- "foo"
BAR <- "bar"
FOO <- "foo"
More specifically, the parser generator seems to omit one of the rules from the rule array, causing subsequent indices to mismatch and the wrong rules being invoked.