An offline partial evaluator must implement a substantial fraction
of the semantics
of its source language (i.e., to evaluate the static parts of a
program). How might one
avoid this implementation overhead?
Give an example of a program for which simple BTA will cause the
program to diverge
during specialization.
Assuming that a is static, give a congruent uniform division of the
variables of the following
program:
fun f (a, x) = if (x >= 0)
then let
val len = fst(a)
val d = snd(a)
in if (x < len) then sub(d, x) else ERROR end
else ERROR