aboutsummaryrefslogtreecommitdiffstats
path: root/sources/apps/parsertest
diff options
context:
space:
mode:
Diffstat (limited to 'sources/apps/parsertest')
-rwxr-xr-xsources/apps/parsertest/Makefile27
-rwxr-xr-xsources/apps/parsertest/SoftMC_Examplebin0 -> 372120 bytes
-rw-r--r--sources/apps/parsertest/example.smc9
-rw-r--r--sources/apps/parsertest/ptest.cpp18
4 files changed, 54 insertions, 0 deletions
diff --git a/sources/apps/parsertest/Makefile b/sources/apps/parsertest/Makefile
new file mode 100755
index 0000000..6ca92f2
--- /dev/null
+++ b/sources/apps/parsertest/Makefile
@@ -0,0 +1,27 @@
+program_NAME := SoftMC_Example
+program_CXX_SRCS := ptest.cpp $(wildcard ../../api/*.c*)
+program_CXX_OBJS := ${program_CXX_SRCS:.cpp=.o}
+program_OBJS := $(program_CXX_OBJS)
+program_INCLUDE_DIRS := ../../api/
+program_LIBRARY_DIRS :=
+program_LIBRARIES :=
+CPPFLAGS += -g -std=c++11
+
+CPPFLAGS += $(foreach includedir,$(program_INCLUDE_DIRS),-I$(includedir))
+LDFLAGS += $(foreach librarydir,$(program_LIBRARY_DIRS),-L$(librarydir))
+LDFLAGS += $(foreach library,$(program_LIBRARIES),-l$(library))
+
+CC=g++
+
+.PHONY: all clean distclean
+
+all: $(program_NAME)
+
+$(program_NAME): $(program_OBJS)
+ $(CC) $(CPPFLAGS) $(program_OBJS) -o $(program_NAME) $(LDFLAGS)
+
+clean:
+ @- $(RM) $(program_NAME)
+ @- $(RM) $(program_OBJS)
+
+distclean: clean
diff --git a/sources/apps/parsertest/SoftMC_Example b/sources/apps/parsertest/SoftMC_Example
new file mode 100755
index 0000000..c5146bf
--- /dev/null
+++ b/sources/apps/parsertest/SoftMC_Example
Binary files differ
diff --git a/sources/apps/parsertest/example.smc b/sources/apps/parsertest/example.smc
new file mode 100644
index 0000000..a8cac7a
--- /dev/null
+++ b/sources/apps/parsertest/example.smc
@@ -0,0 +1,9 @@
+LI 0 8;
+LI 1 1;
+LI 2 1;
+LI 3 0;
+LI 4 0;
+LI 5 0;
+BEGIN:;
+WR 5 0 4 0 0 0, NOP, NOP, NOP;
+END;
diff --git a/sources/apps/parsertest/ptest.cpp b/sources/apps/parsertest/ptest.cpp
new file mode 100644
index 0000000..28aabac
--- /dev/null
+++ b/sources/apps/parsertest/ptest.cpp
@@ -0,0 +1,18 @@
+#include <string>
+#include <fstream>
+#include <iostream>
+#include <sstream>
+#include <string.h>
+#include "prog.h"
+#include "parser.h"
+
+int main()
+{
+ // https://stackoverflow.com/questions/2602013/read-whole-ascii-file-into-c-stdstring
+ std::ifstream t("example.smc");
+ std::stringstream buffer;
+ buffer << t.rdbuf();
+ string program = buffer.str();
+ Parser p;
+ p.parse_program(program);
+}