Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.
The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
diff --git a/Makefile.pre.in b/Makefile.pre.in
index 66bc88a..7a69a6b 100644
--- a/Makefile.pre.in
+++ b/Makefile.pre.in
@@ -216,10 +216,22 @@
PGENOBJS= $(PGENMAIN) $(POBJS) $(PGOBJS)
+##########################################################################
+# AST
+AST_H= $(srcdir)/Include/Python-ast.h
+AST_C= $(srcdir)/Python/Python-ast.c
+AST_ASDL= $(srcdir)/Parser/Python.asdl
+
+ASDLGEN_FILES= $(srcdir)/Parser/asdl.py $(srcdir)/Parser/asdl_c.py
+# XXX Note that a build now requires Python exist before the build starts
+ASDLGEN= $(srcdir)/Parser/asdl_c.py -h $(srcdir)/Include -c $(srcdir)/Python
##########################################################################
# Python
PYTHON_OBJS= \
+ Python/Python-ast.o \
+ Python/asdl.o \
+ Python/ast.o \
Python/bltinmodule.o \
Python/exceptions.o \
Python/ceval.o \
@@ -265,6 +277,7 @@
Objects/cellobject.o \
Objects/classobject.o \
Objects/cobject.o \
+ Objects/codeobject.o \
Objects/complexobject.o \
Objects/descrobject.o \
Objects/enumobject.o \
@@ -457,8 +470,10 @@
Parser/tokenizer_pgen.o: $(srcdir)/Parser/tokenizer.c
+$(AST_H) $(AST_C): $(AST_ASDL) $(ASDLGEN_FILES)
+ $(ASDLGEN) $(AST_ASDL)
-Python/compile.o Python/symtable.o: $(GRAMMAR_H)
+Python/compile.o Python/symtable.o: $(GRAMMAR_H) $(AST_H)
Python/getplatform.o: $(srcdir)/Python/getplatform.c
$(CC) -c $(PY_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
@@ -474,12 +489,15 @@
PYTHON_HEADERS= \
Include/Python.h \
+ Include/Python-ast.h \
+ Include/asdl.h \
Include/abstract.h \
Include/boolobject.h \
Include/bufferobject.h \
Include/ceval.h \
Include/classobject.h \
Include/cobject.h \
+ Include/code.h \
Include/codecs.h \
Include/compile.h \
Include/complexobject.h \