added 2 code files; added enl instruction; completed main to do the right thing
This commit is contained in:
@ -119,6 +119,7 @@ void interpreter::exec_instruction(const std::string& code, bool& done) {
|
||||
else if (code == "gge") gge();
|
||||
else if (code == "fun") fun();
|
||||
else if (code == "ret") ret();
|
||||
else if (code == "enl") enl();
|
||||
else throw syntax_error {code};
|
||||
}
|
||||
|
||||
@ -271,6 +272,14 @@ void interpreter::rot() {
|
||||
_pc++;
|
||||
}
|
||||
|
||||
void interpreter::enl() {
|
||||
std::string val {_stack.back()};
|
||||
_stack.pop_back();
|
||||
val += '\n';
|
||||
_stack.push_back(val);
|
||||
_pc++;
|
||||
}
|
||||
|
||||
// tests & jumps ----------------------------------------------------------
|
||||
|
||||
void interpreter::gto() {
|
||||
|
Reference in New Issue
Block a user