问题
Is there any LLVM backend for javascript? If not, other tools that convert dynamic language(similar to javascript) to LLVM IR will also be okay. Because I am writing a dynamic language compiler and such tools can help me find out how some features are implemented.
回答1:
FTL JIT (JavaScriptCore) uses LLVM as a backend.
Other VMs for dynamic languages using LLVM MCJIT:
- Pyston
- HHVM
- LLILC
- Julia
- The list goes on
回答2:
I think you can have a look at Emscripten. It's a llvm-backend for asm.js.
But convert js to llvm IR is not easy, because the llvm IR is static typed, you need to use C-like language simulate a dynamic language. TypeScript maybe is a similar language you can have a look.
来源:https://stackoverflow.com/questions/34313561/how-to-convert-javascript-to-llvm-ir