Contribution
This is my first time having a public repo on github so I'm not sure on how to go on about this. If anyone would like to contribute they are free to open issue, where i will discuss it with them.
Contribution Suggestions
Features on the features to add list, ones you think are missing and think should be there, etc. are all welcome.
Adding a issue for the feature fist, where things could be decided whether the feature is add-able to the language or interpreter, would be appreciated though.
Monkey
Peelpreter is a interpreter based on the language Monkey specified in the book Writing an Interpreter in Go.
It is not designed to be the fastest implementation but instead a (mostly) readable one.
I, personally don't find encapsulating every little function of a program in classes to be particularly readable.
Hence, I have kept things bare-bone functions where I thought it made sense and used classes to encapsulate data like C-Structs
and sometimes to store methods.
Features
Peelpreter supports all features of the canon implementation as well as some more. They are:-
- Variables
- If expressions
- First-Class Functions
- Loops. Eg:
whileandforeach - Closures
- Array
- Hash Map (Dictionary)
- Builtin Functions
- Array and Hash mutability
- Improved
putsfunction
Features Planned to be added
Some features which I wish for in a programming language are not present yet in this.
Suppport for them will be slowly added as soon as type annotations are improved for the existing code base.
They are:-
- Input function
- Type conversion
- While Loops
- For Loops
- Constants
- Add New Keyword
list. This would cause loops to return an array of the results of the last expressions of each iteration of the loop instead of returning the result of the last expression of the last iteration of the loop. - Add New Keyword To Make Objects Immutable
- Optional Parameters
- Structs
- Chaining variable assignments. E.g,
let x = y = 7 - Import System
- Extension modules using Python
I might also added a Type Checker later on, but thats upto the future.
Changelog
- 1.6.0: Added
input,numandstr. - 1.6.1: Fixed a bug which caused the interpreter to crash when a number was divided by zero
- 1.6.2: Fixed a bug with
strwhich caused it to add double quotes (") around aStringobject each time it was called on it - 1.7.0: Added
whileloops - 1.7.1: Fixed crash from missing a
=inletstatements - 1.7.2: Added
foreachloops - 1.7.3: Fixed unintended behaviour of variables not being modified globally
- 1.7.4: Added new keyword
constfor declaration of constants
Installation
For installation of the package run,
pip install peelpreter
Or if you would prefer to build and install yourself for a more up-to-date version, clone the repository and cd into it,
git clone https://github.com/GogiBoy102/Peelpreter.git
cd Peelpreter
then run,
python3 -m build
If build is not already installed onto the system then install it with,
pip install --upgrade build
After the build process ends, cd into dist and install the tar with,
cd dist
pip install peelpreter-<version>.tar.gz
And, voila! Peelpreter has been installed! For usage, follow the next section.
Usage
Peelpreter comes with a script called monkey which is the entry point for the interpreter and also the reccomended way for it to be used.
Files in monkey usually have the extension ".mon".
monkey, when executed with no command line arguments starts the REPL for Monkey. However, it can also execute files if the path to those files are supplied as a command line argument.
The examples directory can be looked at for example programs writen in Monkey.
monkey (for starting a repl)
monkey /path/to/file (for running a file)
License
Peelpreter is license under the GNU General Public License version 3 or above with it also being copyrighted by Jeebak Samajdwar
Release files for Peelpreter 1.7.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| peelpreter-1.7.4.tar.gz | 29.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Peelpreter-1.7.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 71.2 kB
Release files / peelpreter-1.7.4.tar.gz
| Download URL | peelpreter-1.7.4.tar.gz |
|---|---|
| Size | 29.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5aef8f4d466fde15ec6437395176d1bbc67139b02b0c8c4a57cdf384eb6940d7
|
|
BLAKE2b-256 checksum How to use checksums |
8cd47f92758294248c48d4de48b1890d673741a28dc1a688375c9531a00d1268
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.0
|
Release files / Peelpreter-1.7.4-py3-none-any.whl
| Download URL | Peelpreter-1.7.4-py3-none-any.whl |
|---|---|
| Size | 41.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9cea03a033df4076304faeb86d490e4e1524989ec3c19ed348d98d434b77e7e
|
|
BLAKE2b-256 checksum How to use checksums |
45a7f2788eafe5e2fed49179acfc04d34a6662a51a08e5968c17e0ad6889d860
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.12.0
|