Code Monkey home page Code Monkey logo

coconut's Introduction

Coconut

Background

This project was created for Auburn Hacks 2023 with Jung Hoon Park and Tien Bui. The original repository has been made private due to an email leak, but has been reuploaded here.

Installation

First, make sure you have Python 3 installed, then clone the repository locally. If you don't know what that means, click the green "<>Code" button near the top of this page, click "Download ZIP", then extract the ZIP file anywhere you'd like.

Usage

First, make sure Python 3 is in your PATH. If you don't know what that is or how to do it, there's a handy guide here.

Next, open your terminal or command prompt in the directory you cloned in the Installation step.

To run the interpreter, type:

python coconut.py file_name_here.cn

There's also a demo text-based game, island.cn, included with the Coconut interpreter. Feel free to look over it to better understand Coconut's syntax.

Syntax

The Registers

๐ŸŒ, ๐Ÿงƒ, ๐Ÿฅ‘, and ๐Ÿฉณ are the register emojis. To store a value in a register, call one of the emojis followed by the value you wish to store. For example:

๐ŸŒ'War Eagle!'

The above code stores the string "War Eagle!" into register ๐ŸŒ. Operators in Coconut only accept registers; all data must be placed in a register before it can be operated on.

Arithmetic Operators

๐Ÿ‡ (addition), ๐Ÿ“ (subtraction), ๐ŸŠ (multiplication), and ๐Ÿ’ (division) are the arithmetic operator emojis. Each of them evaluate and operate on the two registers declared after them, and store them in the third register declared. For example:

๐ŸŒ3
๐Ÿฅ‘2
๐Ÿ“๐ŸŒ๐Ÿฅ‘๐ŸŒ

Reads the values stored in ๐ŸŒ and ๐Ÿฅ‘, subtracts the value stored in ๐Ÿฅ‘ from the one in ๐ŸŒ, and stores the output (1) in ๐ŸŒ.

Logical Operators

๐Ÿฅญ (AND), ๐Ÿน (OR), and ๐Ÿ (NOT) are the logical operators. Most accept two registers with true/false values, perform their respective operations, and store the output in the third register. ๐Ÿ is special, it accepts one register as argument, and inverts it (true=false and false=true).

Comparative Operators

๐Ÿˆ (is-equal), ๐Ÿคฟ (greater-than), and ๐Ÿ (less-than) are all comparative operators. They function identically to logical operators, but they accept two non-true/false inputs and give a true/false output.

Print

๐ŸŽฃ is the printing function. It prints the value of the register following it.

Input

๐ŸŒˆ is the input function. It prompts the user to input any piece of data and stores it in the register following it.

Control Structures

๐Ÿ‰ is the if-statement keyword. ๐Ÿ‰ evaluates the register after it for a true/false value. If it's false, it skips lines until it reaches a ๐Ÿ‰ with no register after it.

๐ŸŒธ is the go-to keyword. ๐ŸŒธ skips to the line number stored in the register after it.

License

MIT

coconut's People

Contributors

jaiden6 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.