revert parse being a part of machine.rs

This commit is contained in:
2021-09-20 14:23:06 +02:00
parent 3923b278fc
commit 8184d31e4f

View File

@@ -29,22 +29,18 @@ pub struct Machine<'a> {
} }
impl<'a> Machine<'a> { impl<'a> Machine<'a> {
pub fn new(code: &str, input: &'a mut BufReader<Box<dyn Read>>, output: &'a mut BufWriter<Box<dyn Write>>) -> Self { pub fn new(code: Vec<Instruction>, input: &'a mut BufReader<Box<dyn Read>>, output: &'a mut BufWriter<Box<dyn Write>>) -> Self {
Machine { Machine {
ip: 0, ip: 0,
mp: 0, mp: 0,
buf: [0; 1], buf: [0; 1],
memory: [0; 50000], memory: [0; 50000],
code: parse(code), code,
input, input,
output, output,
} }
} }
pub fn parse(code: &str){
return;
}
pub fn execute(&mut self){ pub fn execute(&mut self){
// prevent ip from getting out of bounds // prevent ip from getting out of bounds
while self.ip < self.code.len() { while self.ip < self.code.len() {