Related smells: Missing Hierarchy, Repeated Conditionals
In classic by-the-book [PT-GJ] non-memoising parsing, if alternative production rules from the same nonterminal start from the same symbols, these would have to be reparsed in each of the branches. As a real example (Doug Cooper, Scott Moore, Pascal grammar in Yacc format, fetched):
open_if_statement
: IF boolean_expression THEN statement
| IF boolean_expression THEN closed_statement
ELSE open_statement;
Interestingly, this example is a false positive: factoring the first three symbols into a separate nonterminal will clutter the grammar without bringing any noticeable benefits (and will introduce the Weak smell). In other cases, this smell has been avoided/removed (The Dart Team, Dart Programming Language Specification, extracted):
ifStatement ::= "if" "(" expression ")" statement
("else" statement)?