On 03/01/2011 08:37 AM, David Matthews wrote:
On 28/02/2011 17:07, Yue Li wrote:
On 02/28/2011 07:55 AM, David Matthews wrote:
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!
I've added a little bit to this to make it possible to extract the codetree from an ML variable. It was already possible to use an ML variable as a constant but this works better when the ML is an inline function. I've updated the sample code with an example of "Hello World" using TextIO.print and string concatenation.
I appreciate your great work David! I've tried the new example. The two examples are very helpful. I'm now trying to add the calls to these constructor functions inside my code tree parser.
Thanks,
Yue