# CPL (programming language)

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/CPL_(programming_language)
> Markdown URL: https://mediated.wiki/source/CPL_(programming_language).md
> Source: https://en.wikipedia.org/wiki/CPL_(programming_language)
> Source revision: 1331690379
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{Short description|Computer programming language from 1960s}}
{{Use dmy dates|date=April 2022}}
{{Infobox programming language
| name = CPL
| logo = 
| paradigm = [Multi-paradigm](/source/multi-paradigm_programming_language):
[procedural](/source/procedural_programming), [imperative](/source/Imperative_programming_language), [structured](/source/structured_programming), [functional](/source/functional_programming)
| year = {{start date and age|1963}}
| designer = [Christopher Strachey](/source/Christopher_Strachey) et al.
| developer = 
| latest_release_version = 
| latest_release_date = 
| typing = 
| implementations = 
| dialects = 
| influenced_by = [ALGOL 60](/source/ALGOL_60)
| influenced = [BCPL](/source/BCPL)
| website = 
}}

'''CPL''' ('''Combined Programming Language''') is a [multi-paradigm programming language](/source/multi-paradigm_programming_language) developed in the early 1960s.  It is an early ancestor of the [C language](/source/C_language) via the [BCPL](/source/BCPL) and [B](/source/B_(programming_language)) languages.

==Design==
CPL<ref>{{Cite journal|last1=Barron|first1=D. W.|last2=Buxton|first2=J. N.|last3=Hartley|first3=D. F.|last4=Nixon|first4=E.|last5=Strachey|first5=C.|date=1963-08-01|title=The Main Features of CPL|journal=The Computer Journal|language=en|volume=6|issue=2|pages=134–143|doi=10.1093/comjnl/6.2.134|issn=0010-4620|doi-access=free}}</ref> was developed initially at the Mathematical Laboratory at the [University of Cambridge](/source/University_of_Cambridge) as the "Cambridge Programming Language" and later published jointly between Cambridge and the [University of London](/source/University_of_London) Computer Unit as the "Combined Programming Language" (CPL was also nicknamed by some as "Cambridge Plus London"<ref>{{cite web |title=Clive Feather on CPL and BCPL |url=http://www.lysator.liu.se/c/clive-on-history.html |accessdate=2013-08-18 |publisher=Lysator.liu.se}}</ref> or "Christopher's Programming Language"<ref>{{cite news |last1=Jensen |first1=Richard |date=December 9, 2020 |title="A damn stupid thing to do"—the origins of C |language=en-us |work=Ars Technica |url=https://arstechnica.com/features/2020/12/a-damn-stupid-thing-to-do-the-origins-of-c/ |access-date=December 10, 2020}}</ref>). [Christopher Strachey](/source/Christopher_Strachey), [David Barron](/source/David_W._Barron) and others were involved in its development. The first paper describing it was published in 1963, while it was being implemented on the [Titan Computer](/source/Titan_(1963_computer)) at Cambridge and the [Atlas Computer](/source/Atlas_Computer_(Manchester)) at London.

It was heavily influenced by [ALGOL 60](/source/ALGOL_60), but instead of being extremely small, elegant and simple, CPL was intended for a wider application area than scientific calculations and was therefore much more complex and not as elegant as ALGOL 60. CPL was a big language for its time, and it attempted to go beyond ALGOL to include industrial process control, business data processing, and possibly some early command line games.<ref>{{Cite book|last=Yadav|first=P.|url=https://books.google.com/books?id=-aBnYOHMNjUC&q=CPL+attempted+to+go+beyond+ALGOL&pg=PA180|title=Computer and Languages|date=2005|publisher=Discovery Publishing House|isbn=978-81-8356-041-2|language=en}}</ref> CPL was intended to allow low-level programming and high level abstractions using the same language.

However, CPL was only implemented very slowly. The first CPL compiler was probably written around 1970,<ref name="peter_norvig">{{cite news |last1=Norvig |first1=Peter |author1-link=Peter Norvig |title=Prescient but Not Perfect: A Look Back at a 1966 Scientific American Article on Systems Analysis |url=https://blogs.scientificamerican.com/at-scientific-american/systems-analysis-look-back-1966-scientific-american-article/ |access-date=December 10, 2020 |work=Scientific American Blog Network |date=August 23, 2011 |language=en}}</ref> but the language never gained much popularity and seems to have disappeared without trace sometime in the 1970s.

[BCPL](/source/BCPL) (for "Basic CPL", although originally "Bootstrap CPL") was a much simpler language based on CPL, intended primarily as a [systems programming](/source/systems_programming) language, particularly for writing [compiler](/source/compiler)s;<ref>{{Cite book|last1=Mitchell|first1=John C.|url=https://books.google.com/books?id=7Uh8XGfJbEIC&q=bcpl+programming+language&pg=PA100|title=Concepts in Programming Languages|last2=Apt|first2=Krzysztof
|author-link2=Krzysztof R. Apt
|date=2003|publisher=Cambridge University Press|isbn=978-0-521-78098-8|language=en}}</ref> it was first implemented in 1967, prior to CPL's first implementation. BCPL then led, via [B](/source/B_(programming_language)), to the popular and influential [C programming language](/source/C_(programming_language)).

==Example==
The function MAX as formulated by [Peter Norvig](/source/Peter_Norvig):<ref name="peter_norvig"/>

<pre>
Max(Items, ValueFunction) = value of
§ (Best, BestVal) = (NIL, -∞)
while Items do §
(Item, Val) = (Head(Items), ValueFunction(Head(Items)))
if Val > BestVal then (Best, BestVal) := (Item, Val)
Items := Rest(Items) &#x338;§
result is Best &#x338;§
</pre>

The closing section block symbol used here ({{code| ̸§}}) is an approximation of the original symbol, in which the cross stroke is vertical. This is available in Unicode as {{code|§⃒}} but does not display correctly on many systems.

== Implementations ==
It is thought that CPL was never fully implemented in the 1960s, existing as a theoretical construct with some research work on partial implementations.<ref>{{cite journal |last1=Coulouris |first1=G. F. |author-link=George Coulouris (computer scientist) |date=1 January 1968 |title=The London CPL1 compiler |journal=The Computer Journal |language=en |volume=11 |pages=26–30 |doi=10.1093/comjnl/11.1.26 |doi-access=free}}</ref><ref>{{Cite web |last=Coulouris |first=George |author-link=George Coulouris (computer scientist) |date=2013 |title=Computer Resurrection Issue 62 / The Compiler Compiler - Reflections of a User 50 Years On / The CPL1 Compiler |url=http://www.cs.man.ac.uk/CCS/res/res62.htm#d |access-date=2023-05-03 |website=Computer Conservation Society}}</ref>

Peter Norvig has written (for Yapps, a Python [compiler-compiler](/source/compiler-compiler)) a simple CPL to [Python](/source/Python_(programming_language)) translator for modern machines.<ref name="peter_norvig"/><ref>{{cite web |last1=Norvig |first1=Peter |title=Complete Annotated Checkers Program |url=http://norvig.com/sciam/checkers-complete.html |website=norvig.com |access-date=11 June 2021}}</ref>

==See also==
* ''[Fundamental Concepts in Programming Languages](/source/Fundamental_Concepts_in_Programming_Languages)''

==References==
{{Reflist}}

==Bibliography==
* How BCPL evolved from CPL, Martin Richards, 2011 [https://www.cl.cam.ac.uk/~mr10/cpl2bcpl.pdf]
* Collected papers of Christopher Strachey, section pertaining to CPL, archived at the Bodleian Library, Oxford; [http://www.nationalarchives.gov.uk/a2a/records.aspx?cat=161-csac71180&cid=3-5-1#3-5-1 CSAC 71.1.80/C.136-C.184]
* D.&nbsp;W. Barron, J.&nbsp;N. Buxton, D.&nbsp;F. Hartley, E. Nixon, and C. Strachey. ["The main features of CPL"](/source/doi%3A10.1093%2Fcomjnl%2F6.2.134) ''The Computer Journal'' '''6''':2:134-143 (1963), available [http://www.math.bas.bg/~bantchev/place/cpl/features.pdf online].
* J. Buxton, J.&nbsp;C. Gray, and D. Park. [http://www.ancientgeek.org.uk/CPL/CPL_Elementary_Programming_Manual.pdf CPL Elementary Programming Manual, Edition II (Cambridge)] (1966).
* University of London Institute of Computer Science and The Mathematical Laboratory, Cambridge. [http://www.ancientgeek.org.uk/CPL/CPL_Working_Papers.pdf CPL Working Papers] (1966).

Category:History of computing in the United Kingdom
Category:Procedural programming languages
Category:Programming languages created in 1963
Category:Structured programming languages
Category:University of Cambridge Computer Laboratory

---
Adapted from the Wikipedia article [CPL (programming language)](https://en.wikipedia.org/wiki/CPL_(programming_language)) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/CPL_(programming_language)?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
