Esempio n. 1
0
        public static void ShowDemo()
        {
            Console.WriteLine("===== 基本的 解释器模式 演示. =====");

            Context context = new Context();
            IList<AbstractExpression> list = new List<AbstractExpression>();
            list.Add(new TerminalExpression());
            list.Add(new NonterminalExpression());
            list.Add(new NonterminalExpression());
            list.Add(new TerminalExpression());

            foreach (AbstractExpression exp in list)
            {
                exp.Interpret(context);
            }
        }
 public override void Interpret(Context context)
 {
     Console.WriteLine("非终端解释器");
 }
 public abstract void Interpret(Context context);