A programming language that only uses emojis as syntax.
Project description
spamoji
A programming language that only uses emojis as syntax and encourages writing spaghetti code.
Example
🗒️ A function to calculate factorial
⚙️ 🔢❕🫸🔰🫷
👋 🏁 🫴 1
🔃 🔰 🤜 1
🏁 🫴 🏁 ✖️ 🔰
🔰 🫴 🔰 ➖ 1
↩️ 🏁
💭🫸🔤Enter a number to calculate the factorial: 🔤🫷
👋 😀 🫴 🔢🫸⌨️❗🫷
🤔 😀 🟰 ⚠️
👍
💬🫸🔤Invalid input.🔤🫷
👎
💬🫸🔤The factorial of 🔤😀🔤 is 🔤🫸🔢❕🫸😀🫷🫷🫷
What's this all about?
This language is a learning project. Since it lacks many features of a typical programming language, it is not recommended for production use. If this experiment is successful, I might move on and begin working on Esore, a more serious language I've been designing in the past 2 years.
Installation
To install the spamoji interpreter, you will need to have Python 3.10 or higher installed on your machine. You can download Python from the official website.
Once you have Python installed, you can install the spamoji interpreter using pip:
pip install spamoji
Usage
To run a spamoji program, you will need to use the spamoji interpreter.
You can provide a spamoji file (with the .🍝 extension) as input to run it. For example:
spamoji my_program.🍝
If no file is supplied, the interactive REPL will start, which allows to enter and evaluate expressions directly.
If the above command doesn't work, you can also run the interpreter using Python's -m flag:
python -m spamoji my_program.🍝
Syntax
[!IMPORTANT] The emojis used in the syntax were entered on a Windows machine. While they should work on other platforms, some emojis might not render correctly or might be replaced with different emojis. If you encounter any issues, please try copying and pasting the emojis from this documentation into your code.
Statements
Each line of code starts with an emoji that indicates the type of statement. Each statement is followed by the relevant information, separated by spaces. Statements include:
- 🗒️ Comment: Text in this line will be ignored
- 👋 Variable declaration: Followed by the variable assignment
- 🤔 If statement: Followed by the condition
- 👍 If true block
- 👎 Else block
- 🔃 Loop: Followed by the loop variable and condition
- ⛔ Break statement: Used to exit the loop
- ⤴️ Continue statement: Used to skip to the next iteration of the loop
- ⚙️ Function definition: Followed by the function name and parameters
- ↩️ Return statement: Followed by the value to return
Some statements can be nested, such as if statements and loops. Indentation is used to indicate the scope of these statements. Indented blocks are considered part of the previous statement until the indentation level decreases. Variables declared inside of a block are only accessible inside of that block and any nested blocks.
Functions
Functions are defined using the ⚙️ emoji, followed by the function name and parameters. The function body is indented and can contain any valid statements. The function can return a value using the ↩️ emoji.
Functions can be called by using their name followed by the arguments, separated by 🔸, between 🫸 and 🫷. Functions with no arguments can also be called with the ❗ emoji.
Here's an example of a function definition and call:
⚙️ greetAndAsk 🫸firstName 🔸 lastName🫷
💬🫸🔤Hello, 🔤firstName🔤 🔤lastName🔤! Please enter a number...🔤🫷
↩️ ⌨️❗ 🗒️ Return the user input
greetAndAsk🫸🔤John🔤 🔸 🔤Doe🔤🫷
Variables
Variables are declared using the 👋 emoji, followed by the variable assignment expression. An assinment expression starts with the variable name, followed by 🫴 and a value. Variable names can be any combination of letters, numbers, and emojis, but must start with a letter or emoji. Variables can be used in expressions and statements after they have been assigned.
Expressions
Many statements can be used as expressions within other statements. 🫸 and 🫷 can be used to group expressions and control the order of evaluation. For example, you can use a function call as part of an if statement condition or as part of a variable assignment.
Operators
The language supports basic operators for logical and arithmetic operations. These can be used between two values to perform calculations.
- ➕: Addition
- ➖: Subtraction
- ✖️: Multiplication
- ➗: Division
- 🟰: Equal
- 🆚: Not equal
- 🤜: Greater than
- 🤛: Less than
- 🤝: Logical AND
- 🤲: Logical OR
- 🙅: Logical NOT
Strings
Strings are sequences of characters enclosed in 🔤 on each side. They can contain any characters, including emojis. Strings can be used in variable assignments, printed to the console, and concatenated using the ➕ operator.
Values directly before or after a string will also be concatenated with that string.
Built-ins
The language includes several built-in functions and values for common operations, such as:
- 💬: Print output to a new line in the console
- 💭: Print output to the console
- ⌨️: Get user input from the console
- ⏳: Wait for a specified number of seconds
- 🔢: Convert input to a number, return ⚠️ if the conversion fails
- 🎲: Get a random integer between 2 numbers
- 🛑: Stop the program
- ✅: A special value representing true
- ❌: A special value representing false
- 🫥: A special value representing null
- ⚠️: A special value representing an error or undefined value
- 🐍: Evaluate a Python expression
Credits
Thanks to Robert Nystrom for his book "Crafting Interpreters" which inspired the design of this language and provided guidance on how to implement it.
Also thanks to Hack Club for providing a supportive community and motivating me to work on this project.
This documentation was entirely written by hand. AI tools were used for assistance while writing the interpreter.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spamoji-0.1.1.tar.gz.
File metadata
- Download URL: spamoji-0.1.1.tar.gz
- Upload date:
- Size: 18.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab062c5efda191b298df24ca7ffdf8247f4fac09d9aa308571ad81aa5c1df4ae
|
|
| MD5 |
19e182db1687897d0a51d3f8415f4427
|
|
| BLAKE2b-256 |
6f8e0bb26a3e3e7ae1ce7ff8fd41d0f43672a6127f970c3158ab70a6aa25bfcc
|
Provenance
The following attestation bundles were made for spamoji-0.1.1.tar.gz:
Publisher:
publish.yml on iqnite/spamoji
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spamoji-0.1.1.tar.gz -
Subject digest:
ab062c5efda191b298df24ca7ffdf8247f4fac09d9aa308571ad81aa5c1df4ae - Sigstore transparency entry: 1601880535
- Sigstore integration time:
-
Permalink:
iqnite/spamoji@b55602003cf4360b7e6dbca681d6c2f91bbd497c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/iqnite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b55602003cf4360b7e6dbca681d6c2f91bbd497c -
Trigger Event:
push
-
Statement type:
File details
Details for the file spamoji-0.1.1-py3-none-any.whl.
File metadata
- Download URL: spamoji-0.1.1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
abbd775835e6823054305ebdcf1351359f11f63682dfcb9fc695335766d23de1
|
|
| MD5 |
f0c76bd7353511e50f95fab00b0abbb3
|
|
| BLAKE2b-256 |
1eaf9ca650fadc7e1033d05d9d93136bc0de341f2089e2351b20fdf2c890f162
|
Provenance
The following attestation bundles were made for spamoji-0.1.1-py3-none-any.whl:
Publisher:
publish.yml on iqnite/spamoji
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
spamoji-0.1.1-py3-none-any.whl -
Subject digest:
abbd775835e6823054305ebdcf1351359f11f63682dfcb9fc695335766d23de1 - Sigstore transparency entry: 1601880559
- Sigstore integration time:
-
Permalink:
iqnite/spamoji@b55602003cf4360b7e6dbca681d6c2f91bbd497c -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/iqnite
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b55602003cf4360b7e6dbca681d6c2f91bbd497c -
Trigger Event:
push
-
Statement type: