static <T> List<Symbol<T>> select(
		final NonTerminal<T> rule,
		final Cfg<T> cfg,
		final SymbolIndex index
	) {
		return cfg.rule(rule)
			.map(r -> r.alternatives()
				.get(index.next(r, r.alternatives().size()))
				.symbols())
			.orElse(List.of());
	}
Standard algorithm for selecting a list of alternative symbols from the
given {@code rule}.

@param rule the rule to select the alternative from
@param cfg the grammar to select the alternative from
@param index the symbol selection strategy
@param <T> the terminal type
@return the selected symbols
@throws NullPointerException if one of the arguments is {@code null}
jenetics.ext/src/main/java/io/jenetics/ext/grammar/Generator.java