Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"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.



Remember that this would probably be much more difficult for modern compilers with their large stacks of optimizations!


I 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


turbo pascal went straight from text to machine code. no ast or manipulations.


That's very interesting to me. Do you have a source or more info about this?


More info please? That sounds pretty hard / impossible to do.


I stand corrected; this was in fact discussed before, right here on HN: https://news.ycombinator.com/item?id=17087469 -- very nice read.


> 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.


Does that include Go? The speed of the compiler and some of the syntax suggest that it should be possible.


Go creates an AST and uses an SSA intermediate representation [0].

[0] https://eli.thegreenplace.net/2019/go-compiler-internals-add...


Sorry not really an expert in Go.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: