Implement basic add and sub

master
Raymon Zutekouw 3 years ago
parent 0bdd6364a7
commit 123c1cee64
No known key found for this signature in database
GPG Key ID: 1E9BCC39EDD1DD53
  1. 4
      src/main.rs

@ -125,7 +125,7 @@ fn instruct(statement: Pair<Rule>, state: &mut State, out: &mut Builder) {
"Addition of '{}', decimal value is {}",
constant, constant_parsed
);
out.append("add\n");
out.append("+".repeat(constant_parsed as usize));
}
Rule::addb => {
let constant = extract_operand(statement);
@ -148,7 +148,7 @@ fn instruct(statement: Pair<Rule>, state: &mut State, out: &mut Builder) {
"Subtraction of '{}', decimal value is {}",
constant, constant_parsed
);
out.append("sub\n");
out.append("-".repeat(constant_parsed as usize));
}
Rule::subb => {
let constant = extract_operand(statement);

Loading…
Cancel
Save