Related smells: Useless Control Flow
Grammar combinators (metasymbols of arity 1 and up) such as the Kleene star and cross, or an optional, can be combined in an improper way. For example, a grammar engineer who defines A ::= B?;
and B ::= C?;
, may mean well, but creates a confusing contract if A
is used to bind a textual structure with a tree structure: it is ambiguous what an empty string corresponds to – an empty node A
or a node A
containing an empty node B
. Some of these issues may be harder to detect due to indirection, but they are all automatically fixable.