- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cpp
More file actions
Latest commit
19 lines (17 loc) · 515 Bytes
/
Copy pathProgram.cpp
File metadata and controls
19 lines (17 loc) · 515 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include"Program.h"
Instruction Program::operator[] (size_t index) {
switch ((*code)[index]) {
case'>': return Instruction::NEXT;
case'<': return Instruction::PREV;
case'+': return Instruction::INC;
case'-': return Instruction::DEC;
case'.': return Instruction::PRINT;
case',': return Instruction::READ;
case'[': return Instruction::FWD;
case']': return Instruction::BACK;
default: return Instruction::NOOP;
}
}
size_tProgram::length() {
return code->size();
}