2023-01-11 14:04:22 -07:00
|
|
|
all: grammars
|
|
|
|
|
|
|
|
.PHONY: grammars
|
|
|
|
grammars: grammars/__init__.py
|
|
|
|
grammars/__init__.py: *.g4 antlr4.jar
|
|
|
|
java -cp "${PWD}/antlr4.jar" org.antlr.v4.Tool -Dlanguage=Python3 $< -no-listener -visitor -o grammars
|
|
|
|
touch grammars/__init__.py
|
|
|
|
|
|
|
|
antlr4.jar:
|
|
|
|
rm -f *.jar
|
|
|
|
wget https://www.antlr.org/download/antlr-4.10.1-complete.jar
|
|
|
|
mv *.jar antlr4.jar
|
|
|
|
|
2023-01-12 15:32:51 -07:00
|
|
|
.PHONY: clean
|
2023-01-11 14:04:22 -07:00
|
|
|
clean:
|
|
|
|
rm -rf grammars
|
|
|
|
|
|
|
|
tests/%.correct: tests/%.in hmknf.py
|
|
|
|
cat $< > $@
|
|
|
|
echo "-------------------" >> $@
|
|
|
|
python3 hmknf.py < $< >> $@
|
|
|
|
|
|
|
|
TESTS=$(shell ls tests/*.in | xargs -I{} /usr/bin/basename {} .in | xargs -I{} printf "tests/%s.correct\n" {})
|
|
|
|
|
|
|
|
.PHONY: test
|
|
|
|
test: ${TESTS}
|