Skip to main content

Paramath v3 compiler

Project description

The Paramath Programming Language, ver 3.

Paramath is a Domain-Specific Language (DSL) that transforms procedural math code into mathematical expressions. Paramath compiles into math expressions with operations commonly found on standard scientific calculators, allowing evaluation of logical code on mathematical hardware.

All this, powered by Python.

Why the name "Paramath"?
The word "paramath" comes from the portmanteau of "parenthesis" and "mathematics".

Features

  • Infix + prefix syntax: Arithmetic and comparators are infix; other operations are function-style prefix calls
  • Automatic optimization: Simplification and duplicate subexpression extraction
  • Loop unrolling: Compile-time iteration for performance
  • Flexible output: Display and/or write compiled expressions to files

Documentation

Installation

Method 1 (PyPI)

Generic PyPI install (virtual environment)

python -m venv .venv
source .venv/bin/activate
pip install paramath3

Run the compiler:

paramath3 --version

Recommended on Arch Linux: use pipx

Arch enforces Python's externally managed environment (PEP 668), so global pip install may fail. Use pipx instead:

sudo pacman -S --needed python-pipx
pipx ensurepath

Restart your shell, then install Paramath:

pipx install paramath3[full]

To install without optional dependencies:

pipx install paramath3

To add optional dependencies to an existing pipx installation:

pipx inject paramath3 sympy tqdm

Method 2 (Direct Git Clone)

Clone the repository:

git clone https://github.com/kaemori/paramath3.git
cd paramath3

Run directly from source:

python cli.py --version

Install as a local package (recommended):

pip install -e .
paramath3 --version

Optional dependencies:

pip install -e .[full]

Usage

The compiler can be run with:

python cli.py [-h] [-V] [-o FILE] [-d] [-v] [-s] [-S] [-O] [-m] [-t] [-L FILE] [-p] [--no-color] [filepath]

Options:

  • filepath input Paramath file
  • -h, --help show help and exit
  • -V, --version print Paramath version and exit
  • -o, --output FILE output file (default: math.txt)
  • -d, --debug enable debug output
  • -v, --verbose enable verbose output
  • -s, --suppress suppress non-error output
  • -S, --silent suppress all output
  • -O, --print-output print compiled output
  • -m, --math-output format output for calculators (^, implicit multiplication, ANS)
  • -t, --trust allow compile-time Python eval (:=)
  • -L, --logfile FILE write logs to file
  • -p, --progress show parsing/processing progress bars
  • --no-color disable colored CLI output

Testing

Test layout:

  • paramath_test/ contains .pm3 fixture programs
  • tests/ contains Python test modules (.py)

Run the Paramath v3 suite:

python -m unittest tests/pm_test_suite.py -v

License

This project is licensed under the MIT License.

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

paramath3-3.2.5.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

paramath3-3.2.5-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file paramath3-3.2.5.tar.gz.

File metadata

  • Download URL: paramath3-3.2.5.tar.gz
  • Upload date:
  • Size: 21.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for paramath3-3.2.5.tar.gz
Algorithm Hash digest
SHA256 e3b911d5812942c4daeacca2ad0126bcc4da3f83fac3b30e03d1c17d07b499ca
MD5 6d4042a986beef315ded82753487e8d3
BLAKE2b-256 dc977fc5948bdba63b9c94eb261075d244ede60317ca849559bbdb463475ca43

See more details on using hashes here.

File details

Details for the file paramath3-3.2.5-py3-none-any.whl.

File metadata

  • Download URL: paramath3-3.2.5-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for paramath3-3.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a599f59030d4a7814ac427c0f1ca7f2a90f43fb339c81a0518d9aafd9308b592
MD5 99af7f4c672b7d9e24c26b708a46f797
BLAKE2b-256 2f6201811fc20d625dda3a67784b98c92b81572858cac0f331e08ee4150ff284

See more details on using hashes here.

Supported by

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