Abstract Syntax Tree#

API Documentation#

Inheritance Diagram#

Inheritance diagram of pystencils.backend.ast.astnode.PsAstNode, pystencils.backend.ast.structural, pystencils.backend.ast.expressions, pystencils.backend.ast.vector, pystencils.backend.extensions.foreign_ast

Base Classes#

PsAstNode

Base class for all nodes in the pystencils AST.

PsLeafMixIn

Mix-in for AST leaves.

Structural Nodes#

PsBlock

PsStatement

PsAssignment

PsDeclaration

PsLoop

PsConditional

Conditional branch

PsEmptyLeafMixIn

Mix-in marking AST leaves that can be treated as empty by the code generator, such as comments and preprocessor directives.

PsPragma

A C/C++ preprocessor pragma.

PsComment

Expressions#

PsExpression

Base class for all expressions.

PsLvalue

Mix-in for all expressions that may occur as an lvalue; i.e. expressions that represent a memory location.

PsSymbolExpr

A single symbol as an expression.

PsConstantExpr

PsLiteralExpr

PsBufferAcc

Access into a PsBuffer.

PsSubscript

N-dimensional subscript into an array.

PsMemAcc

Pointer-based memory access with type-dependent offset.

PsLookup

PsCall

PsTernary

Ternary operator.

PsNumericOpTrait

Trait for operations valid only on numerical types

PsIntOpTrait

Trait for operations valid only on integer types

PsBoolOpTrait

Trait for boolean operations

PsUnOp

PsNeg

PsAddressOf

Take the address of a memory location.

PsCast

PsBinOp

PsAdd

PsSub

PsMul

PsDiv

PsIntDiv

C-like integer division (round to zero).

PsRem

C-style integer division remainder

PsLeftShift

PsRightShift

PsBitwiseAnd

PsBitwiseXor

PsBitwiseOr

PsAnd

PsOr

PsNot

PsRel

Base class for binary relational operators

PsEq

PsNe

PsGe

PsLe

PsGt

PsLt

PsArrayInitList

N-dimensional array initialization matrix.

SIMD Nodes#

PsVectorOp

Mix-in for vector operations

PsVecBroadcast

Broadcast a scalar value to N vector lanes.

PsVecMemAcc

Pointer-based vectorized memory access.

Utility#

expressions.evaluate_expression

Evaluate a pystencils backend expression tree with values assigned to symbols according to the given valuation.

dfs_preorder

Pre-Order depth-first traversal of an abstract syntax tree.

dfs_postorder

Post-Order depth-first traversal of an abstract syntax tree.

util.AstEqWrapper

Wrapper around AST nodes that computes a hash from the AST's textual representation and maps the __eq__ method onto structurally_equal.

util.determine_memory_object

Return the memory object accessed by the given expression, together with its constness