Hashlink Codegen - written in Haxe

Hello,

I am curious, is there a way to implement a codegen that converts non-haxe code to Hashlink? I mean is there a class or tool like LLVM IR generator or an assembler that I can utilize to convert another code to Hashlink Bytecode?

I would appreciate any help, pointers, or ideas.

Thank you!!

There are two blog posts describing Hashlink run-time that might be useful for you:

Also, the format library contains tools for working with HL bytecode, it seems: format/format/hl at master · HaxeFoundation/format · GitHub

Not sure if there’s an easy way to convert the bytecode to C though, but I imagine something could be done in the compiler to support that, @ncannasse surely can say more about that.

Thanks @nadako I have already gone through these articles before. But truth is, my general knowledge of compilers and code generators aren’t sharp enough. I was thinking there would be a ready made tool to generate Hashlink IR which would then be run inside the Hashlink VM itself, and even better generate C code.

I am hoping a good Samaritan in the community can come up with a solution.

Thanks.

As far as I understand one just has to write the reversed version of this: format/Reader.hx at master · HaxeFoundation/format · GitHub

1 Like