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

Spaghetti
scattering details over the grammar
Shortage
incompleteness
Mixture
spicing the grammar with alien fragments

AlmostAlphabet
seemingly incomplete collections
ConfusingEntry
no starting symbol
Dead
nonterminal defined, but not referenced
Bottom
nonterminal referenced, but not defined
Debt
incompletenesses covered up by todo/fixme comments

ConfusingEntry Edit!

With StartInTheMiddle we have already addressed positioning of the starting symbol of the grammar, but there can be three more problems with it. First, some grammars do not have any start specified at all. There are heuristics that work well on otherwise perfect grammars, and assign it to be the only top nonterminal (defined but not referenced). Second, there can be multiple starts, especially for notations that exceed with classic CFGs. This can indicate several independent grammars that got merged into one, or just several entry points into the grammar (which would allow, for example, to parse statements or expressions out of context – it is a not quite challenging exercise in theory, but extremely useful in practical grammarware engineering when integrating software languages with an IDE and a debugger). The third issue arises when the root symbol is properly marked as such, but is also referenced from other nonterminals in the grammar (so the starting symbol is not a top nonterminal).

The exact harmfulness of this smell heavily depends on the grammar handling framework.


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