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

Diamond Edit!

Related smells: Ambiguous Interfaces

A well-known pattern in dependency and inclusion is then a class A inherits from class X and class B also inherits from class X, but class C inherits from both A and B and thus gets to see double of each of X's elements. The problem is solved differently in different programming and modelling languages – in grammars, it causes an ambiguity (ISO/IEC 23270:2003(E), Information technology — Programming languages — C Sharp, extracted):


reference-type ::= class-type | interface-type
                 | delegate-type | ... ;
class-type ::= type-name | "object" | "string";
interface-type ::= type-name ;
delegate-type ::= type-name ;

Parsing something recognisable as type-name will cause at least a triple ambiguity since it will be an acceptable class-type, interface-type as well as delegate-type [Too-Sharp2005].


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