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
- Language reference: paramath_syntax_guide.md
- Developer docs: paramath_docs_developers.md
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:
filepathinput Paramath file-h, --helpshow help and exit-V, --versionprint Paramath version and exit-o, --output FILEoutput file (default:math.txt)-d, --debugenable debug output-v, --verboseenable verbose output-s, --suppresssuppress non-error output-S, --silentsuppress all output-O, --print-outputprint compiled output-m, --math-outputformat output for calculators (^, implicit multiplication,ANS)-t, --trustallow compile-time Python eval (:=)-L, --logfile FILEwrite logs to file-p, --progressshow parsing/processing progress bars--no-colordisable colored CLI output
Testing
Test layout:
paramath_test/contains.pm3fixture programstests/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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3b911d5812942c4daeacca2ad0126bcc4da3f83fac3b30e03d1c17d07b499ca
|
|
| MD5 |
6d4042a986beef315ded82753487e8d3
|
|
| BLAKE2b-256 |
dc977fc5948bdba63b9c94eb261075d244ede60317ca849559bbdb463475ca43
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a599f59030d4a7814ac427c0f1ca7f2a90f43fb339c81a0518d9aafd9308b592
|
|
| MD5 |
99af7f4c672b7d9e24c26b708a46f797
|
|
| BLAKE2b-256 |
2f6201811fc20d625dda3a67784b98c92b81572858cac0f331e08ee4150ff284
|