←back to thread

Eurydice: a Rust to C compiler

(jonathan.protzenko.fr)
185 points todsacerdoti | 1 comments | | HN request time: 0.204s | source
Show context
bloppe ◴[] No.46180140[source]
Rust compiles to LLVM IR. I'm pretty surprised that building this transpiler was considered a better use of time than writing an LLVM backend for whatever "weird embedded target" might need this.
replies(9): >>46180523 #>>46180571 #>>46180649 #>>46180773 #>>46180810 #>>46181523 #>>46184598 #>>46185313 #>>46189858 #
1. torginus ◴[] No.46181523[source]
There are many kinds of IRs in compilers - I'm not familiar with how Rust works, but for example GCC has an intermediate representation called GENERIC, which is a C-like language that preserves the scoping and loops and branches of the inputted C code.

Lower level representations also exist - since C has goto, you can pretty much turn any SSA IR to C, but the end result won't be readable.