On a disk image (which I had for many years) from a BESM-6, I've suddenly found a working POP-2 (POPLAN) interpreter (for all these years I'd considered that area as useless bits and pieces of various files and binaries, because I've never heard of POP-2 implemented on the BESM-6).

There is only one complete working POP-2 program of any interest on that disk image: a 3D tic-tac-toe game.

Does anyone has a recollection of using that language, and a stash of relatively small entertaining programs I could try on the interpreter?

I'm specifically interested in "Man or Boy Test" in POP-2. The Pop11 version provided doesn't compile.

  • That looks like an interesting functional language. Are the emulator and POP-2 image public? One could try to do some of the usual challenges (Project Euler etc.) in this language. – dirkt Dec 21 '16 at 11:12
  • If you're interested in just the language features, you may have a better chance looking at a newer version of the language not requiring an emulator, like POP-11 or Poplog. I've found some POP-11 programs on RosettaCode, but I'm trying to find something non-trivial written specifically in POP-2. – Leo B. Dec 21 '16 at 16:27
  • @dirkt A toy environment is in mailcom.com/besm6/poplan.zip Beware of Russian error messages. – Leo B. Jan 11 '17 at 9:20

http://www.cs.otago.ac.nz/staffpriv/ok/pop2.htm is mine. I have in fact typed a lot of that code in, have begun retyping RMYCIN, and have written but not yet debugged other stuff. I am not yet ready to put that stuff on line, but would be happy to send it by e-mail to the original poster.

As the Silver Book says, "FOURS is a game of three-dimensional noughts and crosses, played on a 4x4x4 board."

My "stash" includes over 400 solutions to RosettaCode problems, which I have not yet tested (because my compiler is not yet finished). I would be thrilled to the very socks to be given a copy of the POPLAN interpreter materials in exchange.

A word of warning: the primary reference for Pop-2 is the Silver Book, but the language kept on developing until the mid to late 1980s. For example, the Pop-2 system I used at Edinburgh included "properties" (hash tables), which are not in the Silver Book. By the time anyone thought about revising that, Pop-11 had replaced Pop-2. As an example of Pop-2 development, the language described in the Silver Book includes loopif Cond then Stmts close, which is a cross between a 'while' loop and a Dijkstra 'do' loop (in that it can have more than one alternative), but the library hadn't been updated to use that feature.

The AI department at Edinburgh used an Emacs-like editor called DOPE (the Display-Oriented Pop Editor) in the 1980s, a lineal descendant of the "77 editor", using the "piece table" approach. I might have that on a tape somewhere, but have no tape drive to read it, sorry.

DAI Edinburgh lost a lot of stuff in a fire, sadly, including Pop-2 materials.

Oh yes, this should be Man or Boy. UNTESTED!


function A k x1 x2 x3 x4 x5;   
   function B kref;   
      vars k;   
      kref.cont -> k;   
      k-1 -> k;   
      k -> kref.cont;   
      A(k, B, x1, x2, x3, x4)   
   if k <= 0 then   
      x4() + x5()   
      apply(B(% consref(k) %))   
A(10, lambda; 1 end,  lambda; -1 end,   
      lambda; -1 end, lambda; 1 end,   
      lambda; 0 end) =>   

The Algol 60 function A has an integer parameter k passed by value and five other parameters passed by name. Pass by name was meant to be like pass by reference, but what Algol 60 actually specified was basically a pair of procedures (L,R), the L procedure being called when you wanted an address to store into and the R procedure being called when you wanted a value (the modern word for R is "thunk"). That's why the Algol code has x4 + x5 and the Pop-2 code has x4() + x5(), and it's always why the Pop-2 code has anonymous functions (lambda ; end) in the top level call to A where Algol had constants.

The thing that makes this example a bit of a pain in Pop-2, and more of a pain than in Pop-11, is the scope rules. A funny thing happened in the early days of Lisp. McCarthy et all meant to specify the same kind of static scope rules that Lisp and Scheme now enjoy, but by mistake implemented 'dynamic scope'. One way to think of it is that all references to an identifier always go to the same static location; when you enter a scope where a variable is (re)declared its old value is saved on a stack, and restored when you leave that scope. (Common Lisp now calls this "fluid binding".) Pop-2 went with Lisp. By the mid-1980s 'vars' had been replaced by 'lvars' ("Lexically scoped VARiableS"). The language described in the Silver Book didn't have lvars. Nor did functions capture their non-local variables in "closures". Closures had to be made by hand. B(% ... %) says "make a closure where the code part is B and the values of ... will be passed as extra arguments at the end." Now B needs to change k, so we stuff the value of k into a one-word record called a "reference".

Finally, => is called the "print arrow". Inside a function, it prints and removes the top item on the stack. At top level, it prints and removes everything on the stack.

  • Welcome to Retrocomputing Stack Exchange. I was planning to send you an email, but as you're on the site it's easiest for me to tell you now: the bottom link is broken (it should point to the file in /pop.d/, which exists) and page 261 from /pop2.d/silver-6-library.pdf is missing. Thanks for answering on the site, and I hope you stay to share more knowledge. You can subscribe to this question's feed if you want to be notified when more POP-2 resources turn up. – wizzwizz4 Jan 9 '17 at 8:03
  • @raok Thank you! Two things: for some reason the version I have requires spelling the less-than-or-equal operator as =< and there is an execution error "СОNТ(Х)/DЕSТRЕF(Х) Х NOT A REFERENCE". Oh, and I had to use the syntax ".x4 + .x5" instead of the empty parentheses. – Leo B. Jan 9 '17 at 8:20
  • Oops, my error. The only way to spell less-than-or-equal-to is =<, a spelling that survives in Prolog and Erlang to this day. Yes, I know that there's a page missing from the PDF, but I don't have the book any more. It's part of the documentation of the "QuIzzing Machine" library, and we can manage without it. I have fixed the broken link. – raok Jan 10 '17 at 0:09
  • It is true that .f is a legal way to call a function, but so is f(). The Blue Book made this clear in section 5.1 Expressions of the reference manual, back in 1968. The "FOURS.POP" program If you look at the Silver Book (silver-4-library.pdf, page 144) you will see ITEMREAD() being called like that. – raok Jan 10 '17 at 0:26
  • As for the run time error, the only argument B has is a consref(k), which had better be a ref. It sounds as though you have a more-or-less working Poplan system to try things on. Can I have it? Like I said, my compiler is not finished yet. – raok Jan 10 '17 at 0:27

Looking through Usenet, I came across a post on comp.lang.pop (posted 2016/10/27 02:36) asking for information about POP-2:

I am trying to collection materials relating to Pop-2 (Poplog's predecessor). http://www.cs.otago.ac.nz/staffpriv/ok/pop2.htm lists what I currently have. [...]

The information that this person has collected so far includes 'a selection of programs from the POP-2 library of the Edinburgh 4100 installation'1, spanning three-and-a-bit .PDF files (file 4, file 5, file 6, file 7). These scans do not contain text but are legible enough to be typed out by hand.

Index of Edinburgh 4100 POP-2 library

In this index, page numbers are given as per the file, not the scanned book. The first number is the start of the description and the second number is the start of the code.

File 4

  • LIB ALLSORT - p2, p4
  • LIB ASSOC - p5, p9
  • LIB CALL AND EXPLAIN - p11, p15
  • LIB DCOMPILE - p16, p18
  • LIB DEBUG - p19, p22
  • LIB EASYFILE - p23, p34
  • LIB EQUATIONS - p38, p40
  • LIB FOR - p42, p44
  • LIB FOURS - p46, p47
    Note: This may be the "3D tic-tac-toe" game that you mentioned.

File 5

  • LIB FULL MEMOFNS - p1, p7
  • LIB GRAPH TRAVERSER - p10, p16
  • LIB INDEX - p18, p20
  • LIB INVTRIG - p22, p23
  • LIB KALAH - p24, p25
  • LIB MATRIX - p30, p32
  • LIB MEMOFNS - p35, p39
    Note: A less-full(?) version of LIB FULL MEMOFNS (earlier version?)
  • LIB NEW STRUCTURES - p41, p46

File 6

  • LIB PLOT - p1, p4
  • LIB POPEDIT - p7, p12
  • LIB POPSTATS - p14, p15
  • LIB PROOF CHECKER - p28, p35
  • ??? QUIZZING MACHINE - p40.5?, p43?
    Note: A page of the scan is missing. It is the description, so the program remains complete.

File 7

  • LIB RANDOM - p1, p2
  • LIB RANDPACK - p3, p4
  • LIB SETS - p5, p7

1 from Programming in Pop-2, by Burstall, Collins, and Popplestone.

  • The aforementioned pop2.html page mentioned RMYCIN, a program which I am currently investigating. I hope to have a copy soon (although it may be too big to include directly in this answer). – wizzwizz4 Jan 8 '17 at 22:42
  • Indeed, the FOURS program looks like the original of what I have. There are a few insignificant modifications, e.g. NOT(A=B) is written as A /= B, the RANDOM function is provided verbatim rather than read from a file, etc. – Leo B. Jan 9 '17 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.