Metadata-Version: 2.4
Name: pratt-calc
Version: 0.1.3
Summary: Arithmetic calculator which uses a Pratt parser
Author: Brandon C. Irizarry
Author-email: Brandon C. Irizarry <brandon.irizarry@gmail.com>
License-Expression: GPL-3.0-or-later
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Dist: more-itertools>=10.8.0
Requires-Python: >=3.13
Project-URL: Homepage, https://github.com/BrandonIrizarry/pratt_calc
Description-Content-Type: text/markdown

# Introduction

An arithmetic expression calculator in Python, demoing the Pratt
parsing algorithm.

This takes inspiration from [this 2010 blog
post](https://eli.thegreenplace.net/2010/01/02/top-down-operator-precedence-parsing)
by Eli Bendersky, as well as a few other sources:

1. [Simple but Powerful Pratt Parsing](https://matklad.github.io/2020/04/13/simple-but-powerful-pratt-parsing.html)
2. [Pratt Parsers: Expression Parsing Made Easy](https://journal.stuffwithstuff.com/2011/03/19/pratt-parsers-expression-parsing-made-easy/)
3. [Compiling Expressions (Chapter 17 of Crafting Interpreters)](https://craftinginterpreters.com/compiling-expressions.html)

# Requirements

Requires Python 3.13 or greater.

# Installation

`pipx install pratt-calc`

In some cases it may be necessary to specify the Python version
manually:

`PIPX_DEFAULT_PYTHON=python3.13 pipx install pratt-calc`

Or, if you have `uv` installed:

`uvx pipx install pratt-calc`

# Contributing

Install `uv`, then run:

```bash
git clone https://github.com/BrandonIrizarry/pratt-calc
cd pratt-calc
uv sync --locked
```

# Usage

`pratt-calc $EXPRESSION`

Example: 

`pratt-calc 3-4*5`

This should print `-17` at the console.



