mod vm;
mod command;
mod parse;
mod program;

use vm::VM;
use program::Program;
use std::io::Write;

fn main() {
    let mut vm = VM::new();
    let mut program = Program::new();
    loop {
        print!("{}", "bf> ");
        std::io::stdout().flush().unwrap();

        let mut line = String::new();
        let commands = match std::io::stdin().read_line(&mut line) {
            Ok(0) => break,
            Ok(_) => parse::parse(&line),
            Err(error) => panic!(error),
        };
        program.append(&commands);
        program.execute(&mut vm);
    }
}

mod vm;
mod command;
mod parse;
mod program;

use vm::VM;
use std::io::Write;

fn main() {
    let mut vm = VM::new();
    loop {
        print!("{}", "bf> ");
        std::io::stdout().flush().unwrap();

        let mut line = String::new();
        let commands = match std::io::stdin().read_line(&mut line) {
            Ok(0) => break,
            Ok(_) => parse::parse(&line),
            Err(error) => panic!(error),
        };
        vm.apply_many(&commands);
    }
}

--- 
+++ 
@@ -4,10 +4,12 @@
 mod program;
 
 use vm::VM;
+use program::Program;
 use std::io::Write;
 
 fn main() {
     let mut vm = VM::new();
+    let mut program = Program::new();
     loop {
         print!("{}", "bf> ");
         std::io::stdout().flush().unwrap();
@@ -18,6 +20,7 @@
             Ok(_) => parse::parse(&line),
             Err(error) => panic!(error),
         };
-        vm.apply_many(&commands);
+        program.append(&commands);
+        program.execute(&mut vm);
     }
 }
Change runtime of REPL to proxy through program
