Python to RPN converter
Posted: Fri Feb 16, 2018 6:30 am
I am pleased to announce the Python to HP42S RPN converter website is online.
http://www.pyrpn.atug.com
You write code in a high level structured language (which happens to be Python 3 syntax), hit a button and RPN is generated.
You then paste the RPN into Free42 or transfer it to your DM42 (by creating a raw) - and it runs.
and targeting the larger screen size of the DM42 - this image:
The purpose of the Python to RPN converter is not to usurp the beauty and role of handcrafted RPN, it is to provide an alternative way of programming the HP42S for those who prefer to to use if statements and for loops etc. rather than GTO's and ISG. The purpose is also to provide powerful new features to make programming the 42S easier: lists, dictionaries, matrix access syntax, native complex number syntax, alpha messages easily built with multiple parameters in one line, simpler menu support using aview() etc.
My hope is that the Python to RPN converter will contribute to keeping this wonderfully designed calculator alive, just as Free42 and the DM42 have done. I look forward to what people build, using the increased ease of use and power of a structured programming language and hope to see some great new programs developed for the DM42.
I hope people like it.
http://www.pyrpn.atug.com
You write code in a high level structured language (which happens to be Python 3 syntax), hit a button and RPN is generated.
You then paste the RPN into Free42 or transfer it to your DM42 (by creating a raw) - and it runs.
- Examples: http://www.pyrpn.atug.com/examples
- User Guide: http://www.pyrpn.atug.com/help
- Canvas for 42S Simulator: http://www.pyrpn.atug.com/canvas
- List of HP42S Commands Supported Reference: http://www.pyrpn.atug.com/cmds
- Variables
- Functions, Multiple functions, nested functions
- Parameter passing, receiving return values, multiple return values
- if elif else
- Comparison operators == != > < >= <=
- Booleans True, False and operators not or and
- for loops, range(), for..in iteration through lists and dictionary keys
- while loops, while...else
- continue and break operations in for loops and while loops
- Lists and Dictionaries (basic operations only).
- Matrices, Pythonic matrix element access syntax [row,col]
- NumPy compatible slicing syntax for sub-matrices
- Complex numbers using either 42S or Python native syntax
- Expressions involving nested brackets
- assert
- Testing and clearing of flags
- Access most HP42S commands as function calls e.g. FIX(2)
- Some enhanced functions to make life easier e.g. varmenu() automates and simplifies the generation of MVAR based code.
and targeting the larger screen size of the DM42 - this image:
The purpose of the Python to RPN converter is not to usurp the beauty and role of handcrafted RPN, it is to provide an alternative way of programming the HP42S for those who prefer to to use if statements and for loops etc. rather than GTO's and ISG. The purpose is also to provide powerful new features to make programming the 42S easier: lists, dictionaries, matrix access syntax, native complex number syntax, alpha messages easily built with multiple parameters in one line, simpler menu support using aview() etc.
My hope is that the Python to RPN converter will contribute to keeping this wonderfully designed calculator alive, just as Free42 and the DM42 have done. I look forward to what people build, using the increased ease of use and power of a structured programming language and hope to see some great new programs developed for the DM42.
I hope people like it.