#include <ExNode.h>
Inherits Marsyas::ExRefCount.
Inherited by ExFun, ExNode_AsgnVar, ExNode_Conditional, ExNode_GetElem, ExNode_IterFor, ExNode_IterIter, ExNode_IterMap, ExNode_IterRFor, ExNode_Link, ExNode_Range, ExNode_ReadVar, ExNode_SetElem, ExNode_StringFor, ExNode_StringIter, ExNode_StringMap, and ExNode_StringRFor.
ExNode represents an expression tree node. Additional nodes may be added later, but may also need to be added to the parser.
There should only ever exist a single parent of any node, that is, a node may only be referenced by one object.
To add library functions add a line like this to ExParser.h::preload() :- library->addRecord("Real|R.cos(mrs_real)|cos(mrs_natural)",new ExRecord(T_FUN,new ExNode_RealCos("mrs_real","Real.cos(mrs_real)"),true)); then define the function as an ExNode class, you must support the calc and copy functions. In the constructor make sure you set is_pure to true if the function can be reduced to a const value given const parameters, or false otherwise.
class ExNode_NatDbl : public ExNode_Fun {
ExNode* child; public:
ExNode_NatDbl(std::string typ, std::string sig, ExNode* x) : ExNode_Fun(typ,sig,true) { child=x; }
virtual ExVal calc() { return false; }
ExNode* copy() { return new ExNode_NatDbl(type,signature); }
};
Definition at line 94 of file ExNode.h.
1.5.6