diff --git a/parser/Makefile b/parser/Makefile index 36224ba..f2670eb 100644 --- a/parser/Makefile +++ b/parser/Makefile @@ -4,34 +4,23 @@ BISON := bison PARSER := parser -COBJS := lex.yy.o -CXXOBJS := $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc)) -OBJS := $(COBJS) $(CXXOBJS) +OBJS := lex.yy.o $(PARSER).tab.o $(patsubst %.cc,%.o,$(wildcard *.cc)) all: $(OBJS) -%.o: %.c - $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $< - %.o: %.cc $(CXX) -c -o $@ $(CPPFLAGS) $(CXXFLAGS) $< $(PARSER).tab.cc $(PARSER).tab.hh: $(PARSER).yy $(BISON) -d $< -lex.yy.o: lex.yy.c +lex.yy.o: lex.yy.cc -lex.yy.c: $(PARSER).tab.hh -lex.yy.c: $(PARSER).lex - $(FLEX) $< +lex.yy.cc: $(PARSER).tab.hh +lex.yy.cc: $(PARSER).lex + $(FLEX) -o $@ $< # Make dependency files -%.dep: %.c - @set -e; rm -f $@; \ - $(CC) -MM $(CPPFLAGS) $< > $@.$$$$; \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ - rm -f $@.$$$$ - %.dep: %.cc @set -e; rm -f $@; \ $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ @@ -39,7 +28,7 @@ lex.yy.c: $(PARSER).lex rm -f $@.$$$$ clean: - -rm -f lex.yy.c $(PARSER).tab.cc $(PARSER).tab.hh *~ *.o *.dep + -rm -f lex.yy.cc $(PARSER).tab.cc $(PARSER).tab.hh *~ *.o *.dep # Include dependency files include $(OBJS:.o=.dep) diff --git a/parser/parser.lex b/parser/parser.lex index cec7f35..717351f 100644 --- a/parser/parser.lex +++ b/parser/parser.lex @@ -1,4 +1,6 @@ +%option nounput + %{ #include "nodes.h" diff --git a/parser/parser.yy b/parser/parser.yy index 59c7d62..540b89c 100644 --- a/parser/parser.yy +++ b/parser/parser.yy @@ -11,9 +11,7 @@ #include "nodes.h" using namespace std; -extern "C" { - int yylex(void); -} +int yylex(void); extern FILE * yyin;