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.
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.
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.
๐, ๐ง, ๐ฅ, 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.
๐ (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 ๐.
๐ฅญ (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).
๐ (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.
๐ฃ is the printing function. It prints the value of the register following it.
๐ is the input function. It prompts the user to input any piece of data and stores it in the register following it.
๐ 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.