Plot Script
|
An expression is a tree of Atoms. More...
#include <expression.hpp>
Public Types | |
typedef std::vector< Expression >::const_iterator | ConstIteratorType |
Public Member Functions | |
Expression () | |
Default construct and Expression, whose type in NoneType. More... | |
Expression (const Atom &a) | |
Expression (const Expression &a) | |
deep-copy construct an expression (recursive) More... | |
Expression & | operator= (const Expression &a) |
deep-copy assign an expression (recursive) More... | |
Atom & | head () |
return a reference to the head Atom More... | |
const Atom & | head () const |
return a const-reference to the head Atom More... | |
void | append (const Atom &a) |
append Atom to tail of the expression More... | |
Expression * | tail () |
return a pointer to the last expression in the tail, or nullptr More... | |
ConstIteratorType | tailConstBegin () const noexcept |
return a const-iterator to the beginning of tail More... | |
ConstIteratorType | tailConstEnd () const noexcept |
return a const-iterator to the tail end More... | |
bool | isHeadNumber () const noexcept |
convienience member to determine if head atom is a number More... | |
bool | isHeadSymbol () const noexcept |
convienience member to determine if head atom is a symbol More... | |
Expression | eval (Environment &env) |
Evaluate expression using a post-order traversal (recursive) More... | |
bool | operator== (const Expression &exp) const noexcept |
equality comparison for two expressions (recursive) More... | |
An expression is a tree of Atoms.
An expression is an atom called the head followed by a (possibly empty) list of expressions called the tail.
typedef std::vector<Expression>::const_iterator Expression::ConstIteratorType |
Expression::Expression | ( | ) |
Default construct and Expression, whose type in NoneType.
Expression::Expression | ( | const Atom & | a | ) |
Construct an Expression with given Atom as head an empty tail
atom | the atom to make the head |
Expression::Expression | ( | const Expression & | a | ) |
deep-copy construct an expression (recursive)
Expression Expression::eval | ( | Environment & | env | ) |
Evaluate expression using a post-order traversal (recursive)
|
noexcept |
convienience member to determine if head atom is a number
|
noexcept |
convienience member to determine if head atom is a symbol
Expression & Expression::operator= | ( | const Expression & | a | ) |
deep-copy assign an expression (recursive)
|
noexcept |
equality comparison for two expressions (recursive)
Expression * Expression::tail | ( | ) |
return a pointer to the last expression in the tail, or nullptr
|
noexcept |
return a const-iterator to the beginning of tail
|
noexcept |
return a const-iterator to the tail end