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

Proxy
indirect uses
Dependency
antipatterns in use
Complexity
metric-based smells

Diamond
A is X and B is X, but C is A or B
Rivalry
overlapping alternatives
Ouroboros
a circular dependency among modules
Soulmates
nonterminals or modules are always changed together
Spillover
a nonterminal that is too linked to the adjacent symbols
Mythic
an alternative that is never exercised in the codebase

Soulmates Edit!

Related smells: Implicit Cross-Module Dependency, Parallel Inheritance Hierarchies, Shotgun Surgery, Shotgun Surgery, Feature Envy, Feature Envy, Inappropriate Intimacy, Inappropriate Intimacy

If enough information is available about the evolution of the grammar (e.g., in a form of a versioned repository or a piece of documentation describing all changes), one can notice two nonterminals having a so-called co-change relationship when each revision that changes one, also changes the other. The smell occurs when this co-change relationship in the revision log does not correspond to explicit dependencies between modules and nonterminals.

In the absence of change history, a thought experiment may serve the same purpose: if a nonterminal X is to change in a particular way, what other nonterminals will have to be inevitably co-updated to preserve the consistency of the grammar? All of those, if any, are its Soulmates. It deserves mentioning that the programming counterpart of this smell, called “Feature Envy”, is often detectable automatically through static code analysis. The Soulmates smell, however, is only detectable with revision mining or conceptual analysis.


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