Vadim Zaytsev aka @grammarware

GraSs: A Taxonomy of Grammar Smells


Organisation
global problems
Navigation
problems with navigating through the grammar
Structure
harmful relationships among grammar components

Convention
violations of visual policies
Notation
metalanguage-related
Parsing
parsing techniques related smells
Duplication
the same fragment is repeated

Underuse
inferior substitutes are used instead of an available feature
Overspec
the same constraint specified through several means
Priorities
not present or circular
Singleton
trivial choice, sequence or conjunction
Combo
double modifier creates an ambiguity
Chant
comments cover up bad code
Deprecated
the use of a feature that is no longer welcome
Exotic
too idiosyncratic notational features decrease portability

Underuse Edit!

The original BNF used for early ALGOL versions, did not yet borrow Kleene star and Kleene cross from the regular expressions, and early parser specification notations were just as limited. Grammars written with those notations in mind (not necessarily for using them!), suffer from so-called “yaccification” [FME-2001-Lammel][ICSM-2001-JongeM], when all repetitions are written out explicitly as additional left-recursive nonterminals. This pattern is well-known to be harmful since it reduces grammar's both readability (yaccification is basically an encoding move, not a modelling one) and portability (a left-recursive grammar is often useless or suboptimal for top-down parsing).

There can be other similar patterns falling under the same smell description: for instance, separator lists are concisely and efficiently handled by many grammar notations, and if one of those is used, should not be written out with group repetition or recursion.


The GraSs taxonomy is a joint effort maintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Page last updated in March 2021.
XHTML 1.1 CSS 3