From 27ad2a900c667b9d0b4c1cd5e7254884d4bd72a4 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Tue, 22 Sep 2020 10:50:07 +0200 Subject: [PATCH] changed all prog indices to size_t; added explanatory comments to ivars --- interpreter.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/interpreter.hpp b/interpreter.hpp index f9ace33..ad0049a 100644 --- a/interpreter.hpp +++ b/interpreter.hpp @@ -32,13 +32,13 @@ class interpreter { std::string eval(std::istream& in, bool& done); private: - std::vector _prog; - std::vector _stack; - std::map _labels; - std::map _vars; - std::vector _calls; - std::vector::size_type _pc {0}; - std::vector _pc_offsets; + std::vector _prog; // program lines without label defs or comments + std::vector _stack; // value stack + std::map _labels; // label name => prog line index + std::map _vars; // var name => string value + std::vector _calls; // call stack + size_t _pc {0}; // current program counter (index into _prog) + std::vector _pc_offsets; // removed line indices for prog index => source line void reset(); void exec_instruction(const std::string& code, bool& done);