Comment by knighthack

Comment by knighthack a year ago

5 replies

...So is this a transpiler of some sort?

If it is, consider looking in Nim. It compiles to C, and even compiles to Javascript. And is extremely performant while at it.

randomdata a year ago

Of some sort. The C is transpiled to machine code so that the processor can execute it. Turns out CPUs don't understand C natively.

In addition, it automatically generates wrappers to transparently convert between Javascript's memory model and C's memory model to seamlessly allow Javascript to call upon the C functions imported using it.

Just your usual FFI, really, but with less call overhead than the FFI specification defined by Node (N-API). Albeit with some different tradeoffs made in order to accomplish that.

  • pjmlp a year ago

    C is compiled to machine code.

    • randomdata a year ago

      Yes, that's right. Compile and transpile are the same thing.

      • pjmlp a year ago

        Only for Javascript folks without CS background in compilers.

        • randomdata a year ago

          Yes, it is true that Javascript folks do seem to want to think they are different. But they can never figure out exactly what is different.