POP-2
   HOME

TheInfoList



OR:

POP-2 (also called POP2) is a
programming language A programming language is a system of notation for writing computer programs. Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
developed around 1970 from the earlier language POP-1 (developed by Robin Popplestone in 1968, originally named COWSEL) by
Robin Popplestone Robin John Popplestone (9 December 1938 in Bristol – 14 April 2004 in Glasgow) was a pioneer in the fields of machine intelligence and robotics. He is known for developing the POP programming languages COWSEL (renamed POP-1), POP-2, POP-11, ...
and
Rod Burstall Rodney Martineau Burstall (11 November 1934 – 13 February 2025) was a British computer scientist who was one of four founders of the Laboratory for Foundations of Computer Science at the University of Edinburgh. Biography Burstall studied p ...
at the
University of Edinburgh The University of Edinburgh (, ; abbreviated as ''Edin.'' in Post-nominal letters, post-nominals) is a Public university, public research university based in Edinburgh, Scotland. Founded by the City of Edinburgh Council, town council under th ...
. It drew roots from many sources: the languages
Lisp Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
and
ALGOL 60 ALGOL 60 (short for ''Algorithmic Language 1960'') is a member of the ALGOL family of computer programming languages. It followed on from ALGOL 58 which had introduced code blocks and the begin and end pairs for delimiting them, representing a ...
, and theoretical ideas from Peter J. Landin. It used an
incremental compiler An incremental compiler is a kind of incremental computation applied to the field of compilation. Quite naturally, whereas ordinary compilers make a so-called clean build, that is, (re)build all program modules, an incremental compiler recompiles ...
, which gave it some of the flexibility of an
interpreted language In computer science, an interpreter is a computer program that directly executes instructions written in a programming or scripting language, without requiring them previously to have been compiled into a machine language program. An inter ...
, including allowing new function definitions at run time and modification of function definitions while a program runs (both of which are features of
dynamic compilation Dynamic compilation is a process used by some programming language implementations to gain performance during program execution. Although the technique originated in Smalltalk,Peter L. Deutsch and Alan Schiffman. "Efficient Implementation of the S ...
), without the overhead of an interpreted language.


Description


Stack

POP-2's
syntax In linguistics, syntax ( ) is the study of how words and morphemes combine to form larger units such as phrases and sentences. Central concerns of syntax include word order, grammatical relations, hierarchical sentence structure (constituenc ...
is
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
-like, except that assignments are in reverse order: instead of writing a := 3; one writes 3 -> a; The reason for this is that the language has explicit notion of an '' operand stack''. Thus, the prior assignment can be written as two separate
statements Statement or statements may refer to: Common uses *Statement (computer science), the smallest standalone element of an imperative programming language * Statement (logic and semantics), declarative sentence that is either true or false *Statement, ...
: 3; which evaluates the value 3 and leaves it on the stack, and -> a; which pops the top value off the stack and assigns it to the variable 'a'. Similarly, the function call f(x, y, z); can be written as x, y, z; f(); (commas and semicolons being largely interchangeable) or even x, y, z.f; or (x, y, z).f; Because of the
stack-based Stack-oriented programming is a programming paradigm that relies on one or more stacks to manipulate data and/or pass parameters. Programming constructs in other programming languages need to be modified for use in a stack-oriented system. Most ...
paradigm, there is no need to distinguish between ''statements'' and ''expressions''; thus, the two constructs if a > b then c -> e else d -> e close; and if a > b then c else d close -> e; are equivalent (use of , as hadn't become a common notation yet).


Arrays and doublet functions

There are no special language constructs to create arrays or record structures as they are commonly understood: instead, these are created with the aid of special builtin functions, e.g., (for arrays that can contain any type of item) and to create restricted types of items. Thus, array element and record field accessors are simply special cases of a ''doublet function'': this is a function that had another function attached as its ''updater'', which is called on the receiving side of an assignment. Thus, if the variable contains an array, then 3 -> a(4); is equivalent to updater(a)(3, 4); the builtin function returning the updater of the doublet. Of course, is a doublet and can be used to change the updater component of a doublet.


Functions

Variables can hold values of any type, including functions, which are first-class objects. Thus, the following constructs function max x y; if x > y then x else y close end; and vars max; lambda x y; if x > y then x else y close end -> max; are equivalent. An interesting operation on functions i
''partial application''
(sometimes termed ''
currying In mathematics and computer science, currying is the technique of translating a function that takes multiple arguments into a sequence of families of functions, each taking a single argument. In the prototypical example, one begins with a functi ...
''). In partial application, some number of the rightmost arguments of the function (which are the last ones placed on the stack before the function is involved) are ''frozen'' to given values, to produce a new function of fewer arguments, which is a closure of the original function. For instance, consider a function for computing general second-degree polynomials: function poly2 x a b c; a * x * x + b * x + c end; This can be bound, for instance as vars less1squared; poly2(% 1, -2, 1%) -> less1squared; such that the expression less1squared(3) applies the closure of poly2 with three arguments frozen, to the argument 3, returning the square of (3 - 1), which is 4. The application of the partially applied function causes the frozen values (in this case 1, -2, 1) to be added to whatever is already on the stack (in this case 3), after which the original function poly2 is invoked. It then uses the top four items on the stack, producing the same result as poly2(3, 1, -2, 1) i.e. 1*3*3 + (-2)*3 + 1


Operator definition

In POP-2, it was possible to define new operations (operators in modern terms).POP-2 Reference Manual
page 217, and An Introduction to the Study of Programming Languages, by David William Barron, page 75 vars operation 3 +*; lambda x y; x * x + y * y end -> nonop +* The first line declares a new operation +* with precedence (priority) 3. The second line creates a function f(x,y)=x*x+y*y, and assigns it to the newly declared operation +*.


History

The original version of POP-2 was implemented on an Elliott 4130 computer in the University of Edinburgh (with only 64 KB RAM, doubled to 128 KB in 1972). POP-2 was ported to the
ICT 1900 series ICT 1900 was a family of mainframe computers released by International Computers and Tabulators (ICT) and later International Computers Limited (ICL) during the 1960s and 1970s. The 1900 series was notable for being one of the few non-America ...
on a 1909 at Lancaster University by John Scott in 1968. In the mid-1970s, POP-2 was ported to
BESM-6 BESM-6 (, short for ''Большая электронно-счётная машина'', i.e. 'Large Electronic Calculating Machine') was a Soviet electronic computer of the BESM series. Overview The BESM-6 was the most well-known and influential ...
(POPLAN System). In 1978 Hamish Dewar implemented a version of POP-2 specifically for use by Edinburgh University undergraduates in the AI2 (Artificial Intelligence, 2nd year level) class using the EMAS operating system. This implementation was written from scratch in the Edinburgh programming language,
IMP IMP or imp may refer to: * Imp, a fantasy creature Arts and entertainment Music * IMP (band) a Japanese boy band Fictional characters * Imp (She-Ra), a character in ''She-Ra: Princess of Power'' * Imp a character in '' Artemis Fowl: The L ...
. Later versions were implemented for
Computer Technology Limited Computer Technology Limited (CTL) was a British computer company founded in 1965. In 1984 it merged into its holding company and was called Information Technology Limited (ITL). Founder Iann Barron had worked for Elliott Automation but left ...
(CTL) Modular One,
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
,
ICL 1900 series ICT 1900 was a family of mainframe computers released by International Computers and Tabulators (ICT) and later International Computers Limited (ICL) during the 1960s and 1970s. The 1900 series was notable for being one of the few non-American ...
(running the operating system
George George may refer to: Names * George (given name) * George (surname) People * George (singer), American-Canadian singer George Nozuka, known by the mononym George * George Papagheorghe, also known as Jorge / GEØRGE * George, stage name of Gior ...
). Julian Davies, in Edinburgh, implemented an extended version of POP-2, which he named ''POP-10'' on the PDP-10 computer running
TOPS-10 TOPS-10 System (Timesharing / Total Operating System-10) is a discontinued operating system from Digital Equipment Corporation (DEC) for the PDP-10 (or DECsystem-10) mainframe computer family. Launched in 1967, TOPS-10 evolved from the earlier "Mo ...
. This was the first dialect of POP-2 that treated case as significant in identifier names, used lower case for most system identifiers, and supported long identifiers with more than 8 characters. Shortly after that, a new implementation known as ''WPOP'' (for WonderPop) was implemented by Robert Rae and Allan Ramsay in Edinburgh, on a research-council funded project. That version introduced caged address spaces, some compile-time syntactic typing (e.g., for integers and reals), and some pattern matching constructs for use with a variety of
data structure In computer science, a data structure is a data organization and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the relationships amo ...
s. In parallel with that, Steve Hardy at
University of Sussex The University of Sussex is a public university, public research university, research university located in Falmer, East Sussex, England. It lies mostly within the city boundaries of Brighton and Hove. Its large campus site is surrounded by the ...
implemented a subset of POP-2, which he named ''
POP-11 POP-11 is a Reflective programming, reflective, Dynamic compilation, incrementally compiled programming language with many of the features of an interpreted language. It is the core language of the Poplog Computer programming, programming system ...
'' which ran on a
Digital Equipment Corporation Digital Equipment Corporation (DEC ), using the trademark Digital, was a major American company in the computer industry from the 1960s to the 1990s. The company was co-founded by Ken Olsen and Harlan Anderson in 1957. Olsen was president until ...
(DEC) PDP-11/40 computer. It was originally designed to run on the DEC operating system RSX-11D, in time-shared mode for teaching, but that caused so many problems that an early version of
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
was installed and used instead. That version of Pop-11 was written in Unix
assembly language In computing, assembly language (alternatively assembler language or symbolic machine code), often referred to simply as assembly and commonly abbreviated as ASM or asm, is any low-level programming language with a very strong correspondence bet ...
, and code was incrementally compiled to an intermediate
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
which was interpreted. That port was completed around 1976, and as a result, Pop-11 was used in several places for teaching. To support its teaching function, many of the syntactic features of POP-2 were modified, e.g., replacing with and adding a wider variety of looping constructs with closing brackets to match their opening brackets instead of the use of for all loops in POP-2. Pop-11 also introduced
pattern matcher
for list structures, making it far easier to teach
artificial intelligence Artificial intelligence (AI) is the capability of computer, computational systems to perform tasks typically associated with human intelligence, such as learning, reasoning, problem-solving, perception, and decision-making. It is a field of re ...
(AI) programming. Around 1980, Pop-11 was ported to a
VAX-11/780 The VAX-11 is a discontinued family of 32-bit superminicomputers, running the Virtual Address eXtension (VAX) instruction set architecture (ISA), developed and manufactured by Digital Equipment Corporation (DEC). Development began in 1976. In ad ...
computer by Steve Hardy and John Gibson, and soon after that it was replaced by a full incremental compiler (producing machine-code instead of an interpreted intermediate code). The existence of the compiler and all its subroutines at run time made it possible to support far richer language extensions than are possible with Macros, and as a result Pop-11 was used (by Steve Hardy, Chris Mellish and John Gibson) to produce an implementation of
Prolog Prolog is a logic programming language that has its origins in artificial intelligence, automated theorem proving, and computational linguistics. Prolog has its roots in first-order logic, a formal logic. Unlike many other programming language ...
, using the standard syntax of Prolog, and the combined system became known as
Poplog Poplog is a reflective, incrementally compiled software development computer programming integrated development environment and system platform for the programming languages POP-11, Common Lisp, Prolog, and Standard ML. It was created originall ...
, to which
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
and
Standard ML Standard ML (SML) is a General-purpose programming language, general-purpose, High-level programming language, high-level, Modular programming, modular, Functional programming, functional programming language with compile-time type checking and t ...
were added later. This version was later ported to a variety of machines and operating systems and as a result Pop-11 became the dominant dialect of POP-2, still available in the Poplog system. Around 1986, a new AI company Cognitive Applications Ltd., collaborated with members of Sussex university to produce a variant of Pop-11 named ''AlphaPop'' running on Apple
Mac Mac or MAC may refer to: Common meanings * Mac (computer), a line of personal computers made by Apple Inc. * Mackintosh, a raincoat made of rubberized cloth * Mac, a prefix to surnames derived from Gaelic languages * McIntosh (apple), a Canadi ...
computers, with integrated graphics. This was used for many commercial projects, and to teach AI programming in several universities. That it was implemented in an early dialect of C, using an idiosyncratic compiler made it very hard to maintain and upgrade to new versions of the Mac operating system. Also, AlphaPop was not "
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in a maximum of 32- bit units. Compared to smaller bit widths, 32-bit computers can perform la ...
clean" due to the use of high address bits as ''tag bits'' to signify the type of objects, which was incompatible with the use of memory above 8 Mb on later Macintoshes.


See also

*
POP-11 POP-11 is a Reflective programming, reflective, Dynamic compilation, incrementally compiled programming language with many of the features of an interpreted language. It is the core language of the Poplog Computer programming, programming system ...
programming language *
Poplog Poplog is a reflective, incrementally compiled software development computer programming integrated development environment and system platform for the programming languages POP-11, Common Lisp, Prolog, and Standard ML. It was created originall ...
programming environment


References

;General * * *
POP references
;Inline


External links




Computers and Thought: A practical Introduction to Artificial Intelligence

An Introduction to the POP-2 Programming Language, by P. M. Burstall and J. S. Collins. POP-2 Reference Manual, by P. M. Burstall and J. S. Collins.
{{Authority control Functional languages Lisp programming language family History of computing in the United Kingdom Programming languages Programming languages created in 1970 Science and technology in Edinburgh University of Edinburgh University of Sussex