ExNode Class Reference
[Scheduler]

ExNode is the base class for an expression tree node. More...

#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.


Detailed Description

ExNode is the base class for an expression tree node.

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); }
};

Author:
Neil Burroughs inb@cs.uvic.ca
Version:
1.0
Date:
Jan 04, 2007

Definition at line 94 of file ExNode.h.


The documentation for this class was generated from the following files:

Generated on Wed May 23 00:02:23 2012 for Marsyas by  doxygen 1.5.6