5 ms·
Since I have the world's greatest creative assistant handy, here's what GPT-4 thinks a Kim Kardashian language would look like: Hey dolls, let me introduce you
by localhost 4y ago
Since I have the world's greatest creative assistant handy, here's what GPT-4 thinks a Kim Kardashian language would look like:
Hey dolls, let me introduce you to the Kimmie programming language, it's like totally fab and easy to use!
To declare a variable, just use the hashtag symbol and the variable name, like this:
#my_var
To assign a value to the variable, use the word "like" followed by the value, like this:
#my_var like 10
To print out a message, use the word "OMG" followed by the message in double quotes, like this:
OMG "Hello, dolls!"
To add two variables together, use the word "add" followed by the two variables, like this:
#var1 like 5
#var2 like 7
#sum like add #var1 #var2
- alfor 4y agoHere is the TrashTalk interpreter: import re def trashtalk_interpreter(code): variables = {} code_lines = code.split("\n") for line in code_lines: if line.startswith("#"): var_name, _, value = line.partition(" like ") if "add " in value: _, var1, var2 = value.partition("add ") var1 = var1.strip() var2 = var2.strip() variables[var_name.strip()] = variables[var1] + variables[var2] else: variables[var_name.strip()] = int(value) elif line.startswith("OMG"): message = re.findall(r'"(.*?)"', line) if message: print(message[0].format(**variables)) # Sample code code = ''' #my_var like 10 OMG "Value of my_var: {my_var}" #var1 like 5 #var2 like 7 #sum like add #var1 #var2 OMG "Sum of {var1} and {var2} is {sum}" ''' trashtalk_interpreter(code)
- bqmjjx0kac 4y agoIs this an original joke/impression by GPT-4? Either way, this is hilarious.
- localhost 4y agoI copied the response verbatim. I also did a follow-up where it wrote the interpreter as well: class KimmieInterpreter: def __init__(self): self.variables = {} def interpret(self, code): for line in code.split("\n"): tokens = line.split() if len(tokens) == 0: continue if tokens[0] == "#": self.variables[tokens[1]] = None elif tokens[0] == "#my_var": self.variables[tokens[1]] = int(tokens[3]) elif tokens[0] == "OMG": print(tokens[1][1:-1]) elif tokens[0] == "add": var1 = self.variables[tokens[2]] var2 = self.variables[tokens[3]] result = var1 + var2 self.variables[tokens[1]] = result