Re:Vacietis, a C compiler targeting Common Lisp
by remexre on Saturday December 26, 2020 @12:43AM
(#25541688)
Ha, I usually use a C->JVM compiler as my example of why the C standard has some ridiculous parts, but this works too!
[ Parent
| on HN ]
Re:Vacietis, a C compiler targeting Common Lisp
by Cojen on Saturday December 26, 2020 @12:58AM
(#25541743)
Is there a C->JVM compiler out there that's any good and actively maintained? What are the major problems that come up with this approach?
Re:Vacietis, a C compiler targeting Common Lisp
by qsort on Saturday December 26, 2020 @03:25AM
(#25542152)
I don't think there's anything that's fundamentally impossible (or even conceptually very hard) to solve, it's just that most of the times you're solving the interop problem with JNI/JNA. The opposite route is massively more complicated to implement and nobody wants to dump their time into that. IIRC, as a matter of fact, there are many amateurish level C->JVM compilers but nothing that you'd be comfortable working with on a daily basis.
I guess it boils down to "yeah but why".
Re:Vacietis, a C compiler targeting Common Lisp
by brabel on Saturday December 26, 2020 @04:50AM
(#25542423)
One possible approach today is to compile C to WASM, then run WASM on the JVM as GraalVM supports WASM. https://www.graalvm.org/reference-manual/wasm/
Re:Vacietis, a C compiler targeting Common Lisp
by remexre on Saturday December 26, 2020 @03:52PM
(#25546374)
If you're using GraalVM already, I think Sulong might be better -- my experience with WASM (for C) is that there's a bevy of POSIX-correct-but-ANSI-incorrect tricks that don't work properly on WASM. Debugging is also much nicer with LLVM IR (worst-case, just compile it to a binary and gdb that) than WASM (Firefox doesn't show the stack, Chrome has sourcemap bugs).
Re:Vacietis, a C compiler targeting Common Lisp
by sanxiyn on Saturday December 26, 2020 @01:13AM
(#25541798)
NestedVM works pretty well. http://nestedvm.ibex.org/