Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
POP-2
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Short description|Programming language}} {{For|other topics with similar names|POP2 (disambiguation){{!}}POP2}} {{More footnotes needed|date=April 2010}} {{Use dmy dates|date=April 2022}} {{Use British English|date=March 2024}} {{Infobox programming language | name = POP-2 | logo = <!-- Filename only --> | logo caption = | screenshot = <!-- Filename only --> | screenshot caption = | sampleCode = | paradigm = [[Programming paradigm|Multi-paradigm]]: [[Structured programming|structured]], [[Reflective programming|reflective]], [[Procedural programming|procedural]] | family = [[Lisp (programming language)|Lisp]]: POP | designers = [[Robin Popplestone]]; [[Rod Burstall]], Steve Hardy; Robert Rae, Allan Ramsay | developers = [[University of Edinburgh]]<br/>[[University of Sussex]] | released = {{Start date and age|1970}} | latest release version = 1975 | latest release date = {{Start date and age|1975}} | typing = [[Dynamic typing|dynamic]] | memory management = | scope = | programming language = [[Assembly language|assembly]] | platform = [[Elliott Brothers (computer company)|Elliott 4130]], [[ICT 1900 series|ICT 1909]], [[BESM-6]], [[PDP-10]], [[PDP-11]] | operating system = [[GEORGE (operating system)|George]], [[TOPS-10]], [[Unix]] | license = [[Proprietary software|Proprietary]] | file ext = | file format = <!-- or: | file formats = --> | website = <!-- {{URL|}} --> | implementations = WPOP | dialects = POP-10 | influenced by = [[Lisp (programming language)|Lisp]], [[ALGOL 60]], [[COWSEL]] (renamed POP-1) | influenced = [[POP-11]] }} '''POP-2''' (also called '''POP2''') is a [[programming language]] developed around 1970 from the earlier language POP-1 (developed by Robin Popplestone in 1968, originally named [[COWSEL]]) by [[Robin Popplestone]] and [[Rod Burstall]] at the [[University of Edinburgh]]. It drew roots from many sources: the languages [[Lisp (programming language)|Lisp]] and [[ALGOL 60]], and theoretical ideas from [[Peter J. Landin]]. It used an [[incremental compiler]], which gave it some of the flexibility of an [[interpreted language]], 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]]), without the overhead of an interpreted language.<ref>{{cite book |last1=Burstall |first1=R.M. |author1-link=Rod Burstall |last2=Collins |first2=J.S. |last3=Popplestone |first3=R.J. |author3-link=Robin Popplestone |date=1968 |title=POP-2 Papers |url=http://bitsavers.informatik.uni-stuttgart.de/pdf/univOfEdinburgh/POP-2_Papers_1968.pdf |location=London |publisher=The Round Table}}</ref> ==Description== ===Stack=== POP-2's [[Syntax (programming languages)|syntax]] is [[ALGOL]]-like, except that [[Assignment (computer science)|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 ''[[Stack (abstract data type)|operand stack]]''. Thus, the prior assignment can be written as two separate [[Statement (computer science)|statements]]: 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 (computer science)|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-oriented programming|stack-based]] 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 {{code|close}}, as {{code|endif}} hadn't become a common {{code|end-of-if-clause}} 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., {{code|newarray}}<ref>{{Cite web |url=http://www.cs.bham.ac.uk/research/projects/poplog/doc/pophelp/newarray |title=Help Newarray |last1=Rubinstein |first1=Mark |last2=Sloman |first2=A. |date=October 1985 β April 1989 |website=University of Birmingham |access-date=22 March 2024}}</ref> (for arrays that can contain any type of item) and {{code|newanyarray}}<ref>{{Cite web |url=http://www.cs.bham.ac.uk/research/projects/poplog/doc/pophelp/newanyarray |title=Help Newanyarray |last1=Hardy |first1=Steven |last2=Williams |first2=John |last3=Sloman |first3=A. |date=January 1978 β April 1986 |website=University of Birmingham |access-date=22 March 2024}}</ref> 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'',<ref>{{Cite web |url=http://www.cs.bham.ac.uk/research/projects/poplog/doc/pophelp/updater |title=Help Updater |last=Sloman |first=A. |date=April 1985 |website=University of Birmingham |access-date=21 March 2024}}</ref> which is called on the receiving side of an assignment. Thus, if the variable {{code|a}} contains an array, then 3 -> a(4); is equivalent to updater(a)(3, 4); the builtin function {{code|updater}} returning the updater of the doublet. Of course, {{code|updater}} 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 is [http://www.cs.bham.ac.uk/research/projects/poplog/doc/pophelp/partapply ''partial application''], (sometimes termed ''[[currying]]''). 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 (computer programming)|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).<ref>[https://www.cs.utexas.edu/~moore/best-ideas/pltp/POP-2-Reference-Manual.pdf POP-2 Reference Manual], page 217, and An Introduction to the Study of Programming Languages, by David William Barron, page 75</ref> 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 Brothers (computer company)|Elliott 4130]] computer in the University of Edinburgh (with only 64 KB RAM, doubled to 128 KB in 1972).<ref name=4100manual-197002>{{cite web |url=http://www.chilton-computing.org.uk/acd/pdfs/pop2_4130.pdf |title=POP-2/4100 Users' Manual |last=Dunn |first=Raymond D. |publisher=University of Edinburgh |work=School of Artificial Intelligence |date=February 1970 |access-date=3 June 2022}}</ref> POP-2 was ported to the [[ICT 1900 series]] on a 1909 at Lancaster University by John Scott in 1968. In the mid-1970s, POP-2 was ported to [[BESM-6]] (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 [[Edinburgh_Multiple_Access_System|EMAS]] operating system. This implementation was written from scratch in the Edinburgh programming language, [[Edinburgh_IMP|IMP]].<ref name=emas_pop2>{{cite web |url=https://history.dcs.ed.ac.uk/archive/languages/pop2/POP2V11S |title=EMAS Pop-2 source code |last=Dewar |first=Hamish}}</ref> Later versions were implemented for [[Computer Technology Limited]] (CTL) Modular One, [[PDP-10]], [[ICT 1900 series|ICL 1900 series]] (running the operating system [[GEORGE (operating system)|George]]). Julian Davies, in Edinburgh, implemented an extended version of POP-2, which he named ''POP-10'' on the PDP-10 computer running [[TOPS-10]]. 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]]s. In parallel with that, Steve Hardy at [[University of Sussex]] implemented a subset of POP-2, which he named ''[[POP-11]]'' which ran on a [[Digital Equipment Corporation]] (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]] was installed and used instead. That version of Pop-11 was written in Unix [[assembly language]], and code was incrementally compiled to an intermediate [[bytecode]] 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 {{code|function ... end}} with {{code|define ... enddefine}} and adding a wider variety of looping constructs with closing brackets to match their opening brackets instead of the use of {{code|close}} for all loops in POP-2. Pop-11 also introduced a [http://www.cs.bham.ac.uk/research/projects/poplog/doc/popteach/matches pattern matcher] for list structures, making it far easier to teach [[artificial intelligence]] (AI) programming. Around 1980, Pop-11 was ported to a [[VAX-11/780]] 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]], using the standard syntax of Prolog, and the combined system became known as [[Poplog]], to which [[Common Lisp]] and [[Standard ML]] 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 (computer)|Mac]] 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 computing|32-bit]] 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]] programming language * [[Poplog]] programming environment ==References== ;General * {{cite book|last1=Burstall|first1=R.|last2=Collins|first2=J.|last3=Popplestone|first3=R.|title=Programming in Pop-2|year=1968|publisher=Edinburgh University Press|location=Edinburgh}} * {{cite journal|last=Davies|first=D.J.M.|year=1976|title=POP-10 Users' Manual|journal=Computer Science Report|issue=25}} * {{cite book|last1=Smith|first1=R.|last2=Sloman|first2=A.|last3=Gibson|first3=J.|editor=[[Derek H. Sleeman|D. Sleeman]] and N. Bernsen|title=Research Directions in Cognitive Science|volume=5: Artificial Intelligence|year=1992|publisher=Lawrence Erlbaum Associates|pages=203β231|chapter=POPLOG's two-level virtual machine support for interactive languages}} * [http://www.cs.bham.ac.uk/research/poplog/doc/pophelp/poprefs POP references] ;Inline {{Reflist}} ==External links== * [http://www-robotics.cs.umass.edu/Popplestone/pop_development.html The Early Development of POP] * [http://www.cs.bham.ac.uk/research/projects/poplog/computers-and-thought/ Computers and Thought: A practical Introduction to Artificial Intelligence] * [http://bitsavers.informatik.uni-stuttgart.de/pdf/univOfEdinburgh/POP-2_Papers_1968.pdf 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.] {{POP programming}} {{Lisp programming language}} {{Authority control}} [[Category:Functional languages]] [[Category:Lisp programming language family]] [[Category:History of computing in the United Kingdom]] [[Category:Programming languages]] [[Category:Programming languages created in 1970]] [[Category:Science and technology in Edinburgh]] [[Category:University of Edinburgh]] [[Category:University of Sussex]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite journal
(
edit
)
Template:Cite web
(
edit
)
Template:Code
(
edit
)
Template:For
(
edit
)
Template:Infobox programming language
(
edit
)
Template:Lisp programming language
(
edit
)
Template:More footnotes needed
(
edit
)
Template:POP programming
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Use British English
(
edit
)
Template:Use dmy dates
(
edit
)