In this project we build a compiler that compiles Janus code to Bob ISA code. This compiled code is simulated using the simulator linked to.

About Janus

Janus is an imperative language. To some degree it resembles C. Janus can only handle integers. And by default it has a pass by reference policy on arguments. That is every argument is passed as a reference (or a pointer).

A Janus simulator along a series of Janus programs can be found here. I have used the Janus programs found in the simulator to test this compiler. Included on the page of the simulator are articles on reversible programming along descriptions of other reversible programming languages.

Reversibility of Janus has been proven (for example in this article). We exploit this fact and concentrate on making the resulting Bob code reversible. Every Bob instruction is reversible (Explained to some extend here). So as we shall see making the compiler reversible amounts to cleaning up used registers and memory slots.


Since a relative large amount of work has gone into this project, and since I might extend further on this code base, I have decided to license it under GNU license. Futhermore to the best of my knowledge this compiler is the only one of its kind out there.