amath
1.8.5
Simple command line calculator
|
#include <optimizer.h>
Public Member Functions | |
Optimizer (SyntaxNode *root) | |
~Optimizer () | |
void | Optimize () const |
SyntaxNode * | GetRoot () const |
Static Public Member Functions | |
static int | GetTreeDepth (SyntaxNode *node, int depth) |
Static Private Member Functions | |
static void | TagChildren (SyntaxNode *node) |
static void | BalanceTree (SyntaxNode *node) |
static void | ReduceUnaryNodes (SyntaxNode *node) |
static void | ReduceValueNodes (SyntaxNode *node) |
static void | TagStartNode (SyntaxNode *node) |
Private Attributes | |
SyntaxNode * | root |
Definition at line 39 of file optimizer.h.
|
explicit |
Definition at line 35 of file optimizer.cpp.
References root.
Referenced by Evaluator::Evaluate().
Optimizer::~Optimizer | ( | ) |
Definition at line 40 of file optimizer.cpp.
|
staticprivate |
Definition at line 69 of file optimizer.cpp.
References SyntaxNode::Attach(), BalanceTree(), SyntaxNode::Detach(), expression, SyntaxNode::GetNext(), SyntaxNode::GetNodeType(), SyntaxNode::GetParent(), ExpressionNode::GetPrecedence(), GetTreeDepth(), and SyntaxNode::ResetIterator().
Referenced by BalanceTree(), and Optimize().
SyntaxNode * Optimizer::GetRoot | ( | ) | const |
Definition at line 44 of file optimizer.cpp.
References root.
Referenced by Evaluator::Evaluate().
|
static |
Definition at line 115 of file optimizer.cpp.
References SyntaxNode::GetNext(), GetTreeDepth(), and SyntaxNode::ResetIterator().
Referenced by BalanceTree(), and GetTreeDepth().
void Optimizer::Optimize | ( | ) | const |
Definition at line 49 of file optimizer.cpp.
References BalanceTree(), ReduceUnaryNodes(), ReduceValueNodes(), root, TagChildren(), and TagStartNode().
Referenced by Evaluator::Evaluate().
|
staticprivate |
Definition at line 133 of file optimizer.cpp.
References SyntaxNode::Detach(), NumericValueNode::Evaluate(), SyntaxNode::GetNext(), SyntaxNode::GetParent(), SyntaxNode::GetReductionType(), ReduceUnaryNodes(), SyntaxNode::Replace(), NumericValueNode::ReplaceWith(), SyntaxNode::ResetIterator(), Number::Unary(), unaryreduc, and valuereduc.
Referenced by Optimize(), and ReduceUnaryNodes().
|
staticprivate |
Definition at line 175 of file optimizer.cpp.
References Number::Add(), compladdreduc, complsubreduc, NumericValueNode::Evaluate(), expression, SyntaxNode::GetNext(), SyntaxNode::GetNodeType(), SyntaxNode::GetParent(), SyntaxNode::GetReductionType(), NumericValueNode::GetReductionType(), NumericValueNode::NumericValueNode(), Number::PureComplexValue(), ReduceValueNodes(), SyntaxNode::Replace(), SyntaxNode::ResetIterator(), Number::Sub(), and valuereduc.
Referenced by Optimize(), and ReduceValueNodes().
|
staticprivate |
Definition at line 58 of file optimizer.cpp.
References SyntaxNode::GetNext(), SyntaxNode::ResetIterator(), SyntaxNode::SetParent(), and TagChildren().
Referenced by Optimize(), and TagChildren().
|
staticprivate |
Definition at line 214 of file optimizer.cpp.
References SyntaxNode::GetNext(), SyntaxNode::ResetIterator(), SyntaxNode::SetFirstNode(), and TagStartNode().
Referenced by Optimize(), and TagStartNode().
|
private |
Definition at line 50 of file optimizer.h.
Referenced by GetRoot(), Optimize(), and Optimizer().