Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
fja
eval
Commits
634daf2a
Commit
634daf2a
authored
Mar 24, 2022
by
Vladimír Štill
Browse files
make: Improve grammar generation
parent
d330782a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
634daf2a
PWD
!=
pwd
PY
=
$(
wildcard
*
.py
)
GRMS
=
DFA NFA CFG RegG RegEx
GRMS
=
DFA NFA CFG SET RegG
ANTLR_VERSION
!=
antlr4 |
grep
Version |
sed
-E
's/.*Version ([0-9]+[.][0-9]+.[0-9]+).*/\1/'
-include
local.make
...
...
@@ -24,9 +26,22 @@ $(GRMS:%=lib/parser/%Parser.py) : lib/parser/%Parser.py : lib/parser/%.g4
@
# let's be a bit more permissive for versions
sed
-i
'/self.checkVersion(".*")/d'
$
(
@:%Parser.py
=
%
*
.py
)
$(GRMS
:
%=build/js/%Parser.js) : build/js/%Parser.js : lib/parser/%.g4
mkdir
-p
$(
dir
$@
)
@
# note: the path must be absolute, otherwise antlr4 put files into lib/parser subdir
antlr4
-Dlanguage
=
JavaScript
-o
$(
dir
$@
)
$(PWD)
/
$<
runtime-js
:
build/js/runtime/antlr4/Parser.js
build/js/runtime/antlr4/Parser.js
:
build/js/antlr-javascript-runtime-$(ANTLR_VERSION).zip
(
cd
$(
dir
$@
)
..
&&
unzip
-o
../antlr-javascript-runtime-
$(ANTLR_VERSION)
.zip
)
touch
$@
FA_PARSER
=
DFA NFA
$(FA_PARSER
:
%=lib/parser/%Parser.py) : lib/parser/FA.g4
$(FA_PARSER
:
%=build/js/%Parser.js) : lib/parser/FA.g4
lib/parser/RegG.g4
:
lib/parser/CFG.g4
lib/parser/RegGParser.py
:
lib/parser/CFG.g4
build/js/RegGParser.js
:
lib/parser/CFG.g4
.PHONY
:
%.mypy typecheck test unit all grammars
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment