I’m writing a small implementation of a custom domain-specific-ish language. I’d like to translate it to Rust and then produce an executable.
Now I could generate code as a string and call
cargo as a subprocess, but where’s the fun in that… So I want to generate an AST and compile it at runtime, which I think I can do using the
I found a guide that explains how to create an AST, but:
- I will need to include a small “standard library” which I want to ship as code and parse into AST at runtime
- in the end I want to compile the AST into a binary.
I didn’t find any resource that shows a simple example of these two tasks. Does it exist?