Skip to content

Commit

Permalink
Change c files to cpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
leewei05 authored and Lai-YT committed Oct 13, 2023
1 parent d557e4d commit b3e6aa9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
16 changes: 8 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ YACC = bison
# -d: generate header with default name
YFLAGS = --verbose --debug -d

# Note that lex.yy.c is excluded deliberately, as "lex.yy.c" is considered a
# header file (it's included by "y.tab.c").
OBJS := $(shell find . -name "*.cpp") y.tab.o
# Note that lex.yy.cpp is excluded deliberately, as "lex.yy.cpp" is considered a
# header file (it's included by "y.tab.cpp").
OBJS := $(shell find . -name "*.cpp" ! -name "y.tab.cpp" ! -name "lex.yy.cpp" ) y.tab.o
OBJS := $(OBJS:.cpp=.o)
DEPS = $(OBJS:.o=.d)

Expand All @@ -25,11 +25,11 @@ test: $(TARGET)
$(TARGET): $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o $@

lex.yy.c: lexer.l
lex.yy.cpp: lexer.l
$(LEX) -o $@ $<

y.tab.h: y.tab.c
y.tab.c: parser.y lex.yy.c
y.tab.hpp: y.tab.cpp
y.tab.cpp: parser.y lex.yy.cpp
$(YACC) $(YFLAGS) $< -o $@

#
Expand All @@ -38,10 +38,10 @@ y.tab.c: parser.y lex.yy.c
# dependency explicit to enforce the ordering.
#

main.o: %.o: %.cpp y.tab.h
main.o: %.o: %.cpp y.tab.hpp

clean:
rm -rf *.s *.o lex.yy.c y.tab.c y.tab.h *.output *.ssa $(TARGET) $(OBJS) $(DEPS)
rm -rf *.s *.o lex.yy.* y.tab.* *.output *.ssa $(TARGET) $(OBJS) $(DEPS)
make -C test/ clean

-include $(DEPS)
2 changes: 1 addition & 1 deletion lexer.l
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <cstdlib>
#include <iostream>

#include "y.tab.h"
#include "y.tab.hpp"

// Use LINENO for the actual line number in the source code
// yylineno has advanced to the next line when we reference it.
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "scope.hpp"
#include "type_checker.hpp"
#include "util.hpp"
#include "y.tab.h"
#include "y.tab.hpp"

/// @brief Where the generated code goes.
std::ofstream output;
Expand Down
2 changes: 1 addition & 1 deletion parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <vector>

#include "ast.hpp"
#include "lex.yy.c"
#include "lex.yy.cpp"
#include "type.hpp"

extern std::unique_ptr<AstNode> program;
Expand Down

0 comments on commit b3e6aa9

Please sign in to comment.