From cf366387449dcf9d34875a7d76f3b79c1e231d6f Mon Sep 17 00:00:00 2001 From: Bobby Bingham Date: Thu, 12 Jan 2017 20:05:45 -0600 Subject: nqasm: Initial stab at a lexer and parser So far, this only understands instructions, but no operands or labels. It doesn't handle bad input gracefully. It's just enough to test the basics. --- Makefile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..554c540 --- /dev/null +++ b/Makefile @@ -0,0 +1,30 @@ +OPTFLAGS = -Os +CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L $(OPTFLAGS) + +GENSRCS = lexer.c parser.c +GENHDRS = lexer.h parser.h +SRCS = $(sort $(wildcard *.c) $(GENSRCS)) +OBJS = $(SRCS:.c=.o) +TARGET = nqasm + +all: $(TARGET) + +clean: + rm -f $(GENSRCS) $(GENHDRS) $(OBJS) $(TARGET) + +lexer.c lexer.h: lexer.l + flex $< + +parser.c parser.h: parser.y + bison $< + +lexer.o: parser.h +parser.o: lexer.h + +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +$(TARGET): $(OBJS) + $(CC) $(CFLAGS) $^ -o $@ + +.PHONY: all clean -- cgit v1.2.3