haXe Forum > Haxe Compiler API

  • Hi Developers of Haxe.
    I've got an idea how you could ease the creation of new haxe targets. You could provide a haxelib which allows developers to write new targets in haxe. The haxelib should provide some kind of code-dom which can be used within a derived class implementing the target plattform:

    package org.haxe.platforms.java;
    
    class JavaTarget extends AbstractHaxeTarget {
        public function getTargetId() : String {
            return "java";
        }
        public function processCompileUnit(unit:CompileUnit) {
            // write byte code files or plain source
        }
        public function finish() {
            // package jar
        }
    }

    There are several ways how this code can be used:
    1. You could write a small haxe execution engine for the compiler which uses this haxe code.
    2. You could create a new haxe target for creating new targets. Compiling using this target creates a kind of interediate-code which can be used by the compiler.
    ...

    By providing such an API it would be so easy to write new targets like Java or C#.

    Greetings Daniel

< Prev | Page 1 / 1 | Next >