From acf66e1816d2660c80ee4322dc1ce60ce11735d1 Mon Sep 17 00:00:00 2001 From: Dane Johnson Date: Fri, 26 Nov 2021 12:14:07 -0600 Subject: [PATCH] Organize --- Makefile | 21 +++++---------------- blockexample.dee => demo/blockexample.dee | 0 buildup.dee => demo/buildup.dee | 0 example.dee => demo/example.dee | 0 lexdemo.c | 11 ----------- src/Makefile | 18 ++++++++++++++++++ deelang.c => src/deelang.c | 0 lexer.l => src/lexer.l | 0 parser.y => src/parser.y | 1 + src/syntax.h | 6 ++++++ 10 files changed, 30 insertions(+), 27 deletions(-) rename blockexample.dee => demo/blockexample.dee (100%) rename buildup.dee => demo/buildup.dee (100%) rename example.dee => demo/example.dee (100%) delete mode 100644 lexdemo.c create mode 100644 src/Makefile rename deelang.c => src/deelang.c (100%) rename lexer.l => src/lexer.l (100%) rename parser.y => src/parser.y (98%) create mode 100644 src/syntax.h diff --git a/Makefile b/Makefile index abf58de..300458b 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,7 @@ .PHONY: all clean -all: deelang - -lexer.o lexer.h: parser.h lexer.l - flex -o lexer.c --header-file=lexer.h lexer.l - $(CC) -c lexer.c - rm lexer.c - -parser.h parser.o: parser.y - bison -o parser.c --header=parser.h parser.y - $(CC) -c parser.c - rm parser.c - -deelang: deelang.c lexer.o parser.o - $(CC) -o $@ $^ - +all: + $(MAKE) -C src + mv src/deelang . clean: - rm -rf parser.o lexer.o parser.h lexer.h deelang + $(MAKE) -C src clean + rm -f deelang diff --git a/blockexample.dee b/demo/blockexample.dee similarity index 100% rename from blockexample.dee rename to demo/blockexample.dee diff --git a/buildup.dee b/demo/buildup.dee similarity index 100% rename from buildup.dee rename to demo/buildup.dee diff --git a/example.dee b/demo/example.dee similarity index 100% rename from example.dee rename to demo/example.dee diff --git a/lexdemo.c b/lexdemo.c deleted file mode 100644 index c80f449..0000000 --- a/lexdemo.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "lexer.h" -#include "parser.h" - -void main() { - int t; - while ((t = yylex()) != 0) { - printf("yylex=0x%x\n", t); - printf("yylval=%s\n", yylval.sym); - } - printf("Byebye!"); -} diff --git a/src/Makefile b/src/Makefile new file mode 100644 index 0000000..abf58de --- /dev/null +++ b/src/Makefile @@ -0,0 +1,18 @@ +.PHONY: all clean +all: deelang + +lexer.o lexer.h: parser.h lexer.l + flex -o lexer.c --header-file=lexer.h lexer.l + $(CC) -c lexer.c + rm lexer.c + +parser.h parser.o: parser.y + bison -o parser.c --header=parser.h parser.y + $(CC) -c parser.c + rm parser.c + +deelang: deelang.c lexer.o parser.o + $(CC) -o $@ $^ + +clean: + rm -rf parser.o lexer.o parser.h lexer.h deelang diff --git a/deelang.c b/src/deelang.c similarity index 100% rename from deelang.c rename to src/deelang.c diff --git a/lexer.l b/src/lexer.l similarity index 100% rename from lexer.l rename to src/lexer.l diff --git a/parser.y b/src/parser.y similarity index 98% rename from parser.y rename to src/parser.y index edd6971..47424e9 100644 --- a/parser.y +++ b/src/parser.y @@ -1,5 +1,6 @@ %{ #include +#include "syntax.h" int yylex(); int yyerror(const char* p) { fprintf(stderr, p); } %} diff --git a/src/syntax.h b/src/syntax.h new file mode 100644 index 0000000..5d753ee --- /dev/null +++ b/src/syntax.h @@ -0,0 +1,6 @@ +#ifndef SYNTAX_H +#define SYNTAX_H + + + +#endif /* SYNTAX_H */