README.md
WhyPY
In a universe of infinite programming languages, we dared to ask... Why not one more?
Why WhyPY? Why Not?
In the grand tradition of asking existential questions that nobody needed answers to, we present WhyPY - a programming language that questions its own existence. When Python feels too pythonic and Brainfuck too mainstream, WhyPY offers a mystical journey into the realm of computation.
Is it:
- A programming language? Perhaps.
- An existential crisis? Definitely.
- A way to make simple things unnecessarily mystical? Absolutely!
Visit the website for detailed documentation and to try the live interpreter: why-py.vercel.app
Table of Contents
Installation
# Clone the repository of mystical knowledge
git clone https://github.com/sambuaneesh/why-py.git
# Enter the sacred chamber
cd why-py
# Start your mystical journey
make run
Quick Start
Starting the Mystical REPL
To begin your journey into the mystical realm, simply run:
make run
This will start the WhyPY REPL (Read-Eval-Ponder-Loop), where you can experiment with the language interactively.
Your First Incantation
Try these mystical commands in the REPL:
>> manifest greeting with "Greetings, seeker of truth" seal
>> manifest sayHello with rune(name) unfold
.. manifest message with greeting augments name seal
.. yield message seal
.. fold seal
>> sayHello("mystic one") seal
"Greetings, seeker of truth mystic one"
Basic Arithmetic Rituals
>> manifest x with 5 seal
>> manifest y with 10 seal
>> x augments y seal
15
>> x conjoins y seal
50
Truth Values
>> manifest isWise with verity seal
>> whence (isWise) unfold
.. yield "You have achieved enlightenment" seal
.. fold seal
"You have achieved enlightenment"
For more examples and detailed explanations, visit our website.
The Mystical Theme
WhyPY reimagines programming as a series of mystical rituals. Traditional programming concepts are transformed into arcane ceremonies:
- Variables become "manifestations"
- Functions become "rituals"
- Parameters are bound by "knots"
- Code blocks "unfold" and "fold"
- Statements are sealed with mystical energy
- Errors are "mishaps" in the cosmic flow
For a complete guide to our esoteric semantics, see docs/semantics.md.
Features
- Tree-walking interpreter with mystical flair
- First-class rituals (functions)
- Proper closure support
- Vaughan Pratt parsing for elegant expression handling
- Comprehensive mishap (error) handling
- Dynamic typing with a mystical twist
- Interactive REPL for experimentation
Implementation
WhyPY is implemented in Python, chosen for its:
- Automatic memory management (because managing memory manually would disturb our chakras)
- Rich standard library (more time for meditation, less for reinventing wheels)
- Accessibility for collaboration (we considered Lisp but didn't want to curse our collaborators)
For implementation details, see docs/implementation.md.
References and Inspirations
This mystical journey was inspired by several sacred texts:
Core References
-
"Writing an Interpreter in Go" by Thorsten Ball
- Core interpreter implementation concepts
- Pratt parsing techniques
- Evaluation strategies
-
"Essentials of Programming Languages (3rd Edition)"
- Language design principles
- Semantic foundations
- Type systems
-
"Structure and Interpretation of Computer Programs"
- Metacircular evaluator concepts
- Environment model
- Closure implementation
Course Project
This interpreter was developed as a course project for "Principles of Programming Languages" under the guidance of Prof. Venkatesh Choppella at IIIT Hyderabad.
Course Website: POPL Course
Contributing
Haven't really thought about it, just fork it and do whatever you want.
Remember: In a world of practical programming languages, sometimes the real question is "Why not?"
