From 5500df399145ab2a4ab98a5e9e0097c862dcde3b Mon Sep 17 00:00:00 2001 From: ChUrl Date: Tue, 21 Mar 2023 18:34:50 +0100 Subject: [PATCH] Add JMP and NOP instructions --- src/lexer/Lexer.cpp | 2 +- src/parser/Parser.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lexer/Lexer.cpp b/src/lexer/Lexer.cpp index ef344bc..82b7e7a 100644 --- a/src/lexer/Lexer.cpp +++ b/src/lexer/Lexer.cpp @@ -48,7 +48,7 @@ auto is_mnemonic(const Token &token) -> bool { // TODO: Move this to a separate header const std::vector mnemonics = {"MOV", "AND", "OR", "NAND", "NOR", "ADD", "SUB", - "JEQ", "JLE", "JLEQ", "JNEQ", "JGR", "JGEQ"}; + "JMP", "JEQ", "JLE", "JLEQ", "NOP", "JNEQ", "JGR", "JGEQ"}; return std::find(mnemonics.begin(), mnemonics.end(), static_cast(token)) != mnemonics.end(); diff --git a/src/parser/Parser.h b/src/parser/Parser.h index a5bdb87..108841e 100644 --- a/src/parser/Parser.h +++ b/src/parser/Parser.h @@ -43,9 +43,11 @@ private: {"NOR", &Parser::alu}, {"ADD", &Parser::alu}, {"SUB", &Parser::alu}, + {"JMP", &Parser::jmp}, {"JEQ", &Parser::jmp}, {"JLE", &Parser::jmp}, {"JLEQ", &Parser::jmp}, + {"NOP", &Parser::jmp}, {"JNEQ", &Parser::jmp}, {"JGR", &Parser::jmp}, {"JGEQ", &Parser::jmp}};