From 768bbdd137f5b205e4282bd79572681aef4514e3 Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 19 Sep 2026 11:17:14 +0200 Subject: feat: add bison grammar for emit, decltype and difference --- Makefile | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index a30b93c..c107cb3 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ CC = cc LEX = flex -CFLAGS = -std=c17 -Wall -Wextra -Werror -Wpedantic -O2 +YACC = bison +CFLAGS = -std=c17 -Wall -Wextra -Werror -Wpedantic -O2 -Ibin SOURCES = ast.c ast.h lexer.h main.c -OBJECTS = bin/lexer.o bin/ast.o bin/main.o +OBJECTS = bin/lexer.o bin/parser.o bin/ast.o bin/main.o SANITIZE = -g -O0 -fsanitize=address,undefined .PHONY: all debug check format lint clean @@ -18,13 +19,19 @@ sfinae: $(OBJECTS) bin/lexer.c: sfinae.l | bin $(LEX) -o bin/lexer.c sfinae.l -bin/lexer.o: bin/lexer.c lexer.h +bin/lexer.o: bin/lexer.c bin/parser.h ast.h lexer.h $(CC) -std=c17 -w -I. -c -o $@ bin/lexer.c +bin/parser.c bin/parser.h: sfinae.y | bin + $(YACC) -d -o bin/parser.c sfinae.y + +bin/parser.o: bin/parser.c + $(CC) -std=c17 -w -I. -c -o $@ bin/parser.c + bin/%.o: %.c | bin $(CC) $(CFLAGS) -c -o $@ $< -bin/main.o: lexer.h +bin/main.o: ast.h lexer.h bin/ast.o: ast.h lexer.h debug: CFLAGS += $(SANITIZE) @@ -40,7 +47,7 @@ format: clang-format -i $(SOURCES) lint: - clang-tidy ast.c main.c -- -std=c17 + clang-tidy ast.c main.c -- -std=c17 -Ibin clean: rm -rf bin sfinae -- cgit v1.3