Directory

Encyclopedia

NodeWorks
                              ENCYCLOPEDIA

Link Checker

Home
Encyclopedia : M : MA : MAN :

Man or boy test

 

Man or boy test

The man or boy test was proposed by computer scientist Donald Knuth as a means of evaluating implementations of the ALGOL programming language.

The aim of the test was to separate compilers that correctly implemented scoping and call by name (the "men") from those that did not (the "boys").

Example

begin real procedure A(k, x1, x2, x3, x4, x5);
value k; integer k;
begin real procedure B;
begin k := k - 1;
B := A := A(k, B, x1, x2, x3, x4)
end;
if k <= 0 then A := x4 + x5 else B
end;
end;
outreal(A(10, 1, -1, -1, 1, 0));

This creates a tree of B call frames that refer to each other and to the containing A call frames, each of which has its own copy of k that changes every time the associated B is called. Trying to work it through on paper is probably fruitless, but the correct answer is −67.

External links

  • The Man or Boy Test as published in the Algol Bulletin



  • NodeWorks boosts web surfing!
    Page Returned in 0.410 seconds - HTML Compressed 67.8%

    This article is from Wikipedia. All text is available
    under the terms of the GNU Free Documentation License.
     GNU Free Documentation License
    © 2008 Chamas Enterprises Inc.