I'm writing an interpreter for a small language where the only data types are i32, f32, vec of i32, and vec of f32.
The operations are basic math operations + if + while.
However, performance is really important.
Is there a way to do dynamic code generation in Rust ? I'm looking for something like this:
- crate provides an 'instruction set'
- My Rust code, at run time, generates a
Vec<Instruction>
- crate converts this
Vec<Instruction>
to some code I can call (messiness here to pass arguments of i32, f32, vec of i32, vec of f32)
4.My Rust code can then invoke this newly generated code.