Looking for existing backend to execute intermediate representation

I built a compiler that generates intermediate representation code but I don’t have enough time to create a backend myself. Can anyone recommend existing tools or interpreters that can run this type of intermediate code? Where can I find and download such tools?

Here’s an example of what my compiler outputs:

val1 = 0.45231e-6
total = val1

val1 = 5
val2 = 8
val3 = val1 + val2
counter = val3

START:
    val1 = total
    val2 = 15
    val3 = compare(val1 <= val2)
    val4 = total
    val5 = 10
    val6 = compare(val4 ~= val5)
    val7 = val3 | val6
    val8 = total
    val9 = 15
    val10 = compare(val8 > val9)
    val11 = val7 & val10
    if val11 true then goto LOOP else goto END
LOOP:
    val1 = 3
    val2 = total
    val3 = val2 + val1
    total = val3
    
    val1 = 1
    val2 = counter
    val3 = val2 + val1
    counter = val3
    goto START
END:

Any help would be great.

llvm is a solid choice for ir, it works great with custom stuff. qemu could work too, but might need some adjusting. both are free - check their websites for download.

Your IR looks pretty straightforward to work with. I hit a similar wall when building a custom language compiler - ended up just writing a simple Python interpreter instead of wrestling with existing tools. Since you’ve got explicit variable assignments and basic control flow, implementing it shouldn’t be too bad. Just build a basic interpreter with a symbol table for variables and handle gotos with a simple jump table. I got way more control over debugging and adding features this way versus trying to shoehorn my IR into something like LLVM that expects totally different formats. Honestly, writing your own interpreter might be faster than all the integration headaches.

Nice IR format! What made you go with explicit val assignments like that? And what’s your compiler targeting - something specific or general purpose? Knowing your use case would help people suggest better backend options.