5 ms·
"The output executable is byte-for-byte identical with said release, which means that the source code accurately represents the original engine's behavior." Th
by swimfar 7y ago
"The output executable is byte-for-byte identical with said release, which means that the source code accurately represents the original engine's behavior."
That seems crazy that someone could reverse engineer compiled code back into the higher level language it came from, and then have that code compile into the exact same executable. Obviously, you can keep modifying the code until it matches, but it's still impressive for anything other than a small program.
- gameswithgo 7y agoturbo pascal went straight from text to machine code. no ast or manipulations.
- benhoyt 7y agoThat's very interesting to me. Do you have a source or more info about this?
- gonzus 7y agoMore info please? That sounds pretty hard / impossible to do.
- gonzus 7y agoI stand corrected; this was in fact discussed before, right here on HN: https://news.ycombinator.com/item?id=17087469 https://news.ycombinator.com/item?id=17087469 -- very nice read.
- chrisseaton 7y ago> That sounds pretty hard / impossible to do. Why do you think that? This is how most compilers used to work. And languages like Pascal were specifically designed to be able to be compiled in a mostly single pass. Look up ‘syntax directed translation’ in an old compiler textbook.
- tmzt 7y agoDoes that include Go? The speed of the compiler and some of the syntax suggest that it should be possible.
- chrisseaton 7y agoSorry not really an expert in Go.
- pansa2 7y agoGo creates an AST and uses an SSA intermediate representation [0]. [0] https://eli.thegreenplace.net/2019/go-compiler-internals-adding-a-new-statement-to-go-part-2/ https://eli.thegreenplace.net/2019/go-compiler-internals-add...
- asiekierka 7y agoRemember that this would probably be much more difficult for modern compilers with their large stacks of optimizations!
- gonzus 7y agoI just watched a documentary about how Super Mario 64, a game for Nintendo consoles, was reverse engineered in a way that will also generate byte-identical objects when being compiled. I found this nothing short of amazing. This is the link to the part of the video that mentions this: https://youtu.be/NKlbE2eROC0?t=206 https://youtu.be/NKlbE2eROC0?t=206