Files
avcf/tests/compile/Makefile
T
adrien 35959784de refactor: flat DFA code generation — every block is a label, every edge is a goto
Replace the nested if-else branch-analysis architecture with a flat DFA
model using CodeGen.emitFlat — a single DFS walk emitting each block as
a C label followed by its code and gotos to all successors.

Removed:
- _branchDescendants / emitBranch / generateCallWithError
- _generateCallWithError, _noWalkNext, _genVisited
- generateNextCode, findBackEdges
- WCDecision._branchDescendants / _emitBranch / overridden generateCode

Added:
- CodeGen.emitFlat(entry) — flat DFS emit with labels + gotos
- WCBlock.generateFlowCode() — base emits gotos from wcNextFlow
- WCDecision.generateFlowCode() — if-goto / goto for decisions
- WCProcCall.generateFlowCode() — if (call != 0) goto err / goto ok

Output is flat — zero nested if-else for branch/error handling.
Tests use local out/ directory.
2026-06-23 03:21:22 +02:00

34 lines
803 B
Makefile

CC ?= gcc
CFLAGS ?= -Wall -Wextra -fsyntax-only
OUTDIR ?= out
SRC := $(wildcard $(OUTDIR)/*.c)
SDL3_CFLAGS := $(shell pkg-config --cflags sdl3 2>/dev/null || echo)
GL_CFLAGS := $(shell pkg-config --cflags gl 2>/dev/null || echo)
SDL3_SRC := $(filter %_sdl3.c, $(SRC))
PLAIN_SRC := $(filter-out %_sdl3.c, $(SRC))
.PHONY: all sdl3 clean
all: $(PLAIN_SRC)
@for f in $(PLAIN_SRC); do \
printf " CC %s\n" "$$(basename $$f)"; \
$(CC) $(CFLAGS) "$$f" 2>&1 || exit 1; \
done
sdl3: $(SDL3_SRC)
@if [ -z "$(SDL3_SRC)" ]; then \
echo " (no SDL3 tests)"; \
exit 0; \
fi
@echo " (with SDL3 flags)" ; \
for f in $(SDL3_SRC); do \
printf " CC %s\n" "$$(basename $$f)"; \
$(CC) $(CFLAGS) $(SDL3_CFLAGS) $(GL_CFLAGS) "$$f" 2>&1 || exit 1; \
done
clean:
rm -f $(OUTDIR)/*.c