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

Echo
same rule occurs twice or more
Clone
same right hand side occurs twice or more
Foldable
nonterminal's right hand side is not unique
Common
common subexpressions
Permuted
permutations in commutative combinators
Lookalike
near-clones

Common Edit!

Related smells: Data Clumps, Reinvent the Wheel, Duplicate Block, Duplicated Formulas, Connector Envy

One step further, we may observe clones between two or more subexpressions found in different places in the grammar. The detection pattern is almost the same as with Foldable, but the solution must involve creating a new nonterminal and then folding it (extract in the terminology of [IFM-2009-LammelZ][SCAM-J-2009-LammelZ11]). Since creating a new nonterminal implies inventing a new name for it, and only suboptimal heuristics are available, the removal of this smell cannot be properly fully automated.


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