Frog
Jump to navigation
Jump to search
Frog is an esoteric programming language created by Stysan (talk) that commands are based on sounds that frogs make. Syntax of this language is based on Batch syntax. Frog scripts extension is .frgp. There's also another language called Sickfrog - which is sick (in the bad meaning) version of Frog.
Example | Output | Description |
---|---|---|
croak Hello World! | Hello World! | Outputs a value. |
quack How old are you? | How old are you? | Asks a question. |
ribbit 14 | No output | What question answer should be. |
bark | True/False | Checks if answer is right. |
beep 10 | 1-10 | Outputs a random number between 1 and entered value. |
cluck 1 | No output | Sleeps value seconds. |
*something | No output | Comments. |
Interpreter
This is the original interpreter for Frog written on Python 3.8.5.
from tkinter import Tk, filedialog as fd from time import sleep from random import randint tk = Tk() tk.withdraw() filetypes = [("Frog Scripts", "*.frgp"), ("All files", "*.*")] code = fd.askopenfilename(title="Select a Script", filetypes=filetypes) code = open(code, mode="r") code = code.read() code = code.split("\n") answer = "" answer_shouldBe = "" def bug(): print("ERROR") sleep(1) quit() for i in code: try: if i.startswith("croak "): print(i[6:]) elif i.startswith("quack "): answer = input(i[6:]) elif i.startswith("ribbit "): answer_shouldBe = i[7:] elif i == "bark": print(answer == answer_shouldBe) elif i.startswith("beep "): print(randint(1, int(i[5:]))) elif i.startswith("cluck "): sleep(int(i[6:])) elif i == "" or i.startswith("*"): pass else: bug() except: bug()
Examples
croak Hello World!
Quiz!
croak Quiz! ribbit esolangs.org quack What is the best site about esolangs? bark croak I won't add more questions I'm lazy