Man_or_boy_test Man_or_boy_test

Man or boy test - Definition and Overview

Related Words: Olympics, Tat, Analysis, Armor, Assay

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

Copyright 2009 WordIQ.com - Privacy Policy  :: Terms of Use  :: Contact Us  :: About Us
This article is licensed under the GNU Free Documentation License. It uses material from the this Wikipedia article.