public override string ToString() { StringBuilder result = new StringBuilder(); TerminalSymbols.ForEach(symbol => { if (symbol != Helper.IdentitySymbol && symbol != Helper.EmptySymbol) { result.Append(String.Format("{0}, ", symbol)); } }); result.Remove(result.Length - 2, 2); result.Append(";" + Environment.NewLine); NonterminalSymbols.ForEach(symbol => result.Append(String.Format("{0}, ", symbol))); result.Remove(result.Length - 2, 2); result.Append(";" + Environment.NewLine); result.Append(Rules.GetString()); result.Append(";" + Environment.NewLine); result.Append(StartSymbol); return(result.ToString()); }
internal static bool IsNonterminalSymbol(Symbol symbol) { return(NonterminalSymbols.Contains(symbol)); }
public Production(Symbol lhs, RegEx <Symbol> rhs) { Lhs = lhs; Rhs = rhs; NonterminalSymbols.Add(lhs); }