Implement pointm

master
Raymon Zutekouw 3 years ago
parent 9a54fe353d
commit b05b286d57
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 9
      src/main.rs

@ -114,7 +114,14 @@ fn instruct(statement: Pair<Rule>, state: &mut State, out: &mut Builder) {
Rule::pointm => { Rule::pointm => {
let variable_name = extract_operand(statement); let variable_name = extract_operand(statement);
println!("Pointing back to marker variable {}", variable_name); println!("Pointing back to marker variable {}", variable_name);
out.append("pointm\n"); let address = state
.variables
.get(variable_name)
.unwrap_or_else(|| panic!("Marker variable '{}' did not exists", variable_name))
.address;
// thank you mixtela
out.append("<+[-<+]-");
state.mem_pointer = address;
} }
Rule::add => { Rule::add => {
let constant = extract_operand(statement); let constant = extract_operand(statement);

Loading…
Cancel
Save