____ ____ __ _ _ __ __ ____ ____ __ __ ____ ____ ____ ____
( _ \( ___) /__\ ( \( )( )( )(_ _) ( _ \( )( )(_ _)(_ _)( ___)( _ \
)___/ )__) /(__)\ ) ( )(__)( )( ) _ < )(__)( )( )( )__) ) /
(__) (____)(__)(__)(_)\_)(______) (__) (____/(______) (__) (__) (____)(_)\_)
ASCII art was created with the help of patorjk.com
A C++ implementation of the prestigious Peanut Butter Programming Language.
Report Bug
·
Request Feature
Table of Contents
Peanut Butter is my attempt at a dynamically-typed, imperative programming language. It's about as simple as it can get but is also a neat little tool to play around with. It compiles source files into its own bytecode which then runs on a interpreter. Peanut Butter has a syntax like Python, but a compilation process like Java.
It's not going to compete with any professional programming langauge or make its way into any development workflows, but it has some interesting ideas that will keep you busy for a little while.
To get Peanut Butter up and running, follow these simple steps shown below.
For starters, you will need to download some dependencies.
- CMake, Version 3.27+. You can probably get away with a different version, just be sure to change the first line of
CMakeLists.txt
. - Visual Studio
-
Clone the repo
git clone https://github.com/PeanutButterRat/peanut-butter.git
-
Run the build script
cd peanut-butter # You should now be in the repo directory. ./build.sh # Build the project.
-
Once compiled, you can run the automated tests
./tests.sh
To use Peanut Butter, create a file with a .pb
extension with the code you want compiled in it.
touch hello_world.pb
echo 'print "Hello, World!".' > hello_world.pb # A simple "Hello, World!" application.
Compile the program with cpbpl
.
./bin/cpbpl hello_world.pb # Assuming you are in base directory for the repo.
Execute the compiled program with pbpl
.
./bin/pbpl hello_world.nut # Notice the file extension change.
For a more in-depth guide on how to use the language, check out the wiki.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with and present your idea there. I don't forsee anyone feeling inspired enough to contribute, but any contributions are greatly appreciated if you do decide to do so!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.
Eric Brown - GitHub - ebrown5676@gmail.com
Project Link: https://github.com/PeanutButterRat/peanut-butter
The only major resource used in this project was the knowledge found in Crafting Interpreters by Robert Nystrom. The book is very well written, and got me hooked on language design. Peanut Butter is largely its own creation and doesn't follow the source code given in the book but rather it relies on the theory presented by the author for implementing a language.
You can find more it on the author's website at https://craftinginterpreters.com/.