Пример #1
0
        static void Main(string[] args)
        {
            if (args[0] == "")
            {
                Console.WriteLine("Please specify a brainfuck program to run!");
                Console.WriteLine("EXAMPLE: brainfuckvm.exe path/to/program.bf");

                return;
            }

            BrainfuckIntLib.Program program = new BrainfuckIntLib.Program(new System.IO.FileInfo(args[0]));

            ManualResetEvent mrse = new ManualResetEvent(false);

            new Interpreter(program).RunProgram(mrse);
            mrse.WaitOne();
        }
Пример #2
0
        private void msFile_LoadProgram_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                FileInfo file = new FileInfo(ofd.FileName);
                if (!file.Exists)
                {
                    string message = $"Program does not exist! ### {file.FullName}";
                    Console.WriteLine(message);
                    MessageBox.Show(message);
                    return;
                }

                this.LoadedProgram = new BrainfuckIntLib.Program(file, true);
            }
        }