Exemplo n.º 1
0
        public static void Main(string[] args)
        {
            Interpreter interpreter = new Interpreter();
            Type type = interpreter.GetType();
            const string stopWord = "exit";
            Console.WriteLine("SemanticLib Interpreter {0}.", type.Assembly.GetName().Version);
            Console.WriteLine(string.Format("Press \"{0}\" to exit.", stopWord));

            for (; ; )
            {
                Console.Write("> ");
                string input = Console.ReadLine();

                if (!string.IsNullOrWhiteSpace(input))
                {
                    if (string.Equals(input, stopWord, StringComparison.InvariantCultureIgnoreCase))
                    {
                        break;
                    }
                    else
                    {
                        try
                        {
                            interpreter.Execute(input);
                        }
                        catch (Exception exception)
                        {
                            Console.WriteLine(exception.Message);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            _interpreter = new Interpreter();
            Type type = _interpreter.GetType();
            Title = string.Format("SemanticLib Interpreter {0}", type.Assembly.GetName().Version);

            txtCode.AppendText("> ");
        }