Skip to content

🔑++ The programming language they don't want you to use #WETHEBEST

Notifications You must be signed in to change notification settings

rrshaban/keyplusplus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 

Repository files navigation

#DJKHALED #WETHEBEST

An emoji-based programming language designed to satisfy a curiosity around language-parsing and inspired by the idiolect of DJ Khaled. Designed over a few days at Swarthmore College.

Other programming languages, they don't want you to win. That's why we're bringing you 🔑++, the key to more success.

They don't want you to code your way to more success. We do. They don't want you to code with 🔥emoji. We do. They don't want you always have another one. We do. Another one.

And guess what? We've changed – a lot.

:key:++

Welcome to 🔑++, the programming language for winners and champions. We the best.

Hello World

🔥 "Hello World"

Fizz My Buzz

they don't want you to fizzbuzz max
  
  🔑 n 0
  
  ride wit me
    if n % 3 == 0 and n % 5 == 0:
      🔥 "FizzBuzz"
    elif n % 3 == 0:
      🔥 "Fizz"
    elif n % 5 == 0:
      🔥 "Buzz"
    else:
      🔥 n

    if n >= max:
      you played yourself
    
    another one

  major 🔑 👍

🙏

Running 🔑++ locally

In order to run 🔑++ on your local machine, you'll want to set up an alias so you can run code from anywhere.

Add the following code to your ~/.profile or ~/.bash_profile (check out StackOverflow for more information).

alias 🔑++="PATH_TO_DIRECTORY/🔑++/bin/🔑++"

You can change the alias if you'd prefer not to type emojis – we recommend "key++". Then you can just run

$> 🔑++ examples/hello_world.liooooon
Hello world - WE THE BEST!

Name

This language is called 🔑++ because it's the key to more success, and another one.

Syntax

Boilerplate

All 🔑++ programs must begin with the following two-line comment:

#DJKHALED
#WETHEBEST

Built-in types

🔑++ naturally supports integers, floats, and strings. Booleans are 👍, true, and 👎, false.

🔑++ accepts all standard operators, +, -, *, \, %, **, etc. Anything you could find in Python ;)

1
3.14
👍
"another one"

Printing

To print a value, simply prefix it with 🔥.

🔥 3.14
🔥 "another one"

Assigning variables

🔑++ uses the following notation for assigning variable values:

🔑 x 1

You can read this as "The key to x is 1". The right term can include operators, so 🔑 x x + 1 will assign the value x + 1 to x.

Functions

Function definitions begin with they don't want you to [name] [args] and are closed with 🙏. To specify the return value, use major 🔑 [optional value]. 🔑++ does not yet support anonymous functions.

An example implementation of Fibonacci is below:

they don't want you to fibonacci n
  
  🔑 acc1 0
  🔑 acc2 1

  ride wit me
    🔑 temp acc2
    🔑 acc2 acc2 + acc1
    🔑 acc1 temp
    🔑 n n - 1

    if n < 1: 
      you played yourself
  another one

  major 🔑 acc1 
🙏

Loops

Don't play yourself. 🔑++ makes it easy to write code and easy to call another one. All 🔑++ loops are initialized with the tag ride wit me and default behavior is always another one.

ride wit me
  ...
another one

Breaks

To exit a loop use the command you played yourself. Thus we can write a traditional loop as follows:

ride wit me
	[...]
	if [condition]:
		you played yourself
another one

Importing modules

DJ Khaled has the best fans in the world. You can access local Python libraries via fanluv [libname].

Next Steps

We're currently working on implementing struct support in 🔑++.

We are also working on O'Khaled, a JIT compiler for 🔑++.

Who did this?

Good question. Razi Shaban and Alec Pillsbury put this project together after a late-night brainstorming session. Hope you unlock more success

Isn't this just a blah blah python

Yeah, yeah, whatever. Another one.

About

🔑++ The programming language they don't want you to use #WETHEBEST

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published