Skip to main content

Mini language modeled after a calculator

Project description

Calc Interpreter

Python package Python Version

A mini-language modeled after a calculator implemented in Python 3. The program currently only lexes basic mathematical expressions. It supports infix (using Shunting Yard Algorithm) and postfix (Reverse Polish Notation).

Usage

The best way to run the program currently is to execute the REPL and can be done in a python file or through your terminal.

Assuming your present working directory is inside the cloned repo, you can run the following command without the comment.

# inside /clone_path/expr_calc/
python -m expr_calc

Enabling postfix expression mode is also possible. Using infix expressions in postfix mode is currently undefined and so is using postfix expressions in infix mode.

python -m expr_calc --postfix

Features

  • Infix expressions
  • Postfix expressions
  • Basic operators such as +, -, *, /, %, ^
  • Tokens created from an expression can also be fetched if one wanted to do so

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

expr_calc-0.1.1.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

expr_calc-0.1.1-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

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