Share your repls and programming experiences

← Back to all posts
4 languages that can kill themselves
DynamicSquid (4538)

4 files, each with a different language. Each file will call the next file, and then commit die. Like this:

**main.cpp**
run main.py
kill itself

**main.py**
run main.rb
kill itself

etc.

Basically how this works is each file calls 2 shell commands, one to run the next file, and one to commit toaster bath. The bash command to commit skydiving without a parachute is rm FILE_NAME.

I also added brief comments on how the shell commands work in each language so you might learn something.

I'm just bored.

Commentshotnewtop
SixBeeps (3706)

This is unbelievably useless and I love it

SwaroopBappanad (237)

Looks like a being more powerful than Thanos, one that did the job right this time.

xxpertHacker (614)

@SwaroopBappanad What about the rest of the Repls?

[deleted]

@SwaroopBappanad Yeah he is right lol

DynamicSquid (4538)

@HiPeople844 it commits unalive, run the code, and all the files will self destruct

DynamicSquid (4538)

@HiPeople844 like SixBeeps said:

This is unbelievably useless and I love it

headiscoding (938)

Are you available to help me with something? @DynamicSquid

headiscoding (938)

Can you help me make a language? @DynamicSquid

DynamicSquid (4538)

@MohammedBalsara oh, sorry no. I'm really busy myself. I can point you to the right direction though

DynamicSquid (4538)

@MohammedBalsara Okay, try to make a lexer first. A lexer takes in a string input, and turns that into a list of "tokens". A token is a class which has a type, and the actual token.

For example:

(you do python right?)

class Token:
  def __init__(self, type, value):
    self.type = type
    self.value = value

def lexer(code):
  # implement your lexer here
  # it should return a list of tokens

code = input()
tokens = lexer(code)

# make sure it works
for token in tokens:
  print('[' + token.value + ']', end=' ')

A token might look like this:

token = Token('value', '5')
token = Token('value', 'true')
token = Token('operator', '+')

Right now, you can start small and only focus on arithmetic operations. You want your code to take in input like:

3 * (21 + 4)

And print this:

[3] [*] [(] [21] [+] [4] [)]
SeamusDonahue (103)

so basically the file opens a new file then commits lego step..... truly the best use of technology what a genius

Pizzaz4me (60)

this made me learn C++ lol

oignons (314)

Nice! Also congrats on 3,000 cycles! Time to take a chunk of yours...

Codemonkey51 (924)

It seems everyone is getting so many cycles... I guess by the time I get 1k coder will prob have like 10-15k lol @oignons

oignons (314)

@Codemonkey51 Lol when I reach 1k coder will have SOOOO many.

DynamicSquid (4538)

@Codemonkey51 bruh coder's on like every second of the day answer questions and commenting it's insane...

oignons (314)

@DynamicSquid I know right! Every time I go on the Ask Board, he's always answered most of the questions. It's scary.

firefish (884)

@oignons Hm... that grilled cookie is quite knowlegable... hehe

FlaminHotValdez (219)

@DynamicSquid True true. According to his profile he's in middle school, yet he's on like every second of the day.

DynamicSquid (4538)

@maxyang I noticed that he's on less though compared to in the summer

ike_fite (12)

I've thought of doing this before. You just have to make sure you commit a snapshot before the program commits. @DynamicSquid

JohnsonAndrew (2)

This is the kind of useless nonsense we need more of!

archie426 (1)

very much a c way of doing things but ok

SwaroopBappanad (237)

Dynamic Squid: Creates repl that commits sudoku
Literally everyone: SMASHES UPVOTE

CodingRedpanda (145)

i fell like this could be a movie called "Self Destruct" where one thing causes itself and another things to explode etc...

FlaminHotValdez (219)

"commit die" "commit toaster bath" "commit skydiving without a parachute" "commit unalive" BWAHAHAHAHAHAHAHAHA

RayvelArjoon (82)

It's useless...
BUT IT'S TOO GOOD!!!!!!!!!

Pizzaz4me (60)

I can't stop running the program and reloading the page. Help!

PattanAhmed (1371)

What?
You killed the built-in file given by Repl.it?

WOW!!!

EpicGamer007 (1258)

@PattanAhmed , it is actually really simple, all you have to do is go to the console or shell and type in rm [insert file name here].

PattanAhmed (1371)

@AbhayBhat Yes
Thanks for your answer!

fuzzyastrocat (1472)

@PattanAhmed @DynamicSquid It's funny how repl's filesystem freaks out if the main file deletes itself and you then try to edit other files.

ImplodingBug (5)

It's pretty good, but it would be cool if you could use a way to delete the files that's not the terminal, maybe os.remove() for Python (https://docs.python.org/3/library/os.html) or the file.delete command in Ruby (https://arjunphp.com/delete-file-ruby#:~:text=Removing%20single%20file%20in%20Ruby,of%20names%20passed%20as%20arguments.) Just a suggestion for in the future though, because this does its function perfectly.

PXY (32)

Now I know what to say when I don't turn in CS assignments

DynamicSquid (4538)

@PXY

"Why didn't you do your homework?"
"My code self-destructed"

PXY (32)

@DynamicSquid "Thanks for telling me! I'll be sure to mark your grade accordingly."

TheAverageAsian (3)

So dumb, yet so smart. life in a nutshell
I'm just glad no has created real life anime characters...

Bookie0 (5052)

wow, files disappear lol!
(mac users commit cmd-Q lol)

python88 (287)

i love this and the code is too complex for me to understand also what is your fav icecream flavor?

DynamicSquid (4538)

@python88 my favourite ice cream flavour is success

python88 (287)

@DynamicSquid vanila javascript with a litle bit of umm... idk

python88 (287)

@DynamicSquid also drop a gallon of python eyes

DynamicSquid (4538)

@python88 I call it "ink" from where I come from

python88 (287)

@DynamicSquid your the first squid to get 3000 cycles and the 5th place

python88 (287)

@DynamicSquid do you like coffie-script

firefish (884)

This is absurdly daft and wonderful, wish I thought of it first.... I know the story of a man who though killing a process could be done by delete it's source program. No. Also C++ is compiled to main (the elf binary) with clang so instead of rm main.cpp do rm main.cpp main. There is still that cheeky main file still there.

DynamicSquid (4538)

@firefish well only if you compile it yourself. the default repl.it project contains the main.cpp

firefish (884)

@DynamicSquid repl.it purposely hides the file called "main". do an ls -la in the bash shell

firefish (884)

@DynamicSquid REmember: c++ is not a script, it is a compile lang, so the binary has to go somewhere

DynamicSquid (4538)

@firefish yeah I know that, but I thought the main file was unaccessable

firefish (884)

@DynamicSquid It exists, just the repl.it file manager hides it from you

HahaYes (1287)

@DynamicSquid yay congrats on 3100 cycles. Go beat coder for me thanks

potatojs (816)

wait..wat?..why are..wt...this is...