A DSL for replacing if-else statements with a more readable syntax
Project description
perchance-dsl
Ever read Python if-elif-else blocks and thought, hmm too simple? perchance-dsl is a Python-based domain-specific language (DSL) that provides a more readable syntax for conditional statements, replacing traditional if-elif-else blocks.
Features
- Replace
ifstatements withperchance - Replace
elifstatements withor perchance - Replace
elsestatements withcertainly - Execute
.pypscripts directly using theperchancecommand
Installation
Install Perchance DSL via pip:
pip install perchance-dsl
Usage
Writing a .pyp Script
Create a file, e.g., example.pyp, and write:
x = 5
perchance x > 0:
print("x is positive")
or perchance x == 0:
print("x is zero")
certainly:
print("x is negative")
Running a .pyp Script
Run the script using:
perchance example.pyp
Contributing
Feel free to open issues or contribute via pull requests on GitHub.
License
This project is licensed under the MIT License.
Project details
Release history Release notifications | RSS feed
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 perchance_dsl-0.1.1.tar.gz.
File metadata
- Download URL: perchance_dsl-0.1.1.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb04e60321dc035a6b022f414079d094f749310b7348c5420b82eca4ffcdbd20
|
|
| MD5 |
0ad00f7c57016d1181a7474577d09d69
|
|
| BLAKE2b-256 |
04e12a206b976a06a550f0bc7a2115064c5d2d4e465466962e2e676cfd276582
|
File details
Details for the file perchance_dsl-0.1.1-py2.py3-none-any.whl.
File metadata
- Download URL: perchance_dsl-0.1.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c6eb39d8389eff0e3f71e40599ac38356ecf4f09a50b2777ecc0b744303e7d76
|
|
| MD5 |
6ca27deed06d82c071a405fb9d0b1ff7
|
|
| BLAKE2b-256 |
cfd5212b4f983e4382d53a4b810e64363e8ace0caac507a545ccfdffb6532b9e
|