Clear exposition of theory demands separate small self-contained algorithms to find problems.
A terminal is well-founded. A rule producing only well-founded symbols is well-founded. A symbol which produces a well-founded rule is well-founded. Induction applies. Ill-founded symbols are a grammar bug. The present notion of a non-productive symbol is demonstrably broken.
If all symbols are well-founded, then reachability is a simple transitive-closure from the START symbol(s).
A symbol that produces itself (perhaps indirectly) introduces an infinite-ambiguity into the grammar. This is almost universally considered pathological. It should be noticed and dunned. Self-productions are trivial to catch. For mutual recursion, notice nontrivial strongly-connected components in the graph of unit-like productions.
Epsilon left-recursion is another possible disease of grammars: a point is created at which any number of "epsilon" productions may be tentatively recognized. Consider a graph from symbols to those they may produce before producing a terminal: the union of the null-able prefixes of all their rules. If there are any self-links or nontrivial SCCs, this pathology is diagnosed.
Clear exposition of theory demands separate small self-contained algorithms to find problems.
A terminal is well-founded. A rule producing only well-founded symbols is well-founded. A symbol which produces a well-founded rule is well-founded. Induction applies. Ill-founded symbols are a grammar bug. The present notion of a non-productive symbol is demonstrably broken.
If all symbols are well-founded, then reachability is a simple transitive-closure from the START symbol(s).
A symbol that produces itself (perhaps indirectly) introduces an infinite-ambiguity into the grammar. This is almost universally considered pathological. It should be noticed and dunned. Self-productions are trivial to catch. For mutual recursion, notice nontrivial strongly-connected components in the graph of unit-like productions.
Epsilon left-recursion is another possible disease of grammars: a point is created at which any number of "epsilon" productions may be tentatively recognized. Consider a graph from symbols to those they may produce before producing a terminal: the union of the null-able prefixes of all their rules. If there are any self-links or nontrivial SCCs, this pathology is diagnosed.