RPL(프로그래밍 언어)
RPL (programming language)패러다임 | 스택, 구조화, 연결,[1] 부분 객체[2][3][4] 지향 |
---|---|
설계자 | 휴렛패커드 |
처음 등장한 | 1984 (1986) |
OS | HP 계산기 |
사투리 | |
시스템 RPL, 사용자 RPL | |
영향을 받다 | |
RPN, Fourth[5], Lisp |
RPL은[1] HP 28, 48, 49 및 50 시리즈의 Hewlett-Packard의 과학적 그래프 작성 RPN(Reverse Polish Notation) 계산기에서 사용되는 휴대용 계산기 운영 체제 및 응용 프로그램 프로그래밍 언어이지만 38, 39 및 40 시리즈와 같은 비 RPN 계산기에서도 사용할 수 있습니다.
RPL은 RPN에 기반한 구조화된 프로그래밍 언어이지만, 스레드화된 인터프리터로 [10]구현된 대수식 및 수식을 동등하게 처리할 수 있습니다.RPL은 Fourth와 많은 유사점을 가지고 있습니다.두 언어 모두 스택 기반이며 리스트 기반 LISP도 마찬가지입니다.고정 4레벨 스택을 가지고 있던 이전의 HP RPN 계산기와는 달리, RPL에서 사용되는 스택은 사용 가능한 계산기 RAM에 의해서만 제한됩니다.
RPL은 1984년 HP의 오리건주 Corvallis 개발시설에서 어셈블리 [11]언어로 계산기 운영체제를 구현하던 이전의 관행을 대체하기 위해 시작되었습니다.RPL을 지원하는 마지막 포켓 계산기인 HP 50g은 2015년에 [12][13][14]단종되었습니다.다만, HP의 RPL 계산기를 에뮬레이트 할 수 있는 복수의 에뮬레이터가 존재해, iOS나 Android 스마트폰을 포함한 다양한 operating system과 디바이스로 동작합니다.
변종
System RPL(또는 SysRPL)이라고 불리는 RPL의 내부 저레벨에서 중레벨의 변형은 운영체제 구현 언어의 일부로서 앞서 말한 일부 HP 계산기 및 그 계산기에서 사용됩니다.HP 48 시리즈에서는 외부 도구를 사용하지 않으면 계산기 사용자가 이 RPL에 액세스할 수 없지만 HP 49/50 시리즈에서는 시스템RPL을 사용하기 위한 컴파일러가 ROM에 내장되어 있습니다.SysRPL에서 코딩 중에 심각한 크래시가 발생할 수 있으므로 사용할 때는 주의해야 합니다.언어의 고급 사용자 RPL(또는 사용자 RPL) 버전은 텍스트 및 그래픽 애플리케이션 프로그램을 개발하기 위해 해당 그래프 계산기에서 사용할 수 있습니다.모든 UserRPL 프로그램은 내부적으로 SysRPL 프로그램으로 표시되지만 사용 가능한 SysRPL 명령의 안전한 서브셋만 사용합니다.단, UserRPL 명령어의 일부인 에러 체크에 의해 UserRPL 프로그램은 동등한 시스템RPL 프로그램보다 현저하게 느려집니다.UserRPL 명령 SYSEVAL은 사용자RPL 프로그램의 지정된 부분을 시스템RPL 코드로 처리하도록 계산기에 지시합니다.
제어 블록
RPL 제어 블록은 엄밀하게는 포스트픽스라고 할 수 없습니다.몇 가지 주목할 만한 예외가 있지만 제어 블록 구조는 표준 infix 언어와 동일하게 나타납니다.계산기는 이러한 블록의 구현을 필요에 따라 프로그램 스트림에서 건너뛰도록 함으로써 이를 관리합니다.
조건문
IF/THEN/ELSE/종료
RPL은 IF/THEN/ELSE 구조를 통해 기본적인 조건부 테스트를 지원합니다.이 블록의 기본 구문은 다음과 같습니다.
IF 조건 THEN if-true [ELSE if-false] 종료
다음 예제에서는 스택 하단의 번호가 "1"인지 여부를 테스트하고, "1"인 경우 "1과 동일"로 대체합니다.
① IF 1 == 그 후 "하나와 같다" END »
IF 컨스트럭트는 조건을 평가한 후 스택의 하단을 테스트하여 결과를 얻습니다.그 결과 RPL은 옵션으로 FORTH 스타일의 IF 블록을 지원할 수 있으므로 블록 전에 조건을 결정할 수 있습니다.조건을 비워두면 IF 문은 조건 실행 중에 스택을 변경하지 않고 스택 하단에 있는 기존 결과를 테스트에 사용합니다.
1 1 == IF THEN "Equal to One" END »
IFT/IFTE
수정 후 조건부 테스트는 IFT("if-then") 및 IFTE("if-then-else") 함수를 사용하여 수행할 수 있습니다.
IFT 및 IFTE는 각각2개 또는3개의 명령어를 스택에서 팝합니다.최상위 값은 부울값으로 평가되며 true일 경우 두 번째 최상위 값이 스택으로 푸시됩니다.IFTE는 부울이 false일 경우 스택에서 푸시백되는 세 번째 "else" 값을 허용합니다.
다음 예제에서는 IFT 함수를 사용하여 스택 하단에서 개체를 팝하고 1과 같으면 "One"로 대체합니다.
1 1 == "One" IFT »
다음 예제에서는 IFTE 함수를 사용하여 스택 하단에서 개체를 팝하고 1과 같으면 "One"로 바꿉니다.1이 아닐 경우 "Not one" 문자열로 대체합니다.
1 1 == "One" "One" IFTE »
IFT와 IFTE는 인수의 하나로 주어진 프로그램 블록을 평가하여 IF/THEN/ELSE/END 구조보다 더 콤팩트한 형식의 조건부 로직을 가능하게 합니다.다음 예제에서는 스택의 맨 아래에서 개체를 팝하고 1보다 작거나 큰지 여부에 따라 개체를 "One", "Less" 또는 "More"로 바꿉니다.
dup DUP 1 == » DROP "One" »»»1 < " Less " IFTE 、 IFTE »
케이스/그 후/종료
보다 복잡한 조건부 로직을 지원하기 위해 RPL은 복수의 배타적 테스트를 처리하기 위한 CASE/THEN/END 구조를 제공합니다.CASE 스테이트먼트 내의 브랜치 중 하나만 실행됩니다.이 블록의 기본 구문은 다음과 같습니다.
case condition_1 그 후 if-condition_1 END ... condition_n 그 후 if-condition_n END if-none END
다음 코드는 CASE/THEN/END 블록의 사용을 나타냅니다.스택 하단의 문자가 지정되면 해당 문자열에 해당하는 문자 또는 "알 수 없는 문자"로 대체합니다.
case Case DUP "A" == "Alpha" END DUP "B" == "Beta" END DUP "G" == "Gamma" END "Unknown Letter" END 스왑 드롭 @ 원래 문자 삭제 »
이 코드는 다음과 같은 중첩 IF/THEN/ELSE/END 블록과 동일합니다.
▶ DUP "A" == DUP "B" == DUP "G" == "Gamma" == "Unknown letter" END 스왑 @ 원본 문자 삭제 »
looping 스테이트먼트
대상/다음
RPL은 어떤 인덱스에서 다른 인덱스로 루프하기 위한 FOR/NEXT 문을 제공합니다.루프의 인덱스는 루프에서 액세스할 수 있는 임시 로컬 변수에 저장됩니다.FOR/NEXT 블록의 구문은 다음과 같습니다.
index_from index_to FOR 변수_name loop_statement NEXT
다음 예제에서는 FOR 루프를 사용하여 1 ~10 의 수치를 합계하고 있습니다.FOR 루프의 인덱스 변수는 " 입니다.I":
§ 0 @스택1 위의 0부터 시작 10 @루프 1~10 FOR I @ "I"는 로컬 변수 I + @ 실행 중인 총 NEXT @ Repeat...»
시작/다음
START/NEXT 블록은 시작 인덱스에서 끝 인덱스로 실행되는 단순 블록에 사용됩니다.FOR/NEXT 루프와는 달리 루프 변수는 사용할 수 없습니다.START/NEXT 블록의 구문은 다음과 같습니다.
index_from index_to START loop_statement NEXT
/ 스텝 및 시작 / 스텝
FOR/NEXT와 START/NEXT는 모두 사용자 정의 단계 증가를 지원합니다.terminating NEXT 키워드를 increment 및 STEP 키워드로 대체하면 루프 변수는 기본값 +1과는 다른 값으로 증가 또는 감소합니다.예를 들어, 다음 루프는 루프 인덱스를 2씩 감소시킴으로써 10에서2로 후퇴합니다.
§ 10 2 START - 2 STEP »
실행 중/반복 중/종료
RPL의 WHIT/REPEAT/END 블록은 루프 시작 시 조건 테스트를 사용하여 무한 루프를 지원합니다.WHY/REPEAT/END 블록의 구문은 다음과 같습니다.
WHIN 조건 반복 루프_문 종료
실행/종료/종료
RPL의 DO/UNTIL/END 블록은 루프의 끝에 조건 테스트를 사용하여 무한 루프를 지원합니다.DO/UNTIL/END 블록의 구문은 다음과 같습니다.
조건이 끝날 때까지 loop_statement를 실행합니다.
「 」를 참조해 주세요.
메모들
- 1. ^ "RPL"은 원래 [15][16][17][18][19][20]개발자에 따르면 리버스 폴란드 리스프(Reverse Polish Lisp)에서 파생된 것이며,[5][20][21] 1987년 HP 마케팅은 잠시 동안 백로님롬 기반 절차 언어를 개발하려고 시도했다.또한 RPL 이니셜은 Reverse Polish Logic 또는 Reverse Polish Language로 해석될 수 있지만 이러한 이름은 [22]공식적이지 않습니다.
레퍼런스
- ^ "The Joy of Programming?". Museum of HP Calculators. 2020.
- ^ Urroz, Gilberto E. (2000). Programming the HP 49 G Calculator in User RPL Language (PDF).
- ^ "RPL". Museum of HP Calculators.
- ^ "RPN/RPL — What?". Museum of HP Calculators. 2003.
- ^ a b Patton, Charles M. (August 1987). "Computation for Handheld Calculators" (PDF). Hewlett-Packard Journal. Palo Alto, California, USA: Hewlett-Packard Company. 38 (8): 21–25. Retrieved 2015-09-12.
- ^ 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}}[영구 데드링크]
- ^ http://www.calculatrices-hp.com/index.php?page=emulateurs
- ^ "Emulator of HP 50g with #2.16 ROM".
- ^ http://www.calculatrices-hp.com/uploads/emulateurs/HP50gVirtualCalculatorSetup_3_1_30.zip
- ^ Horn, Joseph K. "What is RPL?". Archived from the original on 2017-09-17. Retrieved 2017-09-17.
- ^ Hewlett-Packard. "RPLMan from Goodies Disk 4" (RPLMAN.ZIP). Retrieved 2015-09-12.
- ^ Kuperus, Klaas (2015-03-04). "HP 50g: End of an era". Moravia. Archived from the original on 2015-04-02.
- ^ Kuperus, Klaas (2015-03-06). "HP 50g not so good news?". Moravia. Retrieved 2016-01-01.
- ^ Wessman, Timothy James (2015-12-26). "Windows 10 won't allow HP 50g USB drivers to be installed". HP Museum. Retrieved 2016-01-01.
- ^ Wickes, William C. (1988). "RPL: A Mathematical Control Language". In Forsely, Lawrence P. (ed.). 1988 Rochester Forth Conference Programming Environments, June 14-18, University of Rochester. Institute for Applied Forth Research, Inc. pp. 27–32. ISBN 9780914593089. OCLC 839704944.
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 with the functional approach of 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.
- ^ Wickes, William C. (1991-03-11). "RPL stands for Reverse Polish Lisp". www.hpcalc.org. Retrieved 2015-09-12.
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 and Lisp.
RPL was never particularly intended to be a public term; at the time of the HP Journal article (August 1987) on the 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. - ^ Schoorl, André (2000-04-04) [1997]. "HP48 Frequently Asked Questions List". HP Calculator Archive. p. 69. Retrieved 2015-09-12.
- ^ "I've heard the names RPL, Saturn, STAR, GL etc... What are they? - RPL". FAQ: 2 of 4 - Hardware, Programs, and Programming. 4.62. comp.sys.hp48. 2000-04-14. 8.1. Retrieved 2015-09-12.
- ^ Nelson, Richard J. (2012-04-04). "HP RPN Evolves" (PDF). HP Solve. Hewlett-Packard (27): 30–32. Retrieved 2015-09-12.
- ^ a b Mier-Jedrzejowicz, Włodek A. C. (July 1991). A Guide to HP Handheld Calculators and Computers (5 ed.). HHC 2011. ISBN 978-1888840308. 1888840307.
RPL stands for Reverse Polish Lisp - it combined the RPN calculator language of earlier models with features of the Lisp and Forth programming languages. For a time HP explained the letters RPL as an acronym for "ROM-based Procedural Language".
- ^ "HP Celebrates 35 Years of Handheld Calculator Innovation". Hewlett-Packard Development Company, L.P. 2007. Archived from the original on 2007-03-17. Retrieved 2015-09-13.
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 and Forth, HP came up with a language called RPL (or ROM-based Procedural Language).
- ^ Rechlin, Eric; Marangon, Carlos. "HPedia: The HP Calculator Encyclopedia". www.hpcalc.org. Retrieved 2020-04-20.
추가 정보
- HP 48G Series – User's Guide (UG) (8th ed.). Hewlett-Packard. December 1994 [1993]. HP 00048-90126, (00048-90104). Archived from the original on 2016-08-06. Retrieved 2015-09-06. [2]
- HP 48G Series – Advanced User's Reference Manual (AUR) (4th ed.). Hewlett-Packard. December 1994 [1993]. HP 00048-90136, 0-88698-01574-2. Archived from the original on 2016-08-06. Retrieved 2015-09-06. [3]
- HP 50g graphing calculator user's guide (UG) (1 ed.). Hewlett-Packard. April 2006. HP F2229AA-90006. Retrieved 2015-09-06.
- HP 50g / 49g+ / 48gII graphing calculator advanced user's reference manual (AUR) (2 ed.). Hewlett-Packard. 2009-07-14 [2005]. HP F2228-90010. Retrieved 2015-09-06.
- Kalinowski, Eduardo de Mattos; Dominik, Carsten (2002-04-24) [1998-07-12]. Programming in System RPL (PDF) (2 ed.). Archived (PDF) from the original on 2016-01-14. Retrieved 2016-08-16. (구 버전 : [4])
- Donnelly, James (2009-03-01). Rechlin, Eric (ed.). An Introduction to HP 48 System RPL and Assembly Language Programming. Retrieved 2015-09-07.
외부 링크
- Rechlin, Eric (2015) [1997]. "HP 49/50 Programming Documentation Files". HP Calculator Archive. Retrieved 2015-09-12.
- Rechlin, Eric (2015) [1997]. "HP 48 Programming Documentation Files". HP Calculator Archive. Retrieved 2015-09-12.
- Hicks, David G. (2013) [1995]. "RPL". The Museum of HP Calculators (MoHPC). Retrieved 2015-09-12.
- Bertrand, Joël (2015) [2009]. "RPL/2 - a new Reverse Polish Lisp". Retrieved 2015-09-12. (GPL 라이선스의 RPL 클론)
- Lapilli, Claudio Daniel (2014-01-03). "newRPL". Retrieved 2015-09-12. [5] (HP 50g 및 HP 49g+ 및 HP 40gs, HP 39gs 및 HP 39g+용 오픈 소스 RPL 파생 모델)
- Rubet, Louis (2017-07-01). "rpn - opensource implementation of RPL". GitHub. Retrieved 2015-09-12. (임의의 정밀도로 RPL 오픈소스 구현)
- Suárez, Alvaro Gerardo (2018-05-01). "MyRPL - Union between HP41 and HP48 languages". Retrieved 2018-05-04. (RPL(HP48)과 FOCAL(HP41) 언어 혼재)