Ask HN: Which VM is the easiest to target(for a compiler)?
I am working only a high level dynamically typed language, I learnt how to make it work as an interpreted language(most of it is written in java and the heavy lifting is done by ANTLR parser generator)
I have been wondering which VM would be the most easy to target?(I am very new to writing compilers) JVM, LLVM or even some web assembly interpreter (The language being similar to PHP/Perl)
8 comments
[ 3.5 ms ] story [ 104 ms ] thread"Luje is a toy Java virtual machine written in pure Lua. It works by translating Java bytecode into Lua on-the-fly, and then using Mike Pall's LuaJIT to run the result."
It may be that some of the VMs that Raku (fka Perl 6) has generated might be useful. I believe, at least as of a few years ago, they still mostly working on NQP as the intermediate language, where NQP is a low language "like" Perl (NQP is an acronym for Not Quite Perl) which is used to implement the higher level language features, allowing for fairly easy porting to other VMs as long as NQP is supported (for example, Raku was ported to Java by implementing an NQP interpreter, which allowed the majority of the vastly more complex Raku language to just work).
LuaJIT is also a popular choice I hear. This would have the benefit of using Lua, which is a widely deployed and well known small language, and LuaJIT is known to be extremely fast.