Skip to main content

Command line reverse polish notation (RPN) calculator.

Project description

pyclacker

Command line reverse polish notation (RPN) calculator. Stack based and ready to party.

Josh Tompkin

jtompkin-dev@pm.me

https://github.com/jtompkin/pyclacker

Installation

Install with pip

pip3 install pyclacker

Usage

pyclacker [-h] [-v] [-w WORDS_FILE] [program]

If provided, program should be a single string with commands separated by a space. Running without providing a program will enter interactive mode. In interactive mode, type a number and press enter to push to the stack. Enter an operator and press enter to perform the operation on the stack. Enter multiple commands separated by a space and press enter to execute them in order. Enter help to view available operators.

Words

Custom commands (called words) can be defined in interactive mode or in a file. To define words in a file, provide one word definition on each line. A word definition consists of the word itself and its definition, all separated by spaces. Provide the path to this file when calling the program with -w. A file containing the following two lines would define two words: sqrt, which pushes 0.5 to the stack and then calls the exponent operator, and pi, which pushes the value of pi to the stack

sqrt 0.5 ^
pi 3.14159265358979323846

To define words in interactive mode, start your command with =, followed by a space, followed by the word itself, followed by the word definition, again all separated by spaces. The following commands would accomplish the same word definitions as the file above. (The > is not typed)

  > = sqrt 0.5 ^
  > = pi 3.14159265358979323846

You can undefine a word by providing its name without any definition. All currently defined words can be viewed by entering words at the interactive prompt.

  > = sqrt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyclacker-1.1.1.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

pyclacker-1.1.1-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file pyclacker-1.1.1.tar.gz.

File metadata

  • Download URL: pyclacker-1.1.1.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for pyclacker-1.1.1.tar.gz
Algorithm Hash digest
SHA256 3728e9c463140dc345410f26185c52cb35ffaf1c4cc0e01e2d0a378f6802e804
MD5 99756e58bd9d0904345e4f514414d61a
BLAKE2b-256 5a50f8e89d54eb9ddd32d7bbdde40f40bc6f86040f77db8a494bcc8fb51e80b0

See more details on using hashes here.

File details

Details for the file pyclacker-1.1.1-py3-none-any.whl.

File metadata

  • Download URL: pyclacker-1.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.19

File hashes

Hashes for pyclacker-1.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9c33e750e4968129842d3eeb3fbdc281a3b1bf875d7823bcec9aa799d6b3f2cb
MD5 33dd2d3de177d36a983c5eb6ecd4036d
BLAKE2b-256 d16da4bbc9b66f9202c2d5b3d17b8cb8405f2c8a3a6be32bbc02f56bba4a5a42

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page