List<Symbol> Follow(Formula formula, bool terminal = true) { List<Symbol> list = new List<Symbol>(); foreach (var symbol in formula.Symbols) { if (symbol.IsTerminal == terminal) list.Add(symbol); } return list; }
Symbol First(Formula formula, bool terminal = true) { foreach (var symbol in formula.Symbols) { if (symbol.IsTerminal == terminal) return symbol; } return null; }