nd2py.core.converter package
This module provides utilities for converting between different representations of symbolic expressions, including:
- Parsing strings into symbolic expression trees.
- Converting symbolic expression trees into string representations.
nd2py.core.converter.from_postorder module
-
class nd2py.core.converter.from_postorder.FromPostorder[source]
Bases: object
-
nd2py.core.converter.from_postorder.from_postorder(nodes: List[Symbol | Type[Symbol]], **kwargs) → Symbol[source]
Construct a Symbol tree from a list of Symbols in postorder traversal order.
nd2py.core.converter.from_preorder module
-
class nd2py.core.converter.from_preorder.FromPreorder[source]
Bases: Visitor
-
generic_visit(node: Symbol, following_nodes, **kwargs) → _Type[source]
-
nd2py.core.converter.from_preorder.from_preorder(nodes: List[Symbol | Type[Symbol]], **kwargs) → Symbol[source]
Construct a Symbol tree from a list of Symbols in preorder traversal order.
nd2py.core.converter.parser module
-
nd2py.core.converter.parser.parse(expression: str, variables: Dict[str, Symbol] = None, callables: Dict[str, callable] = None) → Symbol[source]
nd2py.core.converter.string_printer module
-
class nd2py.core.converter.string_printer.StringPrinter[source]
Bases: Visitor
-
generic_visit(node: Symbol, *args, **kwargs) → _Type[source]
-
visit_Empty(node: Empty, *args, **kwargs) → _Type[source]
-
visit_Number(node: Number, *args, **kwargs) → _Type[source]
-
visit_Variable(node: Variable, *args, **kwargs) → _Type[source]
-
visit_Add(node: Add, *args, **kwargs) → _Type[source]
-
visit_Sub(node: Sub, *args, **kwargs) → _Type[source]
-
visit_Mul(node: Mul, *args, **kwargs) → _Type[source]
-
visit_Div(node: Div, *args, **kwargs) → _Type[source]
-
visit_Pow(node: Pow, *args, **kwargs) → _Type[source]
-
visit_Neg(node: Neg, *args, **kwargs) → _Type[source]
-
visit_Inv(node: Inv, *args, **kwargs) → _Type[source]
-
visit_Pow2(node: Pow2, *args, **kwargs) → _Type[source]
-
visit_Pow3(node: Pow3, *args, **kwargs) → _Type[source]
-
visit_Sour(node: Sour, *args, **kwargs) → _Type[source]
-
visit_Targ(node: Targ, *args, **kwargs) → _Type[source]
-
visit_Aggr(node: Aggr, *args, **kwargs) → _Type[source]
-
visit_Rgga(node: Rgga, *args, **kwargs) → _Type[source]
nd2py.core.converter.tree_printer module
-
class nd2py.core.converter.tree_printer.TreePrinter[source]
Bases: Visitor
-
generic_visit(node: Symbol, *args, **kwargs) → _Type[source]
-
visit_Empty(node: Symbol, *args, **kwargs) → _Type[source]
-
visit_Number(node: Number, *args, **kwargs) → _Type[source]
-
visit_Variable(node: Variable, *args, **kwargs) → _Type[source]
-
visit_Add(node: Add, *args, **kwargs) → _Type[source]
-
visit_Mul(node: Mul, *args, **kwargs) → _Type[source]