OpenVDB 13.0.0

Loading...
Searching...
No Matches
AST.h File Reference

Provides the definition for every abstract and concrete derived class which represent a particular abstract syntax tree (AST) node type. More...

`#include "Tokens.h"`
`#include <openvdb/version.h>`
`#include <openvdb/util/Assert.h>`
`#include <memory>`
`#include <utility>`
`#include <vector>`

Go to the source code of this file.

## Classes
struct | Node
| The base abstract node which determines the interface and required methods for all derived concrete nodes which comprise a valid AST. More...
struct | Statement
| Abstract (pure-virtual) AST nodes. More...
struct | Expression
| Expressions are comprised of full or potentially partial parts of a full statement that may not necessary make up an entire valid statement on their own. For example, while a Binary Operator such as "3 + 5;"" is a valid statement on its own, the full statement "3 + 5 + 6;" must be broken down into two expressions which together form the statement as well as determining precedence. More...
struct | Variable
| Variables are a base type for Locals, Attributes and ExternalVariables. Unlike other abstract types, they also consolidate data for the derived types. More...
struct | ValueBase
| ValueBases are a base class for anything that holds a value (literal). Derived classes store the actual typed values. More...
struct | StatementList
| Concrete AST nodes. More...
struct | Block
| A Block node represents a scoped list of statements. It may comprise of 0 or more statements, and specifically indicates that a new scope is activated, typically represented by curly braces. Note that a block does not alway have to be encapsulated by curly braces, but always represents a new scope. More...
struct | Tree
| A Tree is the highest concrete (non-abstract) node in the entire AX AST hierarchy. It represents an entire conversion of a valid AX string. More...
struct | CommaOperator
struct | Loop
| Loops represent for, while and do-while loop constructs. These all consist of a condition - evaluated to determine if loop iteration should continue, and a body which is the logic to be repeated. For loops also have initial statements which are evaluated prior to loop execution (at loop scope) and commonly used to set up iterators, and iteration expressions which are evaluated between iterations after the body and before the condition. Both conditions and initial statements can be declarations or expressions, so are Statements, and iteration expressions can consist of multiple expressions. The loop body is a Block defining its own scope (encapsulated by initial statement scope for for-loops). More...
struct | ConditionalStatement
| ConditionalStatements represents all combinations of 'if', 'else' and 'else if' syntax and semantics. A single ConditionalStatement only ever represents up to two branches; an 'if' (true) and an optional 'else' (false). ConditionalStatements are nested within the second 'else' branch to support 'else if' logic. As well as both 'if' and 'else' branches, a ConditionalStatement also holds an Expression related to its primary condition. More...
struct | BinaryOperator
| A BinaryOperator represents a single binary operation between a left hand side (LHS) and right hand side (RHS) expression. The operation type is stored as a tokens::OperatorToken enumerated type on the node. AX grammar guarantees that this token will only ever be a valid binary operator token type when initialized by the parser. More...
struct | TernaryOperator
| A TernaryOperator represents a ternary (conditional) expression 'a ? b : c' which evaluates to 'b' if 'a' is true and 'c' if 'a' is false. Requires 'b' and 'c' to be convertibly typed expressions, or both void. The 'true' expression ('b') is optional with the conditional expression 'a' returned if it evaluates to true, otherwise returning 'c'. Note that 'a' will only be evaluated once in this case. More...
struct | AssignExpression
| AssignExpressions represents a similar object construction to a BinaryOperator. AssignExpressions can be chained together and are thus derived as Expressions rather than Statements. More...
struct | Crement
| A Crement node represents a single increment '++' and decrement '–' operation. As well as it's crement type, it also stores whether the semantics constructed a post or pre-crement i.e. ++a or a++. More...
struct | UnaryOperator
| A UnaryOperator represents a single unary operation on an expression. The operation type is stored as a tokens::OperatorToken enumerated type on the node. AX grammar guarantees that this token will only every be a valid unary operator token type when initialized by the parser. More...
struct | Cast
| Cast nodes represent the conversion of an underlying expression to a target type. Cast nodes are typically constructed from functional notation and do not represent construction of the target type, rather a type-casted conversion. More...
struct | FunctionCall
| FunctionCalls represent a single call to a function and any provided arguments. The argument list can be empty. The function name is expected to exist in the AX function registry. More...
struct | Keyword
| Keywords represent keyword statements defining changes in execution. These include those that define changes in loop execution such as break and continue, as well as return statements. More...
struct | ArrayUnpack
| ArrayUnpack represent indexing operations into AX container types, primarily vectors and matrices indexed by the square brackets [] syntax. Multiple levels of indirection (multiple components) can be specified but current construction is limited to either a single or double component lookup. Providing two components infers a matrix indexing operation. More...
struct | ArrayPack
| ArrayPacks represent temporary container creations of arbitrary sizes, typically generated through the use of curly braces {}. More...
struct | Attribute
| Attributes represent any access to a primitive value, typically associated with the '@' symbol syntax. Note that the AST does not store any additional information on the given attribute other than its name and type, which together form a unique Attribute identifier known as the Attribute 'token'. A 'primitive value' in this instance refers to a value on an OpenVDB Volume or OpenVDB Points tree. More...
struct | ExternalVariable
| ExternalVariable represent any access to external (custom) data, typically associated with the '$' symbol syntax. Note that the AST does not store any additional information on the given external other than its name and type, which together form a unique external identifier known as the ExternalVariable 'token'. This token is used by the compiler to map user provided values to these external values. More...
struct | Local
| Local AST nodes represent a single accesses to a local variable. The only store the name of the variable being accessed. More...
struct | DeclareLocal
| DeclareLocal AST nodes symbolize a single type declaration of a local variable. These store the local variables that They also however store its specified type. These have the important distinction of representing the initial creation and allocation of a variable, in comparison to a Local node which only represents access. More...
struct | Value< T >
| A Value (literal) AST node holds either literal text or absolute value information on all numerical, string and boolean constants. A single instance of a Value is templated on the requested scalar, boolean or string type. If scalar or boolean value is constructed from a string (as typically is the case in the parser), the value is automatically converted to its numerical representation. If this fails, the original text is stored instead. More...
struct | Value< std::string >
| Specialization of Values for strings. More...

## Namespaces
namespace | openvdb
namespace | openvdb::v13_0
namespace | openvdb::v13_0::ax
namespace | openvdb::v13_0::ax::ast

## Detailed Description

Provides the definition for every abstract and concrete derived class which represent a particular abstract syntax tree (AST) node type.

Authors
  Nick Avramoussis, Richard Jones

AST nodes represents a particular branch of a complete AST. Concrete nodes can be thought of as leaf node types which hold semantic information of a partial or complete statement or expression. A string of AX can be fully represented by building the correct AST structure. The AX grammar defined in axparser.y represents the valid mapping of a tokenized string to AST nodes.

AST node classes can either represent a "leaf-level" semantic component of a given AX AST, or an abstract base type. The latter are used by the parser and leaf-level AST nodes for storage of compatible child nodes, and provide grouping of various nodes which share common semantics. The main two types of abstract AST nodes are statements and expressions.