The Towers of Hanoi as a BCPL program.

BCPL was designed by Martin Richards in the mid-1960s while he was visiting MIT, and was used during the early 1970s for several interesting projects, among them the OS6 operating system at Oxford, and parts of the seminal Alto work at Xerox PARC.

Dennis Ritchie's home page has a BCPL reference manual, and also a very interesting history of the C language.

// // The Towers Of Hanoi // BCPL // Copyright (C) 1998 Amit Singh. All Rights Reserved. // // // Tested under Martin Richards' BCPL over INTCODE compiler kit // GLOBAL $( START:1; WRITEF:76 $) LET MOVEIT(F, T) BE $( WRITEF("move %N --> %N*N", F, T) $) LET HANOI(N, T, F, U) BE $( IF N=0 RETURN; HANOI(N-1, U, F, T); MOVEIT(F, T); HANOI(N-1, T, U, F) $) // Don't know if there's something like `argv' in BCPL. // The first argument of HANOI is the number of disks, // which is hardcoded. LET START () BE $(1 HANOI(1, 3, 1, 2) FINISH $)1