|
|
|
@ -49,7 +49,7 @@ impl Program {
|
|
|
|
|
self.vars.insert(argument_vec[0], argument_vec[1]); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn eval(&mut self, instruction: &String) { |
|
|
|
|
fn parse(&mut self, instruction: &String) { |
|
|
|
|
let opcode = instruction.chars().collect::<Vec<char>>()[0]; |
|
|
|
|
let arguments = &instruction[1..]; |
|
|
|
|
|
|
|
|
@ -69,7 +69,7 @@ impl Program {
|
|
|
|
|
while self.pc < self.data.len() { |
|
|
|
|
let instruction = self.data[self.pc].to_owned(); |
|
|
|
|
|
|
|
|
|
self.eval(&instruction); |
|
|
|
|
self.parse(&instruction); |
|
|
|
|
|
|
|
|
|
self.pc = self.pc + 1; |
|
|
|
|
} |
|
|
|
@ -85,7 +85,7 @@ impl fmt::Display for Program {
|
|
|
|
|
fn main() { |
|
|
|
|
let args: Vec<String> = env::args().collect(); |
|
|
|
|
if args.len() == 1 { |
|
|
|
|
panic!("You must provide an argument!"); |
|
|
|
|
panic!("You must provide a filename!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
let filename = &args[1]; |
|
|
|
|