I read about Haxe - you can translate from Haxe to C ++ ... It's great ... And is it possible to reverse the operation from C ++ to Haxe?

  • write a translator and it will definitely be possible. But C ++ is a rather complicated language and I think it will be quite difficult. But if you use llvm, then I think everything is real. - KoVadim
  • This is a theoretical question (is it possible in theory) or practical (what kind of software)? :-) - Harry
  • Perhaps there are ready-made tools ... If not, then no ... - sitev_ru

1 answer 1

Theoretically, you can try, but almost now there are no tools.

hxcpp a result of translation, hxcpp does not use all C ++ features, so you can immediately forget about the option "just do the reverse transformation".

But more importantly, if you do this, it is not clear what you will achieve with it .

  • If your goal is to compile high-performance C ++ libraries using haxe targets, you will lose the very performance for which you need these libraries. And even when compiling with hxcpp you are likely to lose some of the performance due to the “wrappers” required for the C ++ features that are missing from haxe.
  • If your goal is to compile C ++ libraries that achieve their goals by communicating with other native libraries, the library will still be operational only after compiling into native code, other than C ++, haxe has no other such targets (as far as I know). And compiling from C ++ to haxe, in order to compile it back into C ++, is obviously a meaningless action.
  • If your goal is to compile C ++ libraries without external dependencies just to work under other platforms, then it is much faster to manually rewrite all such libraries than to bother with converting an arbitrary C ++ to haxe, since C ++ is quite complicated. And some haxe platform platforms (Java?) Even allow you to work with generic extensions, so for them they do not need to be converted initially.
  • one
    > besides C ++, haxe has no other such targets — HL , but it’s young. But he is :) - Alex Koz.
  • @AlexanderKoz. Wow, interesting stuff. In the Haxe Foundation are tired of the jokes Neko and decided to make a VM for themselves? : D - D-side
  • Yes, this is one of the reasons. - Alex Koz.