Skip to content

Latest commit

 

History

History
77 lines (64 loc) · 2 KB

File metadata and controls

77 lines (64 loc) · 2 KB

💻 🧮 = PXPR - Expression Parser = 🧮 💻

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.

Sections

What is the goal of PXPR?

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.

How to use PXPR

Compute an expression via the CLI

pxpr "3 - (2 + 5) + 2"

Which outputs:

    = -2

Compute an expression via the REPL

pxpr

Which will initialize the REPL:

expr > 3 - (2 + 5) + 2
        = -2

Compute a boolean expression

pxpr "!false || true"

or it's equivalent:

pxpr "false => true"

both of which output:

    = true

Installation

To install PXPR, clone this repository:

git clone https://github.com/brayner05/pxpr.git

Installing PXPR on

Linux

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.

Windows

Currently PXPR does not have an installation script for Windows, but can still be installed quite easily:

cd pxpr
cargo build --release
cargo install