PROFF is an offline partial evaluator for Prolog programs. The pre-processing stage performs a size-change analysis (to ensure the termination of the process) and a (monovariant) binding-time analysis (to propagate static information through the program). Then the source program is annotatated by using the information gathered by the previous two analyses. Finally, the proper specialization phase mainly follows the program annotations.
You can find a more detailed description of the tool here, including the source files. A technical description can be found in this paper.
Initial program | Specialized program | ||||||
|
*** Only tested in Mozilla/Firefox ***