From dc0b3db1b4f1895a07e5fe280ee3790e87f97b9f Mon Sep 17 00:00:00 2001 From: Ataberk Date: Sun, 25 Sep 2022 17:22:03 +0200 Subject: Initial commit --- sources/apps/parsertest/Makefile | 27 +++++++++++++++++++++++++++ sources/apps/parsertest/SoftMC_Example | Bin 0 -> 372120 bytes sources/apps/parsertest/example.smc | 9 +++++++++ sources/apps/parsertest/ptest.cpp | 18 ++++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100755 sources/apps/parsertest/Makefile create mode 100755 sources/apps/parsertest/SoftMC_Example create mode 100644 sources/apps/parsertest/example.smc create mode 100644 sources/apps/parsertest/ptest.cpp (limited to 'sources/apps/parsertest') 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 Binary files /dev/null and b/sources/apps/parsertest/SoftMC_Example 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 +#include +#include +#include +#include +#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); +} -- cgit v1.2.3