Skip to content

t0rbn/crapssembly

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

What the πŸ¦€?

Crapsemmbly is a programming language brainfart inspired by assembly and sleep deprivation. It minimizes readability while maximizing the use of emoji. Use at your own risk.

Example: Fibonacci Sequence

This "simple" code calculates as many fibonacci numbers as the user chooses. Or as many as the interpreter can handle before wetting the bed with StackOverflowExceptions.

πŸ–¨ How many fibonacci numbers do you need?

πŸ“– πŸ‘”
πŸ–¨ πŸ‘
πŸ’΅ πŸŒ™ 1
πŸ’΅ πŸ• πŸŒ™
πŸ’΅ πŸ’– πŸŒ™
βš“ πŸ”‘
🍊 πŸ‘” πŸ’– πŸ’€ πŸ”₯
βš“ πŸ’€
🏦 πŸŒ™
βž• πŸŒ™ πŸ• πŸš—
πŸ’΅ πŸŒ™ πŸ•
πŸ’΅ πŸ• πŸš—
βž• 1 πŸ’– πŸ’–
🚢 πŸ”‘
βš“ πŸ”₯

How does this work?

Every line consists of an instruction followed by parameters, all separated by spaces. Parameters may be variable names or floating point numbers. Variable names may be any UTF-8 string but must not contain whitespace chracters. There are two special instructions, πŸ’¬ and πŸ–¨, that are followed by strings which may contain whitespaces.

Arithmetic instructions (βž•, βž–, βž— and βœ–οΈ) take the two arguments of their calculation as the first two parameters; the third parameter is the variable to which the result will be written, e.g. βž• A 5 foo takes the value stored as A, adds 5 and saves the result as foo.

The keywords πŸ’΅ and πŸ“– set variables either programatically or by reading user input. To output data to the user, use the commands πŸ–¨ (print string parameter) and 🏦 (print variable).

The program execution can be controlled with the keywords βš“ (define anchor point), 🚢 (goto anchor point) or with comparison instructions. Comparison instructions take the left and right side of the comparing operator in the first two params, the next two parameters are the names of the program anchors to which the execution will jump according to the result of the comparision. For example the line 🍌 foo 4 foo bar means that if the value stored as foo is less than four, the program will jump to the anchor foo, otherwise to bar.

Comments can be added using the keyword πŸ’¬.

Example: Fahrenheit to Celsius converter.

This example might cast some light on the instruction syntax:

πŸ’¬ Print this question to the user
πŸ–¨ What's the temperature (in Fahrenheit)?

πŸ’¬ Read the user's input and save it in the variable 🌑️
πŸ“– 🌑️

πŸ’¬ Subract 32 from 🌑 and save️ the result in 🌑
βž– 🌑️ 32 🌑️
πŸ’¬ Now divide 🌑 by 1.8 and save️ the result in 🌑
βž— 🌑️ 1.8 🌑️

πŸ’¬ Again, print static text
πŸ–¨ Converted to Celsius:

πŸ’¬ Print what we've just calculated
🏦 🌑️

More examples can be found in this repo under /examples.

Instruction Set Reference

Key Instruction Param 1 Param 2 Param 3 Param 4
βž• addition 1st addend 2nd addend target variable
βž– subtraction minuend subtracted target variable
βž— division dividend divisor target variable
βœ–οΈ multiplication 1st factor 2nd factor target variable
🍌 less than left side right side anchor if true anchor if false
πŸ† less or equal left side right side anchor if true anchor if false
πŸ‰ greater than left side right side anchor if true anchor if false
🍊 greater or equal left side right side anchor if true anchor if false
πŸ‹ equal left side right side anchor if true anchor if false
🍍 not equal left side right side anchor if true anchor if false
πŸ–¨ ️ print text text to print (1)
🏦 print variable variable to print
πŸ’΅ set variable variable name
πŸ“– read input variable name value
βš“ define anchor anchor name
🚢 goto anchor anchor to go to
πŸ’¬ comment comment text (1)

(1) Whitespaces allowed

Try it yourself!

Why the heck would you?!

Build the interpreter

Needed dependencies

  • Java 13
  • Gradle

Build with gradle

To build the interpreter, run

gradle clean build

in the project directory. This creates a runnable jar in build/libs/crapssembly-1.0-SNAPSHOT.jar

Run your crapsemmbly code

Run the interpreter jar with java. The first - and only - argument must be the path to your crapsemmbly code file.

java -jar crapssembly-1.0-SNAPSHOT.jar path/to/your/code.file

About

πŸ¦€πŸ’©πŸ–₯️

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages