JavaScript implementation of LLVM primitives (Value, Block, etc)

Hi there,

I’m working on a new language but not at all proficient with C/C++… I was wondering if there was an experimental-ish implementation of LLVM IR in JavaScript which would allow me to use the LLVM primitives to build an IR, and then write an IR interpreter in JS.

The reason I’m looking to use javascript is that I’ll be able to move faster and explore a large backlog of ideas quickly, before committing them to the language spec.

Does something like this exist? If no, are there alternatives where someone with no C/C++ knowledge can quickly explore and prototype language ideas? I’m particularly interested in use-def chains, coroutines, and to a certain extent - type safety.

I’m also interested in tracking produced values over multiple executions, and in later executions using the same value without computation if it has shown to produce the same value consistently. Is this something in the LLVM ecosphere currently, or is this more of a higher-level concept?

Thanks!

Hello Matt,

I found this https://github.com/MichaReiser/llvm-node , however i am not sure of its status.

If you are familiar with Python, there is llvmlite: GitHub - numba/llvmlite: A lightweight LLVM python binding for writing JIT compilers

Some llvmlite material here:
https://eli.thegreenplace.net/2015/building-and-using-llvmlite-a-basic-example/
https://eli.thegreenplace.net/2015/python-version-of-the-llvm-tutorial/

About the IR interpreter, there is lli: https://llvm.org/docs/CommandGuide/lli.html

George