Browse Source

Fix input instruction

master
garritfra 4 years ago
parent
commit
7a7e86f06f
  1. 2
      src/interpreter.rs
  2. 7
      src/main.rs

2
src/interpreter.rs

@ -19,6 +19,8 @@ pub fn run(instructions: &Vec<Instruction>, tape: &mut Vec<u8>, ptr: &mut usize)
std::io::stdin()
.read_exact(&mut input)
.expect("failed to read stdin");
tape[*ptr] = input[0];
}
}
}

7
src/main.rs

@ -10,12 +10,7 @@ fn main() {
}
let mut ptr = 512;
interpreter::run(
&parser::parse(lexer::lex("++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
")),
&mut tape,
&mut ptr,
)
interpreter::run(&parser::parse(lexer::lex(",[>+<-]>.")), &mut tape, &mut ptr)
}
#[cfg(test)]

Loading…
Cancel
Save