7 ms·
Hey zik, has anyone tried getting it running through emscripten? It would be very cool to have interactive C purely client side in browser. Could make some cool
by endergen 11y ago
Hey zik, has anyone tried getting it running through emscripten? It would be very cool to have interactive C purely client side in browser. Could make some cool c based jsbin like hosting websites from that.
- zik 11y agoI don't think anyone's tried that. It sounds like a pretty cool idea though.
- Tloewald 11y agoGiven it's written in C, it seems like a direct port to Javascript might be a much better option.
- vardump 11y agoAny particular reason for that?
- Tloewald 11y agoA lot of c will translate very simply to JavaScript and any parsing or string manipulation will be insanely easier.
- vardump 11y agoHow can parsing and string manipulation be easier than just compiling C to Javascript using Emscripten? The interpreter already works in C. Wouldn't translating it manually to Javascript be extra effort?
- Tloewald 11y agoParsing and string manipulation are (hugely) easier in Javascript than C. Compiling the interpreter to Javascript via Emscripten is certainly easier than translating to Javascript -- but porting C to Javascript should still be very easy.
- bobajeff 11y agoI tried to port fastcomp (Emscripten's llvm backbend) for that purpose. Based largely off of work Alon Zakai (kripken) already did towards porting llvm and clang to js. Basically, I was going to compile fastcomp to js then run the commands emscripten would normally run via "arguments" function in the modules corresponding to the tool I needed (clang, llc, llvm-link and opt IIRC). But I stopped short of getting clang to work correctly with the flags I needed it to use. I know it's possible I just needed to work around a few system dependencies like posix_spawn. I was going to trace it's use using a macro to replace calls to it with a function that prints the file and line number instead. But I got fed up with the system I was using (Amazon Linux / ssh / tablet) to do all of this on and by extension everything else that has to do with programming or trouble shooting.