On 02/28/2011 07:55 AM, David Matthews wrote:
I'm thinking that the next step for me is to call Poly/ML middle functions that would take the codetree and evaluate the entire codetree for a Spad function (and then hopefully a Spad domain.) I've read the code and the documentation in the codetree source code files. Is there any way for me to call the codetree functions as a library in my ML code?
I've added a CodeTree sub-structure to the PolyML structure which makes the codetree available to ML programs. This just passes through the internal construction functions. To build a codetree you just call the constructor functions and then call PolyML.CodeTree.genCode to generate the machine code. You can turn on switches such as PolyML.Compiler.codetree and PolyML.Compiler.assemblyCode to display the code you've built and the machine code that the code generator has produced from it. To use this you will need to rebuild the compiler with make compiler in the polyml directory.
There's a little example in the samplecode directory to get you started.
I've updated my version and tried out the sample code which works quite well. Thank you very much David!
Best,
Yue