Skip to main content

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 if statements with perchance
  • Replace elif statements with or perchance
  • Replace else statements with certainly
  • Execute .pyp scripts directly using the perchance command

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

perchance_dsl-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

perchance_dsl-0.1.1-py2.py3-none-any.whl (4.8 kB view details)

Uploaded Python 2Python 3

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

Hashes for perchance_dsl-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bb04e60321dc035a6b022f414079d094f749310b7348c5420b82eca4ffcdbd20
MD5 0ad00f7c57016d1181a7474577d09d69
BLAKE2b-256 04e12a206b976a06a550f0bc7a2115064c5d2d4e465466962e2e676cfd276582

See more details on using hashes here.

File details

Details for the file perchance_dsl-0.1.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for perchance_dsl-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c6eb39d8389eff0e3f71e40599ac38356ecf4f09a50b2777ecc0b744303e7d76
MD5 6ca27deed06d82c071a405fb9d0b1ff7
BLAKE2b-256 cfd5212b4f983e4382d53a4b810e64363e8ace0caac507a545ccfdffb6532b9e

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