I hate to be this critical, but this is not emulating the actual 4004.
It's a logic circuit simulator that takes in a compressed representation of something and runs it, with an I/O mechanism that emulates the Busicom calculator hardware (keyboard and printer).
Still impressive for the size of the code, but the "CPU" is nothing like a 4004, or any real microprocessor.