Commit 6d0a19c4 authored by Vladimír Štill's avatar Vladimír Štill
Browse files

make: Move grammar generation to makefile

parent 5e02dab8
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -16,4 +16,13 @@ test: typecheck unit
%.mypy : %
	$(MYPY) --check-untyped-defs --warn-redundant-casts --warn-unused-ignores --warn-return-any $<

GRMS=DFA NFA CFG RegEx

grammars : $(GRMS:%=lib/parsing/%Parser.py)

$(GRMS:%=lib/parsing/%Parser.py) : lib/parsing/%Parser.py : lib/parsing/%.g4
	antlr4 -Dlanguage=Python3 -visitor $<
	@# let's be a bit more permissive for versions
	sed -i '/self.checkVersion(".*")/d' $(@:%Parser.py=%*.py)

.PHONY: %.mypy typecheck test unit all

regenerate_grammars.sh

deleted100755 → 0
+0 −7
Original line number Diff line number Diff line
#!/bin/bash
export CLASSPATH=".:/usr/local/lib/antlr-4.8-complete.jar:\$CLASSPATH"
alias antlr4='java -Xmx500M -cp "/usr/local/lib/antlr-4.8-complete.jar:\$CLASSPATH" org.antlr.v4.Tool'
antlr4 -Dlanguage=Python3 lib/parsing/DFA.g4
antlr4 -Dlanguage=Python3 lib/parsing/NFA.g4
antlr4 -Dlanguage=Python3 lib/parsing/CFG.g4
antlr4 -Dlanguage=Python3  -visitor lib/parsing/RegEx.g4