Skip to content

PeanutButterRat/peanut-butter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT License LinkedIn



 ____  ____    __    _  _  __  __  ____    ____  __  __  ____  ____  ____  ____ 
(  _ \( ___)  /__\  ( \( )(  )(  )(_  _)  (  _ \(  )(  )(_  _)(_  _)( ___)(  _ \
 )___/ )__)  /(__)\  )  (  )(__)(   )(     ) _ < )(__)(   )(    )(   )__)  )   /
(__)  (____)(__)(__)(_)\_)(______) (__)   (____/(______) (__)  (__) (____)(_)\_)


ASCII art was created with the help of patorjk.com


Peanut Butter

A C++ implementation of the prestigious Peanut Butter Programming Language.

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact
  7. Acknowledgments

About The Project

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.

(back to top)

Getting Started

To get Peanut Butter up and running, follow these simple steps shown below.

Prerequisites

For starters, you will need to download some dependencies.

  1. CMake, Version 3.27+. You can probably get away with a different version, just be sure to change the first line of CMakeLists.txt.
  2. Visual Studio

Installation

  1. Clone the repo

    git clone https://github.com/PeanutButterRat/peanut-butter.git
  2. Run the build script

    cd peanut-butter  # You should now be in the repo directory.
    ./build.sh  # Build the project.
  3. Once compiled, you can run the automated tests

    ./tests.sh

(back to top)

Usage

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.

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Eric Brown - GitHub - ebrown5676@gmail.com

Project Link: https://github.com/PeanutButterRat/peanut-butter

(back to top)

Acknowledgments

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/.

(back to top)