In WHILE there is no language feature that admits recursive macros or any direct reference to the program itself. This raises some questions. Can we write self-referencing programs in WHILE at all? More concretely, can we write a WHILE program that returns itself as data, i.e. its own abstract syntax tree? In this chapter Kleene’s Recursion Theorem, which answers those questions in the affirmative, is proved by one more application of the diagonalisation principle. Applications of the theorem are discussed and another theorem of Kleene’s, the parameterisation theorem, is shown, which provides the semantic justification of partial evaluation, a well-known program optimisation technique.
[1]
Ira R. Forman,et al.
Java reflection in action
,
2005
.
[2]
Nathaniel Charlton,et al.
Specification patterns for reasoning about recursion through the store
,
2013,
Inf. Comput..
[3]
S. C. Kleene,et al.
Introduction to Metamathematics
,
1952
.
[4]
Neil D. Jones,et al.
Computability and complexity - from a programming perspective
,
1997,
Foundations of computing series.
[5]
Yoshihiko Futamura,et al.
Partial Evaluation of Computation Process--An Approach to a Compiler-Compiler
,
1999,
High. Order Symb. Comput..