示例#1
0
        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());
        }
示例#2
0
 internal static bool IsNonterminalSymbol(Symbol symbol)
 {
     return(NonterminalSymbols.Contains(symbol));
 }
示例#3
0
 public Production(Symbol lhs, RegEx <Symbol> rhs)
 {
     Lhs = lhs;
     Rhs = rhs;
     NonterminalSymbols.Add(lhs);
 }