2 ms·
I'm reminded of the tools in programs like Ghidra or IDA which can take assembly code and convert it into a C-like language. If you could create one of those to
by voidUpdate 6mo ago
I'm reminded of the tools in programs like Ghidra or IDA which can take assembly code and convert it into a C-like language. If you could create one of those tools that also takes in the source file so that it names things somewhat reasonably, could you create an anything to C translator? As long as the original file compiles to assembly, that is
- circuit10 6mo agoI once used Ghidra to decompile a hand-written ARM assembly floating point library and compile the result to a different architecture, and it was significantly faster than GCC’s built in methods… But in general this kind of thing is very unreliable for any non-trivial code without a lot of manual work, so a better approach could be to compile to WebAssembly which can be translated into C
- voidUpdate 6mo agoIt may be easier if you also have the original source file (I've not don't much decompilation myself, only seen other people doing it), as more of a custom solution rather than using an existing system
- circuit10 6mo agoAt that point it’s not really a decompiler any more but a transpiler (high level language -> other high level language)
- voidUpdate 6mo agoI was only using the example of a decompiler as that's where I've seen C-style language generators used in the past. I was trying to make the point that you could probably make any language translate to C (like in the original project) by using similar techniques