revert parse being a part of machine.rs
This commit is contained in:
@@ -29,22 +29,18 @@ pub struct 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 {
|
||||
ip: 0,
|
||||
mp: 0,
|
||||
buf: [0; 1],
|
||||
memory: [0; 50000],
|
||||
code: parse(code),
|
||||
code,
|
||||
input,
|
||||
output,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse(code: &str){
|
||||
return;
|
||||
}
|
||||
|
||||
pub fn execute(&mut self){
|
||||
// prevent ip from getting out of bounds
|
||||
while self.ip < self.code.len() {
|
||||
|
||||
Reference in New Issue
Block a user