示例#1
0
        static void Main(string[] args)
        {
            var nameManager = new NameManager();
            var loader      = new FunctionLoader(nameManager);
            var parser      = new ExpressionParser(nameManager);

            //loader.LoadFunctionsFromAssembly("D:\\StackArithmeticCoreFunctions.dll");
            //var expression = parser.Parse("5 2 + 5 1 + -");
            loader.LoadFunctionsFromAssembly(typeof(NameManager).Assembly);

            while (true)
            {
                Console.WriteLine("Supported commands: 'load' ");
                Console.WriteLine("1)load");
                Console.WriteLine("2)execute");
                Console.WriteLine("3)exit");
                Console.Write("#: ");
                var command         = Console.ReadLine();
                var commandElements = command.Split(' ');
                switch (commandElements[0])
                {
                case "load":
                    LoadAssembly(loader, commandElements.Skip(1));
                    break;

                case "execute":
                    Execute(parser, commandElements.Skip(1));
                    break;

                case "exit":
                    return;
                }
            }
        }
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            _nameManager      = new NameManager();
            _functionLoader   = new FunctionLoader(_nameManager);
            _expressionParser = new ExpressionParser(_nameManager);

            _functionLoader.LoadFunctionsFromAssembly(typeof(NameManager).Assembly);
            lbLibraries.Items.Add("StackArithmetic.dll");
            UpdateFuntionList();
        }