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

Lookalike Edit!

Related smells: Reinvent the Wheel

In mainstream clone detection research, people distinguish between clones of different types: exact clones (“type 1”) with identical literal duplicates; parametrised clones (“type 2”) with variations in identifier names, literals, even variable types; near miss clones (“type 3”) where statements are allowed to be changed, added or removed up to some extent; semantic clones (“type 4”) as the same computation with a different syntax and possibly even different algorithms; structural clones – higher level similarities, conceptually bottom-up-detected implementation patterns; and artefact clones – function clones and file clones [Roy2009]. For grammars, there is no developed theory of clone management, so the questions are open on what constitutes a proper clone, what classes of clones are there, which ones are useful to detect and which to refactor, etc. It makes sense to assume that clone detection in grammars will bear some similarity to contextual clones [Martin2011] that worked for another DSL with relatively few constructs, where clones were detected based on the context of clone candidate fragments, and not on their structure per se.


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