How to implement dynamic objects using LLVM?

Assuming a javascript-like language, how can we implement a system such as:

a = {}; a.foo = {}; a.foo.bar = 42; print a.foo['bar']; 

using LLVM C ++ API?

I did not find any documentation about type data types (such as hashMap heriting from Value), so I got lost here. The LLVM C web page is not useful in any way, since there is no such data type in C / C ++.

I did a Kaleidoscope tutorial but did not find any other really good tutorials.

+4
source share
2 answers

Just like you do it on top of any other low-level semantics. You must implement your own runtime library, your own hash maps (or whatever you would like to use for dynamic dispatch). LLVM does not (and should not) provide any runtime for the code that it generates.

+3
source

An example jit language written in python with llvm, here is a link to a student project .
This is not directly what you need, but object-oriented, and the report covers a simple methodology for implementing the object orientation of the language.

+4
source

All Articles