Program Listing for File ExpressionTree.h

↰ Return to documentation for file (ADS/tree/ExpressionTree.h)

/*--------------------------------------------------------------------------*/
/*------------------------- File ExpressionTree.h --------------------------*/
/*--------------------------------------------------------------------------*/
/*--------------------------------------------------------------------------*/
/*----------------------------- DEFINITIONS --------------------------------*/
/*--------------------------------------------------------------------------*/

#ifndef __ADS_ExpressionTree
 #define __ADS_ExpressionTree
                      /* self-identification: #endif constant */

/*--------------------------------------------------------------------------*/
/*------------------------------ INCLUDES ----------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/Contract.h"
#include "ADS/stack/ArrayStack.h"
#include "ADS/tree/BinaryTree.h"

#include <cmath>
#include <map>
#include <string>
#include <string_view>
#include <vector>

/*--------------------------------------------------------------------------*/
/*--------------------------- NAMESPACE ------------------------------------*/
/*--------------------------------------------------------------------------*/

namespace ADS {

BinaryTree< std::string > * expressionTree( std::string_view e );

double evaluate( const BinaryTree< std::string > * t ,
                 const std::map< std::string , double > & env = {} );

std::string prefixForm( const BinaryTree< std::string > * t );

std::string infixForm( const BinaryTree< std::string > * t );

/*--------------------------------------------------------------------------*/

}  // end( namespace ADS )

/*--------------------------------------------------------------------------*/
/*-------------------------- IMPLEMENTATION --------------------------------*/
/*--------------------------------------------------------------------------*/

#include "ADS/tree/impl/ExpressionTree.tpp"

/*--------------------------------------------------------------------------*/

#endif  /* ExpressionTree.h included */

/*--------------------------------------------------------------------------*/
/*----------------------- End File ExpressionTree.h ------------------------*/
/*--------------------------------------------------------------------------*/