Skip to content

Commit 748e1cd

Browse files
committed
[GR-40325] Code generation of the _ast module
PullRequest: graalpython/2384
2 parents a867068 + bc27661 commit 748e1cd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+5673
-170
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ language
5454
/org.eclipse.jdt.core.prefs
5555
Python3.g4.stamp
5656
python.gram.stamp
57+
Python.asdl.stamp
5758
*.orig
5859
/*.diff
5960
/testenv
Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
QUIETLY$(MX_VERBOSE) = @
22

3-
PARSER_PATH ?= ../com.oracle.graal.python.pegparser/src/com/oracle/graal/python/pegparser
3+
PEGPARSER_SRC_PATH ?= ../com.oracle.graal.python.pegparser/src
4+
GRAALPY_SRC_PATH ?= ../com.oracle.graal.python/src
5+
PARSER_PATH ?= ${PEGPARSER_SRC_PATH}/com/oracle/graal/python/pegparser
6+
INPUT_PATH ?= input_files
47
ifdef MX_PYTHON
58
PYTHON_EXE ?= ${MX_PYTHON}
69
else ifdef MX_PYTHON_VERSION
@@ -9,22 +12,30 @@ else
912
PYTHON_EXE ?= python3
1013
endif
1114

12-
TARGET=${PARSER_PATH}/Parser.java
15+
PARSER_TARGET=${PARSER_PATH}/Parser.java
1316

14-
GRAMMAR=${PARSER_PATH}/python.gram
15-
TOKENS=${PARSER_PATH}/Tokens
17+
GRAMMAR=${INPUT_PATH}/python.gram
18+
TOKENS=${INPUT_PATH}/Tokens
19+
ASDL=${INPUT_PATH}/Python.asdl
1620

1721
PEGEN_FILES=$(shell find pegen pegjava -name '*.py')
22+
ASDL_FILES=$(shell find asdl -name '*.py')
1823

19-
STAMP=${GRAMMAR}.stamp
24+
GRAMMAR_STAMP=${GRAMMAR}.stamp
25+
ASDL_STAMP=${ASDL}.stamp
2026

2127
.PHONY: default clean
22-
default: ${STAMP}
28+
default: ${GRAMMAR_STAMP} ${ASDL_STAMP}
2329

24-
${STAMP}: ${GRAMMAR} ${TOKENS} ${PEGEN_FILES} main_parser_gen.py
25-
$(QUIETLY) ${PYTHON_EXE} main_parser_gen.py ${GRAMMAR} ${TOKENS} ${TARGET}
30+
${GRAMMAR_STAMP}: ${GRAMMAR} ${TOKENS} ${PEGEN_FILES} main_parser_gen.py
31+
$(QUIETLY) ${PYTHON_EXE} main_parser_gen.py ${GRAMMAR} ${TOKENS} ${PARSER_TARGET}
32+
$(QUIETLY) touch $@
33+
34+
${ASDL_STAMP}: ${ASDL} ${ASDL_FILES} main_asdl_gen.py
35+
$(QUIETLY) ${PYTHON_EXE} main_asdl_gen.py ${ASDL} --sst-path ${PEGPARSER_SRC_PATH} --ast-path ${GRAALPY_SRC_PATH}
2636
$(QUIETLY) touch $@
2737

2838
clean:
29-
$(QUIETLY) rm -f ${TARGET}
30-
$(QUIETLY) rm -f ${STAMP}
39+
$(QUIETLY) rm -f ${PARSER_TARGET}
40+
$(QUIETLY) rm -f ${GRAMMAR_STAMP}
41+
$(QUIETLY) rm -f ${ASDL_STAMP}

0 commit comments

Comments
 (0)