zenspider.com by ryan davis

I haven’t gotten a good testing methodology formalized yet, but a good way to start with antlr is to write several usecases from a parsing perspective. Basically, a series of gramatically correct files that don’t have much discernable meaning. From those, start to grok the top levels of the grammar.

I have a very particular style, but I’ve found that I keep reusing my lexical rules over and over. This may be true for others as well. What I haven’t done is to make a reusable lexical class that I subclass for the current grammar. This would be nice, but it would really need a more serious testing strategy than what I currently use.

Keep your grammar simple. If it can be like (simplified) English, then let it be that way. There is little reason why esoteric symbols are necessary, and writing languages is about extracting the knowledge of some system into a codable vocabulary.

Start from the top, work your way down, that is the way of LL parsing.

In time I will add more lower level hints that are very specific to Antlr. Some idioms are relevant.