diff options
| author | Ataberk <olgunataberk@gmail.com> | 2022-09-25 17:22:03 +0200 |
|---|---|---|
| committer | Ataberk <olgunataberk@gmail.com> | 2022-09-25 17:22:03 +0200 |
| commit | dc0b3db1b4f1895a07e5fe280ee3790e87f97b9f (patch) | |
| tree | b47203aa281bdd959def4451c84d310cd9cf2e12 /sources/apps/parsertest | |
| download | dram-bender-dc0b3db1b4f1895a07e5fe280ee3790e87f97b9f.tar.gz | |
Initial commit
Diffstat (limited to 'sources/apps/parsertest')
| -rwxr-xr-x | sources/apps/parsertest/Makefile | 27 | ||||
| -rwxr-xr-x | sources/apps/parsertest/SoftMC_Example | bin | 0 -> 372120 bytes | |||
| -rw-r--r-- | sources/apps/parsertest/example.smc | 9 | ||||
| -rw-r--r-- | sources/apps/parsertest/ptest.cpp | 18 |
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 Binary files differnew file mode 100755 index 0000000..c5146bf --- /dev/null +++ b/sources/apps/parsertest/SoftMC_Example 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); +} |
