A construction of a self-modifiying language with a formal correction proof
Résumé
In this contribution, we present a small high level imperative programming language with its corresponding compiler. The key feature of the language is a self-modifying statement replace C by D which behaves abstractly as C; D but which rewrites its code once C is executed. We do that taking care of efficiency issues on the compiled code. In a second step, we give a proof in TLA+ that the compiled code behaves as specified/expected. The formal model includes potential self-modification of programs. One of the proofs extends an Hoare-style verification of a loop that copes with that feature. Such a compiler may find applications for intellectual property protection but also as a testbed for retro-engineering and binary program analysis tools.