diff --git a/python/taichi/lang/__init__.py b/python/taichi/lang/__init__.py index dcd8d1cb38b39..b36367508c638 100644 --- a/python/taichi/lang/__init__.py +++ b/python/taichi/lang/__init__.py @@ -5,6 +5,7 @@ from taichi.core.util import locale_encode from taichi.core.util import ti_core as _ti_core from taichi.lang import impl, types +from taichi.lang.ast.transformer import TaichiSyntaxError from taichi.lang.enums import Layout from taichi.lang.exception import InvalidOperationError from taichi.lang.impl import * @@ -20,7 +21,6 @@ from taichi.lang.sparse_matrix import SparseMatrix, SparseMatrixBuilder from taichi.lang.sparse_solver import SparseSolver from taichi.lang.struct import Struct -from taichi.lang.transformer import TaichiSyntaxError from taichi.lang.type_factory_impl import type_factory from taichi.lang.util import (has_pytorch, is_taichi_class, python_scope, taichi_scope, to_numpy_type, to_pytorch_type, diff --git a/python/taichi/lang/ast/__init__.py b/python/taichi/lang/ast/__init__.py new file mode 100644 index 0000000000000..8b137891791fe --- /dev/null +++ b/python/taichi/lang/ast/__init__.py @@ -0,0 +1 @@ + diff --git a/python/taichi/lang/ast_checker.py b/python/taichi/lang/ast/checkers.py similarity index 100% rename from python/taichi/lang/ast_checker.py rename to python/taichi/lang/ast/checkers.py diff --git a/python/taichi/lang/ast_resolver.py b/python/taichi/lang/ast/symbol_resolver.py similarity index 100% rename from python/taichi/lang/ast_resolver.py rename to python/taichi/lang/ast/symbol_resolver.py diff --git a/python/taichi/lang/transformer.py b/python/taichi/lang/ast/transformer.py similarity index 98% rename from python/taichi/lang/transformer.py rename to python/taichi/lang/ast/transformer.py index 723a57de8e70c..9e83ffbbee046 100644 --- a/python/taichi/lang/transformer.py +++ b/python/taichi/lang/ast/transformer.py @@ -1,7 +1,7 @@ import ast from taichi.lang import impl -from taichi.lang.ast_resolver import ASTResolver +from taichi.lang.ast.symbol_resolver import ASTResolver from taichi.lang.exception import TaichiSyntaxError import taichi as ti diff --git a/python/taichi/lang/expr_builder.py b/python/taichi/lang/expr_builder.py index c0b46cde6ad64..8cf2082fbcaf0 100644 --- a/python/taichi/lang/expr_builder.py +++ b/python/taichi/lang/expr_builder.py @@ -1,8 +1,8 @@ import ast import warnings +from taichi.lang.ast.symbol_resolver import ASTResolver from taichi.lang.ast_builder_utils import * -from taichi.lang.ast_resolver import ASTResolver from taichi.lang.exception import TaichiSyntaxError import taichi as ti diff --git a/python/taichi/lang/kernel_impl.py b/python/taichi/lang/kernel_impl.py index 6047c3dfad536..5e2290dcf18e6 100644 --- a/python/taichi/lang/kernel_impl.py +++ b/python/taichi/lang/kernel_impl.py @@ -7,13 +7,13 @@ import numpy as np from taichi.core.util import ti_core as _ti_core from taichi.lang import impl, util -from taichi.lang.ast_checker import KernelSimplicityASTChecker +from taichi.lang.ast.checkers import KernelSimplicityASTChecker +from taichi.lang.ast.transformer import ASTTransformerTotal from taichi.lang.exception import TaichiSyntaxError from taichi.lang.kernel_arguments import (any_arr, sparse_matrix_builder, template) from taichi.lang.ndarray import Ndarray from taichi.lang.shell import _shell_pop_print, oinspect -from taichi.lang.transformer import ASTTransformerTotal from taichi.misc.util import obsolete from taichi.type import primitive_types diff --git a/python/taichi/lang/stmt_builder.py b/python/taichi/lang/stmt_builder.py index 4708d788df4d4..8fedd738d9ce8 100644 --- a/python/taichi/lang/stmt_builder.py +++ b/python/taichi/lang/stmt_builder.py @@ -2,8 +2,8 @@ import copy from taichi.lang import impl +from taichi.lang.ast.symbol_resolver import ASTResolver from taichi.lang.ast_builder_utils import * -from taichi.lang.ast_resolver import ASTResolver from taichi.lang.exception import TaichiSyntaxError from taichi.lang.expr_builder import build_expr, build_exprs from taichi.lang.util import to_taichi_type diff --git a/tests/python/test_ast_resolver.py b/tests/python/test_ast_resolver.py index 6b9c33e09cb0a..47ccd8bc3df80 100644 --- a/tests/python/test_ast_resolver.py +++ b/tests/python/test_ast_resolver.py @@ -1,7 +1,7 @@ import ast from collections import namedtuple -from taichi.lang.ast_resolver import ASTResolver +from taichi.lang.ast.symbol_resolver import ASTResolver def test_ast_resolver_basic():