Working with grammar files recently, it was frustrating trying to write tests and prevent regressions as you add more and more rules. I was adding more specific definitions and user’s kept reporting further regressions.
Sublime Text recently introduced a new syntax definition format, which included a nice fixture based testing format. It allows you to write validations inline in example source files, allowing both automated tests as well as easy visual inspection while developing. I wrote an “inspired” version for Atom, called Atom Grammar Test that allows you to write similar fixtures.