diff Makefile @ 498:1bd2d590d734

Rejig parser to eliminate lemon No longer use lemon for building the parser. It adds too much complexity, really, and a hand written recursive descent parser is far more flexible. The current iteration can handle exactly one statement: "return <int>".
author William Astle <lost@l-w.ca>
date Thu, 08 Aug 2019 23:32:23 -0600
parents 5b8871fd7503
children c3099c5d9d3e
line wrap: on
line diff
--- a/Makefile	Mon Aug 05 21:38:23 2019 -0600
+++ b/Makefile	Thu Aug 08 23:32:23 2019 -0600
@@ -108,8 +108,7 @@
 lwcc_cpp_objs := $(lwcc_cpp_srcs:.c=.o)
 lwcc_cpp_deps := $(lwcc_cpp_srcs:.c=.d)
 
-# parse_c.c needs to be first here
-lwcc_cc_srcs := parse_c.c cc-main.c tree.c parse.c token_names.c
+lwcc_cc_srcs := cc-main.c tree.c cc-parse.c
 lwcc_cc_srcs := $(addprefix lwcc/,$(lwcc_cc_srcs))
 lwcc_cc_objs := $(lwcc_cc_srcs:.c=.o)
 lwcc_cc_deps := $(lwcc_cc_srcs:.c=.d)
@@ -180,17 +179,6 @@
 
 extra_clean := $(extra_clean) *~ */*~
 
-lwcc/parse_c.c lwcc/parse_c.h: lwcc/parse_c.y
-	rm -f lwcc/parse_c.h lwcc/parse_c.c
-	lemon -q lwcc/parse_c.y
-
-lwcc/token_names.c: lwcc/parse_c.h
-	echo "char *ptoken_names[] = {" > $@
-	echo '"TOKEN_NONE",' >> $@
-	cat lwcc/parse_c.h | sed -e 's/#define \(.*\) .*$$/"\1",/g' -e 's/ //g' >> $@
-	echo '"" };' >> $@
-
-
 %.o: %.c
 	@echo "Building dependencies for $@"
 	@$(CC) -MM -MG $(CPPFLAGS) -o $*.d $<