OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
|
Abstract Syntax Tree. More...
#include <matheval.hpp>
Public Types | |
using | tree_t = boost::variant< nil, real_t, std::string, boost::recursive_wrapper< expr_ast< real_t > >, boost::recursive_wrapper< binary_op< real_t > >, boost::recursive_wrapper< unary_op< real_t > > > |
Public Member Functions | |
expr_ast () | |
Default constructor. More... | |
template<typename Expr > | |
expr_ast (Expr other) | |
Copy constructor. More... | |
expr_ast & | operator+= (expr_ast const &rhs) |
Add a tree. More... | |
expr_ast & | operator-= (expr_ast const &rhs) |
subtract a tree More... | |
expr_ast & | operator*= (expr_ast const &rhs) |
Multiply by a tree. More... | |
expr_ast & | operator/= (expr_ast const &rhs) |
Divide by a tree. More... | |
Public Attributes | |
tree_t | tree |
AST storage. More... | |
Abstract Syntax Tree.
Stores the abstract syntax tree (AST) of the parsed mathematical expression.
Definition at line 95 of file matheval.hpp.
using matheval::detail::expr_ast< real_t >::tree_t = boost::variant< nil , real_t , std::string , boost::recursive_wrapper<expr_ast<real_t> > , boost::recursive_wrapper<binary_op<real_t> > , boost::recursive_wrapper<unary_op<real_t> > > |
Definition at line 97 of file matheval.hpp.
|
inline |
Default constructor.
Initializes the tree to a nil value to indicate inconsistent state.
Definition at line 120 of file matheval.hpp.
|
inline |
expr_ast< real_t > & matheval::detail::expr_ast< real_t >::operator*= | ( | expr_ast< real_t > const & | rhs | ) |
Multiply by a tree.
Definition at line 190 of file matheval.hpp.
expr_ast< real_t > & matheval::detail::expr_ast< real_t >::operator+= | ( | expr_ast< real_t > const & | rhs | ) |
Add a tree.
Definition at line 178 of file matheval.hpp.
expr_ast< real_t > & matheval::detail::expr_ast< real_t >::operator-= | ( | expr_ast< real_t > const & | rhs | ) |
subtract a tree
Definition at line 184 of file matheval.hpp.
expr_ast< real_t > & matheval::detail::expr_ast< real_t >::operator/= | ( | expr_ast< real_t > const & | rhs | ) |
Divide by a tree.
Definition at line 196 of file matheval.hpp.
tree_t matheval::detail::expr_ast< real_t >::tree |
AST storage.
The syntax tree can hold various types. Numbers (real_t
), variables (std::string
), the recursive tree itself (expr_ast
), binary operators (binary_op
), and unary operators (unary_op
).
Definition at line 113 of file matheval.hpp.
Referenced by matheval::detail::eval_ast< real_t >::operator()(), and matheval::detail::ConstantFolder< real_t >::operator()().