PXPR (Parse eXPRession) is a fast arithmetic and boolean expression parser written in Rust, supporting arithmetic operations such as addition, subtraction, multiplication, division, modulo, expressions with nested parentheses, as well as C-style boolean expressions such as the logical not, and, or operators and the logical implication operator. PXPR can be evaluate expressions directly from the command line or via the PXPR REPL.
The goal of PXPR is to provide an easy-to-use, but feature rich command line calculator. Rather than opening up a calculator application and manually clicking buttons or starting up an IDE or text-editor, writing some code, compiling that code, and running it all to get the value of a basic expression, PXPR can evaluate the expression directly from the command line.
pxpr "3 - (2 + 5) + 2"
Which outputs:
= -2
pxpr
Which will initialize the REPL:
expr > 3 - (2 + 5) + 2
= -2
pxpr "!false || true"
or it's equivalent:
pxpr "false => true"
both of which output:
= true
To install PXPR, clone this repository:
git clone https://github.com/brayner05/pxpr.git
Once the PXPR repository has been cloned, switch to the repository directory and run the installation script:
cd pxpr
chmod +x ./install.sh
./install.sh
If no errors occurred, then PXPR is now installed on your machine.
Currently PXPR does not have an installation script for Windows, but can still be installed quite easily:
cd pxpr
cargo build --release
cargo install