Information Technology Reference
In-Depth Information
Kernighan and Ritchie [KeR78] disallowed nestings of function declarations in
C. Both decisions lead to language restrictions of full Algol60. Static and dy-
namic scope semantics coincide in these sublanguages [Old81a, Old81b].
2.4
Structural Simulation of Algol60-Programs with Nested and
Formal Procedures by Object Oriented Java-Programs
This essay is not the right place to present a full explicit definition of a transfor-
mation [Goe05] from Algol60-programs π to Java-programs π which shows up
the desired structural simulation.
In a way we may say that a transformed Algol60-program π is a macro-
expanded Java-program which is done by a moderate syntactic sugaring. Java's
new language specification [GJSB00] with its nested (inner) classes makes that
possible. Java's old and original specification [GJS96] has no nested (no inner)
classes. So the transformation π 2 of our program example π 2 looks as follows:
interface tau { public void call ( tau f , boolean g ) ; }
class p { tau f ; boolean g ;
class q { tau r ; boolean s ;
public q ( tau r , boolean s ) {
this.r = r ; this.s = s ;
System.out.println ( g); }}
class % q implements tau {
public void call ( tau r , boolean s )
{
}}
public p ( tau f , boolean g )
newq(r,s);
{
this.f = f ; this.g = g ;
f .call (
new % q(),false ) ;
}}
class % p implements tau
{
public void call ( tau f , boolean g )
{
}}
newp(f,g);
class π 2 {
public static void main ( String[ ] args ) {
new p ( new % p ( ) , true ) ; }}
A few comments:
1. The interface is realizing the recursive type equation τ = proc ( τ, bool ).
2. The extra classes % p and % q are required to simulate formal calls of
procedure p and procedure q .
3.
denotes a free place which later is filled by so called elaboration ε prior
to compilation to a Java-program without nested classes.
We abstain from explicit proving that π and π have essentially equal formal
execution trees, i.e. that π and π are structurally equivalent. We should mention
that, due to [IgP02], nested Java-programs are to be elaborated before proper
semantics definition can be done. The elaboration ε refines program π towards
 
Search WWH ::




Custom Search