Re-generating source code from LLVM parse tree?
c, c++, clang, llvm, parse-tree
Solution
If "LLVM parse tree" is AST from clang
Yes, you can regenerate source from clang's AST. Some references:
- Basic source-to-source transformation with Clang by Eli, 2012
- Modern source-to-source transformation with Clang and libTooling by Eli, 2014
- Performing Source-to-Source Transformations with Clang (Slides)
- SoSlang: SOurce-to-Source Clang (Slides)
If "LLVM parse tree" is LLVM IR
There were several projects to generate sources from LLVM IR. The first one, the "C back-end" was dropped in LLVM 3.1.
Now there are several projects to generate C from LLVM IR:
Resurrected "C back-end" by Roel Jordans
[LLVMdev] [RFC] Resurrecting the C back-end (Mailing List Post), via cited phoronix news
"C++ -> LLVM IR -> Emscripten -> asm.js -> C" chain
Prototype of an LLVM IR => C compiler ("c backend"), via LLVM Weekly - #15
Problem
I'm curious if there are any projects out there that can take an LLVM parse tree and re-generate source code off of it. I'm particularly thinking of C/C++.