diff --git a/DMS/DMS.cpp b/DMS/DMS.cpp
index e171cd9..65196f8 100644
--- a/DMS/DMS.cpp
+++ b/DMS/DMS.cpp
@@ -20,7 +20,7 @@ using namespace dms;
using namespace dms::utils;
int main()
{
- /*LineParser parser = LineParser("test.dms");
+ LineParser parser = LineParser("test.dms");
dms_state* state = parser.Parse();
- state->dump();*/
+ state->dump();
}
\ No newline at end of file
diff --git a/DMS/DMS.vcxproj b/DMS/DMS.vcxproj
index feca9af..fa87578 100644
--- a/DMS/DMS.vcxproj
+++ b/DMS/DMS.vcxproj
@@ -172,34 +172,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/DMS/DMS.vcxproj.filters b/DMS/DMS.vcxproj.filters
index ddf43fc..1dcf68d 100644
--- a/DMS/DMS.vcxproj.filters
+++ b/DMS/DMS.vcxproj.filters
@@ -105,18 +105,4 @@
Header Files\DMS
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DMS/Debug/DMS.log b/DMS/Debug/DMS.log
index ff714f1..ae767a8 100644
--- a/DMS/Debug/DMS.log
+++ b/DMS/Debug/DMS.log
@@ -1,2 +1,2 @@
- DMS.cpp
+ LineParserParse.cpp
DMS.vcxproj -> F:\VSCWorkspace\DMS\Debug\DMS.exe
diff --git a/DMS/Debug/DMS.obj b/DMS/Debug/DMS.obj
index c122251..a3202b5 100644
Binary files a/DMS/Debug/DMS.obj and b/DMS/Debug/DMS.obj differ
diff --git a/DMS/Debug/DMS.tlog/CL.command.1.tlog b/DMS/Debug/DMS.tlog/CL.command.1.tlog
index 7c61d14..99fa6d5 100644
Binary files a/DMS/Debug/DMS.tlog/CL.command.1.tlog and b/DMS/Debug/DMS.tlog/CL.command.1.tlog differ
diff --git a/DMS/Debug/DMS.tlog/CL.read.1.tlog b/DMS/Debug/DMS.tlog/CL.read.1.tlog
index 8cabb47..61e2afc 100644
Binary files a/DMS/Debug/DMS.tlog/CL.read.1.tlog and b/DMS/Debug/DMS.tlog/CL.read.1.tlog differ
diff --git a/DMS/Debug/DMS.tlog/CL.write.1.tlog b/DMS/Debug/DMS.tlog/CL.write.1.tlog
index d81a7ef..49cbe52 100644
Binary files a/DMS/Debug/DMS.tlog/CL.write.1.tlog and b/DMS/Debug/DMS.tlog/CL.write.1.tlog differ
diff --git a/DMS/Debug/DMS.tlog/link.command.1.tlog b/DMS/Debug/DMS.tlog/link.command.1.tlog
index dc150d8..946d778 100644
Binary files a/DMS/Debug/DMS.tlog/link.command.1.tlog and b/DMS/Debug/DMS.tlog/link.command.1.tlog differ
diff --git a/DMS/Debug/DMS.tlog/link.read.1.tlog b/DMS/Debug/DMS.tlog/link.read.1.tlog
index b04f053..f951f26 100644
Binary files a/DMS/Debug/DMS.tlog/link.read.1.tlog and b/DMS/Debug/DMS.tlog/link.read.1.tlog differ
diff --git a/DMS/Debug/DMS.tlog/link.write.1.tlog b/DMS/Debug/DMS.tlog/link.write.1.tlog
index 46a805f..a88f3dc 100644
Binary files a/DMS/Debug/DMS.tlog/link.write.1.tlog and b/DMS/Debug/DMS.tlog/link.write.1.tlog differ
diff --git a/DMS/Debug/cmd.obj b/DMS/Debug/cmd.obj
index 1bf02e1..8a52926 100644
Binary files a/DMS/Debug/cmd.obj and b/DMS/Debug/cmd.obj differ
diff --git a/DMS/Debug/codes.obj b/DMS/Debug/codes.obj
index 9dead1c..5599cc0 100644
Binary files a/DMS/Debug/codes.obj and b/DMS/Debug/codes.obj differ
diff --git a/DMS/Debug/dms_exceptions.obj b/DMS/Debug/dms_exceptions.obj
index 9d56015..9390d03 100644
Binary files a/DMS/Debug/dms_exceptions.obj and b/DMS/Debug/dms_exceptions.obj differ
diff --git a/DMS/Debug/number_utils.obj b/DMS/Debug/number_utils.obj
index 4b63b57..2647506 100644
Binary files a/DMS/Debug/number_utils.obj and b/DMS/Debug/number_utils.obj differ
diff --git a/DMS/Debug/utils.obj b/DMS/Debug/utils.obj
index 2656fd0..168be0d 100644
Binary files a/DMS/Debug/utils.obj and b/DMS/Debug/utils.obj differ
diff --git a/DMS/Debug/value.obj b/DMS/Debug/value.obj
index 4f9877c..9a5bd4c 100644
Binary files a/DMS/Debug/value.obj and b/DMS/Debug/value.obj differ
diff --git a/DMS/Debug/vc142.idb b/DMS/Debug/vc142.idb
index b4435c7..7df7a45 100644
Binary files a/DMS/Debug/vc142.idb and b/DMS/Debug/vc142.idb differ
diff --git a/DMS/Debug/vc142.pdb b/DMS/Debug/vc142.pdb
index 674f70f..8e61a50 100644
Binary files a/DMS/Debug/vc142.pdb and b/DMS/Debug/vc142.pdb differ
diff --git a/DMS/LineParserMatchProcess.cpp b/DMS/LineParserMatchProcess.cpp
index 02b4892..3bc19f3 100644
--- a/DMS/LineParserMatchProcess.cpp
+++ b/DMS/LineParserMatchProcess.cpp
@@ -46,6 +46,26 @@ namespace dms {
return false;
}
bool LineParser::match_process_debug(tokenstream* stream) {
+ if (stream->match(tokens::newline, tokens::debug, tokens::string) || stream->match(tokens::newline, tokens::debug, tokens::name)){
+ stream->next();
+ stream->next();
+ if (state->isEnabled("debugging")) {
+ cmd* c = new cmd;
+ c->opcode = codes::DEBG;
+ if (stream->match(tokens::string)) {
+ c->args.push(buildValue(stream->next().name));
+ }
+ else {
+ c->args.push(buildVariable(stream->next().name));
+ }
+ current_chunk->addCmd(c);
+ return true;
+ }
+ else {
+ stream->next(); // Consume the third element anyway
+ return true; // This is a debugging match, but debugging is disabled. It's good!
+ }
+ }
return false;
}
bool LineParser::match_process_choice(tokenstream* stream) {
@@ -122,7 +142,7 @@ namespace dms {
// We consumed the option now lets do some matching, note that all of these are one liners in the bytecode!
if (match_process_function(stream,nullptr,false)) { // No returns and also no nesting of functions!
-
+ // We collect
}
else if (match_process_goto(stream)) {
current_chunk->addCmd(new cmd{codes::NOOP }); // Add noop to post-goto command
diff --git a/DMS/LineParserParse.cpp b/DMS/LineParserParse.cpp
index 736cc47..edb64da 100644
--- a/DMS/LineParserParse.cpp
+++ b/DMS/LineParserParse.cpp
@@ -269,6 +269,9 @@ namespace dms {
else if (str == "exit") {
t_vec.push_back(token{ tokens::exit,codes::NOOP,"",line - 2 });
}
+ else if (str == "debug") {
+ t_vec.push_back(token{ tokens::debug,codes::NOOP,"",line - 2 });
+ }
else if (utils::isNum(str) && str.size()!=0) {
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line - 2 });
isNum = false;
@@ -419,10 +422,11 @@ namespace dms {
// Displays both with a target and without
match_process_disp(&stream); // Match and process displays
match_process_label(&stream); // Match and process labels
+ match_process_debug(&stream);
//if (current.type != tokens::tab) // Old code for an old system...
// tabs = 0;
- //current = stream.next();
+ current = stream.next();
}
state->push_chunk(current_chunk->name, current_chunk);
}
diff --git a/DMS/codes.cpp b/DMS/codes.cpp
index d2ee854..116be6b 100644
--- a/DMS/codes.cpp
+++ b/DMS/codes.cpp
@@ -1,3 +1,3 @@
#pragma once
#include "Codes.h"
-const std::string dms::codes::list[] = { "NOOP","ENTR","ENAB","DISA","LOAD","VERN","USIN","STAT","DISP","ASGN","LABL","CHOI","OPTN","FORE","????","WHLE","FUNC","IFFF","ELIF","ELSE","DEFN","SKIP","COMP","INDX","JMPZ","INST","ERRO" ,"GOTO","JUMP","RETN", "EXIT" };
\ No newline at end of file
+const std::string dms::codes::list[] = { "NOOP","ENTR","ENAB","DISA","LOAD","VERN","USIN","STAT","DISP","ASGN","LABL","CHOI","OPTN","FORE","????","WHLE","FUNC","IFFF","ELIF","ELSE","DEFN","SKIP","COMP","INDX","JMPZ","INST","ERRO" ,"GOTO","JUMP","RETN", "EXIT", "DEBG" };
\ No newline at end of file
diff --git a/DMS/codes.h b/DMS/codes.h
index 1a46e6b..36b4cd4 100644
--- a/DMS/codes.h
+++ b/DMS/codes.h
@@ -33,7 +33,8 @@ namespace dms::codes {
GOTO,
JUMP,
RETN,
- EXIT
+ EXIT,
+ DEBG
};
extern const std::string list[];
static bool isControl(const op code) {
diff --git a/DMS/dms_state.cpp b/DMS/dms_state.cpp
index 35a8a1c..7fef938 100644
--- a/DMS/dms_state.cpp
+++ b/DMS/dms_state.cpp
@@ -1,5 +1,19 @@
#include "dms_state.h"
namespace dms {
+ dms_state::dms_state() {
+ // We should define the defaults for the enables
+ //chunks.insert_or_assign("leaking",false);
+ //chunks.insert_or_assign("debugging",false);
+ //chunks.insert_or_assign("warnings",false); //
+ //chunks.insert_or_assign("statesave",true); // Allows you to save state
+ //chunks.insert_or_assign("omniscient",true); // Allows you to know who's who when you first meet them
+ }
+ bool dms_state::isEnabled(std::string flag) {
+ if (enables.count(flag)) {
+ return enables[flag];
+ }
+ return false;
+ }
void dms_state::dump(errors::error err) {
std::cout << "Number of chunks: " << chunks.size();
std::ofstream outputFile("dump.bin");
diff --git a/DMS/dms_state.h b/DMS/dms_state.h
index 7c93634..ea8dcae 100644
--- a/DMS/dms_state.h
+++ b/DMS/dms_state.h
@@ -9,6 +9,7 @@ namespace dms {
class dms_state
{
public:
+ dms_state();
void dump(errors::error err);
void dump();
void push_error(errors::error err);
@@ -18,5 +19,6 @@ namespace dms {
std::map chunks;
std::string entry = "start";
std::map enables;
+ bool isEnabled(std::string flag);
};
}
diff --git a/DMS/dump.txt b/DMS/dump.txt
index f69c279..acc237b 100644
--- a/DMS/dump.txt
+++ b/DMS/dump.txt
@@ -1,5 +1,5 @@
Token Dump:
-Line <18446744073709551615>NOOP newline
+Line <4294967295>NOOP newline
Line <0>NOOP newline
Line <1>ENTR flag
Line <1>NOOP name main
@@ -29,7 +29,7 @@ Line <11>NOOP name Ryan
Line <11>NOOP colon
Line <11>NOOP string This works!
Line <11>NOOP newline
-Line <12>NOOP name DEBUG
+Line <12>NOOP nil
Line <12>NOOP string What's up
Line <12>NOOP newline
Line <13>NOOP name Ryan
diff --git a/DMS/packages.config b/DMS/packages.config
deleted file mode 100644
index 5997977..0000000
--- a/DMS/packages.config
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/DMS/token.h b/DMS/token.h
index fe1af1e..c791736 100644
--- a/DMS/token.h
+++ b/DMS/token.h
@@ -40,14 +40,13 @@ namespace dms::tokens {
gotoo,
jump,
exit,
- // Other token types
+ debug,
tilde,
backtick,
at,
pound,
dollar,
ampersand,
-
nil
};//stream, t_vec, line, isNum, buffer
struct token {
diff --git a/Debug/DMS.exe b/Debug/DMS.exe
index 0d82ea0..5b1d2ad 100644
Binary files a/Debug/DMS.exe and b/Debug/DMS.exe differ
diff --git a/Debug/DMS.ilk b/Debug/DMS.ilk
index 7c53a38..b91d50d 100644
Binary files a/Debug/DMS.ilk and b/Debug/DMS.ilk differ
diff --git a/Debug/DMS.pdb b/Debug/DMS.pdb
index 0f6bd4f..463e4c1 100644
Binary files a/Debug/DMS.pdb and b/Debug/DMS.pdb differ