Exemplo n.º 1
0
        /// <summary>
        /// Entry point of the application.
        /// </summary>
        /// <param name="args">Command line arguments.</param>
        public static void Main(string[] args)
        {
            // Set start parameters
            SetStartParameters(args);

            // Initialize output / input
            InitializeOutputAction();
            InitializeInputFunction();

            // Initialize interpreter
            BFInterpreter bfi = new BFInterpreter(memoryLimit, input, output, codebase);

            // Run
            bfi.Execute(codebase);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Initializes a new interpreter.
        /// </summary>
        /// <param name="memorySize">Size of the memory.</param>
        private void InitializeInterpreter(int memorySize)
        {
            // Output action
            Action<int> output = this.GetOutputMethod();

            // Input function
            Func<int> input = this.GetInputMethod();

            if (input == null)
                return;

            // Initialize interpreter object
            this.bfi = new BFInterpreter(memorySize, input, output, this.BEditor.Text);
        }