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

Factoring
improper factoring or distribution
1SidedRecursion
left or right recursive rules
Superset
parser spec is too relaxed
Shotgun
a chunk of input could be parsed in more detail
NoDefault
no error-localising default branch
Action
a code smell in a semantic action

Shotgun Edit!

Related smells: Missing Abstraction, Missing Abstraction

Shotgun parsing is a term used in cybersecurity to represent an architecture where a proper parser is substituted with lightweight treatment (by regular expression matches and direct string manipulation) [Shotgun12]. The name comes from the fact that in a pipeline of tools built with such defects, the problems quickly multiply with each step when the receiver is applying Postel's Law in trying to be relaxed with its input [Sassaman2012], and is known to cause all kinds of subtle bugs in software language processing [Flexible2015]. We define the Shotgun smell as a situation when the grammatical bind is too loose on one of its ends. For example, imagine function arguments in a C-like language to be parsed as a parenthesis-enclosing string which is expected to be split into a proper list by the code that uses the resulting tree. This smell was not seen within grammars of the Grammar Zoo, but was observed in the industrial setting when time pressure got the best of grammar engineers.


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