Content deleted Content added
m v2.05 - Fix errors for CW project (Template without correct beginning - Spelling and typography) |
m WP:ADOPTYPO boolean -> Boolean |
||
(42 intermediate revisions by 13 users not shown) | |||
Line 1:
{{Short description|Handheld calculator operating system}}
{{About||the programming language for the Commodore PET/CBM computers|Reverse Polish Language|the compiled database programming language|Real-time Programming Language}}
{{Use dmy dates|date=April 2019|cs1-dates=y}}
{{Use list-defined references|date=October 2023}}
{{Infobox programming language
| name = RPL
| logo =
| paradigm = [[Concatenative programming|Concatenative]] ([[stack-oriented programming language|stack-based]]),<ref name="Joy_2020"/> [[structured programming|structured]]
| year = 1984<!-- development start --> (1986<!-- first products using it -->)
| designer = [[Hewlett-Packard]]
| developer =
| latest_release_version = <!-- X.Y.Z/{{release date|df=yes|YYYY|MM|DD}} -->
| latest_release_date = 2012-04-26<!-- HP 50g 2.16 --><ref name="HP_4"/><ref name="HP_7"/><ref name="HP_5"/><ref name="HP_6"/>
| discontinued = 2015<!-- HP 50g -->
| typing =
Line 16 ⟶ 19:
| influenced_by = [[Reverse Polish Notation|RPN]], [[Forth (programming language)|Forth]], [[Lisp (programming language)|Lisp]]<ref name="HPJ38"/>
| influenced =
| operating_system = [[Hewlett-Packard|HP]] [[
| license =
| website =
| file_ext =
}}
[[File:HP48G.jpg | thumb | 220x124px | right | HP 48G calculator, uses RPL ]]
'''RPL'''{{ref|rpl_acronym_note_1}} is a [[calculator|handheld calculator]] operating system and application [[programming language]] used on [[Hewlett-Packard]]'s scientific graphing [[Reverse Polish Notation|RPN]] (Reverse Polish Notation) calculators of the [[HP-28 series|HP 28]], [[HP 48 series|48]], [[HP 49 series|49]] and [[HP 50g|50]] series, but it is also usable on non-RPN calculators, such as the [[HP 38G|38]], [[HP 39/40 series|39 and 40]] series.▼
▲'''RPL'''{{ref|rpl_acronym_note_1}} is a [[calculator|handheld calculator]] operating system and application [[programming language]] used on [[Hewlett-Packard]]'s scientific graphing [[Reverse Polish Notation|RPN]] (Reverse Polish Notation) calculators of the [[HP-28 series|HP 28]], [[HP 48 series|48]], [[HP 49 series|49]] and [[HP 50g|50]] series, but it is also usable on non-RPN calculators, such as the [[HP 38G|38]], [[HP 39/40 series|39 and 40]] series. Internally, it was also utilized by the [[HP-17B|17B]], [[HP-18C|18C]], [[HP-19B|19B]] and [[HP-27S|27S]].<ref name="RPLMAN"/>
RPL is a [[structured programming]] language based on RPN, but equally capable of processing [[infix notation|algebraic]] expressions and formulae, implemented as a [[
RPL originated from HP's [[Corvallis, Oregon]] development facility in 1984 as a replacement for the previous practice of implementing the [[operating systems]] of calculators in [[assembly language]].<ref name="RPLMAN"/> The first calculator utilizing it internally was the HP-18C and the first calculator making it available to users was the HP-28C, both from 1986.<ref name="Wickes_1987"/><ref name="RPLMAN"/> The last pocket calculator supporting RPL, the HP 50g, was discontinued in 2015.<ref name="Kuperus_2015_1"/><ref name="Kuperus_2015_2"/><ref name="Wessman_2015"/> However,
==Variants==
The internal low- to medium-level variant of RPL, called '''[[HP 49 series#Programming|System RPL]]''' (or '''SysRPL''') is used on some earlier HP calculators as well as the aforementioned ones, as part of their [[operating system]] implementation language.
==Control blocks==
RPL control blocks are not strictly [[
===Conditional statements===
====IF/THEN/ELSE/END====
RPL supports basic conditional testing through the IF/THEN/ELSE structure.
IF condition THEN if-true [ELSE if-false] END
Line 44 ⟶ 49:
« IF 1 == THEN "Equal to one" END »
The IF construct evaluates the condition then tests the bottom of the stack for the result. As a result, RPL can optionally support FORTH-style IF blocks, allowing the condition to be determined before the block.
« 1 == IF THEN "Equal to one" END »
Line 51 ⟶ 56:
Postfix conditional testing may be accomplished by using the IFT ("if-then") and IFTE ("if-then-else") functions.
IFT and IFTE pop two or three commands off the stack, respectively.
The following example uses the IFT function to pop an object from the bottom of the stack and, if it is equal to 1, replaces it with "One":
Line 57 ⟶ 62:
« 1 == "One" IFT »
The following example uses the IFTE function to pop an object from the bottom of the stack and, if it is equal to 1, replaces it with "One".
« 1 == "One" "Not one" IFTE »
IFT and IFTE will evaluate a program block given as one of its arguments, allowing a more compact form of conditional logic than an IF/THEN/ELSE/END structure.
«
Line 71 ⟶ 76:
====CASE/THEN/END====
To support more complex conditional logic, RPL provides the CASE/THEN/END structure for handling multiple exclusive tests.
CASE
Line 80 ⟶ 85:
END
The following code illustrates the use of a CASE/THEN/END block.
«
Line 115 ⟶ 120:
====FOR/NEXT====
RPL provides a FOR/NEXT statement for looping from one index to another.
index_from index_to FOR variable_name loop_statement NEXT
The following example uses the FOR loop to sum the numbers from 1 to 10.
«
Line 130 ⟶ 135:
====START/NEXT====
The START/NEXT block is used for a simple block that runs from a start index to an end index. Unlike the FOR/NEXT loop, the looping variable is not available.
index_from index_to START loop_statement NEXT
====FOR/STEP and START/STEP====
Both FOR/NEXT and START/NEXT support a user-defined step increment.
« 10 2 START -2 STEP »
====WHILE/REPEAT/END====
The WHILE/REPEAT/END block in RPL supports an indefinite loop with the condition test at the start of the loop.
WHILE condition REPEAT loop_statement END
====DO/UNTIL/END====
The DO/UNTIL/END block in RPL supports an indefinite loop with the condition test at the end of the loop.
DO loop_statement UNTIL condition END
Line 155 ⟶ 160:
* [[HP trigraph]]s
* [[Prime Programming Language]] (PPL)
* [[RPL character set]]
== Notes ==
:1.{{note|rpl_acronym_note_1}} "RPL" is derived from '''Reverse Polish Lisp''' according to its original developers,<ref name="Wickes_1988"/><ref name="Wickes_1991"/><ref name="Schoorl_2000"/><ref name="FAQ48"/><ref name="Nelson_2012"/><ref name="Jedrzejowicz_1996"/> while for a short time in 1987 HP marketing attempted to coin the [[backronym]] '''ROM-based Procedural Language''' for it.<ref name="HPJ38"/><ref name="Jedrzejowicz_1996"/><ref name="HP_2007"/> In addition, the RPL initials are sometimes incorrectly interpreted as Reverse Polish Logic
==References==
{{
<ref name="Joy_2020">{{cite web |url=https://www.hpmuseum.org/forum/showthread.php?mode=linear&tid=15509&pid=135732 |title=The Joy of Programming? |publisher=Museum of HP Calculators |date=2020 |archive-url=https://web.archive.org/web/20211203131528/https://www.hpmuseum.org/forum/showthread.php?mode=linear&tid=15509&pid=135732 |archive-date=2021-12-03}}</ref>
<ref name="HPJ38">{{cite journal |title=Computation for Handheld Calculators |author-last=Patton |author-first=Charles M. |journal=[[Hewlett-Packard Journal]] |publisher=[[Hewlett-Packard Company]] |___location=Palo Alto, California, USA |date=August 1987 |volume=38 |issue=8 |pages=21–25 |url=http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1987-08.pdf |access-date=2015-09-12}}</ref>▼
<ref name="HP_4">http://h41268.www4.hp.com/live/index_e.aspx?qid=20709&jumpid=va_r11363_us/en/any/tsg/pl_ot_ob_ds_pd/calculatoremulators_cc/dt{{dead link|date=April 2018 |bot=InternetArchiveBot|fix-attempted=yes}}</ref>
<ref name="Wickes_1988">{{cite book |chapter=RPL: A Mathematical Control Language |first=William C. |last=Wickes |editor-first=Lawrence P. |editor-last=Forsely |date=1988 |title=1988 Rochester Forth Conference Programming Environments, June 14–18, University of Rochester |publisher=Institute for Applied Forth Research, Inc. |isbn=978-0-91459308-9 |oclc=839704944 |pages=27–32 |quote=Several existing operating systems and languages were considered, but none could meet all of the design objectives. A new system was therefore developed, which merges the threaded interpretation of [[Forth (programming language)|Forth]] with the functional approach of [[Lisp (programming language)|Lisp]]. The resulting operating system, known unofficially as RPL (for Reverse-Polish Lisp), made its first public appearance in June of 1986 in the [[HP-18C]] Business Consultant calculator.}}</ref>▼
<ref name="HP_7">http://www.calculatrices-hp.com/index.php?page=emulateurs<!-- https://web.archive.org/web/20170917223308/http://www.calculatrices-hp.com/index.php?page=emulateurs --></ref>
<ref name="HP_5">{{cite web |url=http://www.hpmuseum.org/forum/thread-4405-post-39600.html |title=Emulator of HP 50g with #2.16 ROM}}</ref>
<ref name="HP_6">http://www.calculatrices-hp.com/uploads/emulateurs/HP50gVirtualCalculatorSetup_3_1_30.zip<!-- https://web.archive.org/web/20170917095533/http://www.calculatrices-hp.com/uploads/emulateurs/HP50gVirtualCalculatorSetup_3_1_30.zip --></ref>
▲<ref name="HPJ38">{{cite journal |title=Computation for Handheld Calculators |author-last=Patton |author-first=Charles M. |journal=[[Hewlett-Packard Journal]] |publisher=[[Hewlett-Packard Company]] |___location=Palo Alto, California, USA |date=August 1987 |volume=38 |issue=8 |pages=21–25 |url=http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1987-08.pdf |access-date=2015-09-12 |archive-date=2011-12-06 |archive-url=https://web.archive.org/web/20111206105511/http://www.hpl.hp.com/hpjournal/pdfs/IssuePDFs/1987-08.pdf |url-status=dead }}</ref>
▲<ref name="Wickes_1988">{{cite
<ref name="Schoorl_2000">{{cite web |title=HP48 Frequently Asked Questions List |author-first=André |author-last=Schoorl |date=2000-04-04 |pages=69 <!-- date=2015 |editor-first=Eric |editor-last=Rechlin | --> |publisher=HP Calculator Archive |orig-date=1997 |url=http://www.hpcalc.org/hp48/docs/faq/48faq-pdf.zip |access-date=2015-09-12}}</ref>
<ref name="FAQ48">{{cite web |title=I've heard the names RPL, Saturn, STAR, GL etc... What are they? - RPL |work=FAQ: 2 of 4 - Hardware, Programs, and Programming |id=8.1. |publisher=comp.sys.hp48 |date=2000-04-14 |version=4.62 |url=http://www.faqs.org/faqs/hp/hp48-faq/part2/ |access-date=2015-09-12}}</ref>
<ref name="Nelson_2012">{{cite journal |title=HP RPN Evolves |author-first=Richard J. |author-last=Nelson |publisher=[[Hewlett-Packard]] |journal=HP Solve |issue=27 |date=2012-04-04 |pages=30–32 |url=http://h20331.www2.hp.com/hpsub/downloads/HP_Calculator_eNL_04_April_2012%20(2).pdf |access-date=2015-09-12}}</ref>
<ref name="Jedrzejowicz_1996">{{cite book |title=A Guide to HP Handheld Calculators and Computers |author-first=Włodzimierz "Włodek"
<ref name="HP_2007">{{cite web |title=HP Celebrates 35 Years of Handheld Calculator Innovation |publisher=[[Hewlett-Packard Development Company, L.P.]] |date=2007 |url=http://h20331.www2.hp.com/Hpsub/cache/457008-0-0-225-121.html |archive-url=https://web.archive.org/web/20070317053857/http://h20331.www2.hp.com/Hpsub/cache/457008-0-0-225-121.html |archive-date=2007-03-17 |access-date=2015-09-13 |quote=1987: [[HP-28C]]: First full RPL calculator: In the late 1980s, HP developed a new programming language for its new series of extremely powerful calculators. By combining elements of RPN, [[Lisp (programming language)|Lisp]] and [[Forth (programming language)|Forth]], HP came up with a language called RPL (or ROM-based Procedural Language).}}</ref>
<ref name="RPL3">{{cite web |title=What is RPL? |author-first=Joseph K. |author-last=Horn |url=http://www.hpcalc.org/hp48/docs/programming/rpl3.txt |access-date=2017-09-17 |url-status=live |archive-url=https://web.archive.org/web/20170917221524/http://www.hpcalc.org/hp48/docs/programming/rpl3.txt |archive-date=2017-09-17}}</ref>
<ref name="RPLMAN">{{cite web |title=RPLMan from Goodies Disk 4 |author=Hewlett-Packard |author-link=Hewlett-Packard |format=RPLMAN.ZIP |url=http://www.hpcalc.org/details.php?id=1743<!-- http://www.hpcalc.org/hp48/docs/programming/rplman.zip--> |access-date=2015-09-12}}</ref>
<ref name="Wickes_1987">{{cite journal |title=The HP-28C: An Insider's Perspective |author-first=William C. |author-last=Wickes |journal=HPX Exchange |volume=1 |number=1 |date=January–February 1987 |pages= |url=}} [https://web.archive.org/web/20231006184209/https://www.hpmuseum.org/forum/thread-1140.html]</ref>
<ref name="Wickes_1991">{{cite web |title=RPL stands for Reverse Polish Lisp |author-first=William C. |author-last=Wickes |publisher=www.hpcalc.org |date=1991-03-11 |url=http://www.hpcalc.org/hp48/docs/programming/rpl.txt |access-date=2015-09-12 |quote=RPL stands for Reverse Polish Lisp. In the early days of RPL development, we got tired of calling the unnamed system "the new system", and one of the development team came up with "RPL", both as a play on "RPN" which has been the loved/hated hallmark of HP calcs forever, and as an accurate indication of the derivation of the language from [[Forth (programming language)|Forth]] and [[Lisp (programming language)|Lisp]].<br />RPL was never particularly intended to be a public term; at the time of the [[HP Journal]] article (August 1987) on the [[HP-28 series|HP 28C]] there was an attempt to create a less whimsical name--hence "ROM-based procedural language", which preserved the initials but had a more dignified sound. The development team never calls it anything but (the initials) RPL. You can choose either of the two full-word versions that you prefer. Or how about "Rich People's Language?" Bill Wickes, HP Corvallis.}}</ref>
<ref name="Kuperus_2015_1">{{cite web |title=HP 50g: End of an era |author-first=Klaas |author-last=Kuperus |publisher=Moravia |date=2015-03-04 |url=http://forum.hp-prime.de/discussion/787/hp-50g-end-of-an-era |url-status=dead |archive-url=https://web.archive.org/web/20150402112232/http://forum.hp-prime.de/discussion/787/hp-50g-end-of-an-era |archive-date=2015-04-02}}</ref>
<ref name="Kuperus_2015_2">{{cite web |title=HP 50g not so good news? |author-first=Klaas |author-last=Kuperus |publisher=Moravia |date=2015-03-06 |url=http://www.hpmuseum.org/forum/thread-3265-post-29694.html#pid29694 |access-date=2016-01-01}}</ref>
<ref name="Wessman_2015">{{cite web |title=Windows 10 won't allow HP 50g USB drivers to be installed |author-first=Timothy "Tim" James |author-last=Wessman |
<ref name="Wessman_2016">{{cite web |title=What to do with stack overflow OBJ->/LIST->? |author-first=Timothy "Tim" James |author-last=Wessman |date=2016-06-21 |orig-date=2016-06-20 |work=MoHPC - The Museum of HP Calculators |url=https://www.hpmuseum.org/forum/printthread.php?tid=6436 |access-date=2023-09-24 |url-status=live |archive-url=https://web.archive.org/web/20230924101041/https://www.hpmuseum.org/forum/printthread.php?tid=6436 |archive-date=2023-09-24}}</ref>
<ref name="deDinechin_2022">{{cite web |title=DB48X on DM42 - RPL runtime for the DM42 calculator, in the spirit of HP48/49/50 |author-first=Christophe |author-last=de Dinechin |author-link=Christophe de Dinechin |work=DB48X |date=2022 |url=https://github.com/c3d/DB48X-on-DM42 |access-date=2023-10-23 |url-status=live |archive-url=https://web.archive.org/web/20231103035417/https://github.com/c3d/DB48X-on-DM42 |archive-date=2023-11-03}}</ref>
<ref name="deDinechin_2023">{{cite web |title=Reviving Reverse Polish Lisp - Building an open-source HP48-like calculator |author-first=Christophe |author-last=de Dinechin |author-link=Christophe de Dinechin |date=2023-02-03<!-- /04 --> |work=[[FOSDEM]] |url=https://archive.fosdem.org/2023/schedule/event/reversepolishlisp/ |access-date=2023-10-03 |url-status=live |archive-url=https://web.archive.org/web/20231003174447/https://archive.fosdem.org/2023/schedule/event/reversepolishlisp/ |archive-date=2023-10-03}} (NB. An improved derivative of RPL called DB48X for the [[SwissMicros]] [[DM42]] and [[DM32]].)</ref>
<ref name="Lapilli_2014_1">{{cite web |title=newRPL |author-first=Claudio Daniel |author-last=Lapilli |date=2014-01-03 |url=http://hpgcc3.org/projects/newrpl |access-date=2015-09-12}} [https://newrpl.wiki.hpgcc3.org/doku.php?id=start] (an open source RPL derivative for the [[HP 50g]] and [[HP 49g+]], the [[HP 40gs]], [[HP 39gs]] and [[hp 39g+]]<!-- http://www.hpmuseum.org/forum/thread-8290.html --> as well as the [[HP Prime]])</ref>
<ref name="Lapilli_2014_2">{{cite web |title=N-Queens on 50g (RPL language) |author-first=Claudio Daniel |author-last=Lapilli |work=MoHPC - The Museum of HP Calculators |date=2014-10-31 |url=https://www.hpmuseum.org/forum/thread-2368-post-20947.html?highlight=newRPL#pid20947 |access-date=2023-10-23 |url-status=live |archive-url=https://web.archive.org/web/20231103034655/https://www.hpmuseum.org/forum/thread-2368-post-20947.html?highlight=newRPL#pid20947 |archive-date=2023-11-03}}</ref>
<ref name="Lapilli_2021">{{cite web |title=newRPL Documentation Project |author-first=Claudio Daniel |author-last=Lapilli |work=newRPL |date=2021-07-23 |orig-date=2014 |url=https://newrpl.wiki.hpgcc3.org/doku.php |access-date=2023-10-23 |url-status=live |archive-url=https://web.archive.org/web/20231103034753/https://newrpl.wiki.hpgcc3.org/doku.php |archive-date=2023-11-03}}</ref>
}}
Line 186 ⟶ 202:
* {{cite book |title=An Introduction to HP 48 System RPL and Assembly Language Programming |author-first=James |author-last=Donnelly |editor-first=Eric |editor-last=Rechlin |date=2009-03-01 |url=http://www.hpcalc.org/details.php?id=7114 |access-date=2015-09-07}}
==
* {{cite web |title=HP 49/50 Programming Documentation Files |author-first=Eric |author-last=Rechlin |publisher=HP Calculator Archive |date=2015 |orig-date=1997 |url=http://www.hpcalc.org/hp49/docs/programming/ |access-date=2015-09-12}}
* {{cite web |title=HP 48 Programming Documentation Files |author-first=Eric |author-last=Rechlin |publisher=HP Calculator Archive |date=2015 |orig-date=1997 |url=http://www.hpcalc.org/hp48/docs/programming/ |access-date=2015-09-12}}
* {{cite web |title=RPL |author-first=David G. |author-last=Hicks |date=2013 |orig-date=1995 |publisher=The Museum of HP Calculators (MoHPC) |url=http://www.hpmuseum.org/rpl.htm |access-date=2015-09-12 |url-status=live |archive-url=https://web.archive.org/web/20230930193241/https://www.hpmuseum.org/rpl.htm |archive-date=2023-09-30}}
* {{anchor|RPL/2}}{{cite web |title=RPL/2 - a new Reverse Polish Lisp |author-first=Joël |author-last=Bertrand |date=2015 |orig-date=2009 |url=http://www.rpl2.net |access-date=2015-09-12}} (a GPL licensed RPL clone)
* {{anchor|rpn}}{{cite web |title=
* {{anchor|MyRPL}}{{cite web |title=
{{DEFAULTSORT:Rpl (Programming Language)}}
|