@yurikdotdev/covfefescript
Version:
A Trumpian-syntax Turing-complete interpreted language.
241 lines (165 loc) • 6.98 kB
Markdown
# CovfefeScript | Make Coding Fun Again
A Trumpian-syntax Turing-complete interpreted language.
<p align="left">
<img src="https://img.shields.io/badge/version-0.0.1-blue" alt="Version">
<img src="https://img.shields.io/badge/status-alpha-red" alt="Status">
<img src="https://img.shields.io/badge/license-MIT-green" alt="License">
</p>
**Boot.dev Hackahton 2025**
```
⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠋⠉⡉⣉⡛⣛⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⣿⡿⠋⠁⠄⠄⠄⠄⠄⢀⣸⣿⣿⡿⠿⡯⢙⠿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡿⠄⠄⠄⠄⠄⡀⡀⠄⢀⣀⣉⣉⣉⠁⠐⣶⣶⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡇⠄⠄⠄⠄⠁⣿⣿⣀⠈⠿⢟⡛⠛⣿⠛⠛⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡆⠄⠄⠄⠄⠄⠈⠁⠰⣄⣴⡬⢵⣴⣿⣤⣽⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣿⡇⠄⢀⢄⡀⠄⠄⠄⠄⡉⠻⣿⡿⠁⠘⠛⡿⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⡿⠃⠄⠄⠈⠻⠄⠄⠄⠄⢘⣧⣀⠾⠿⠶⠦⢳⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⣿⣶⣤⡀⢀⡀⠄⠄⠄⠄⠄⠄⠻⢣⣶⡒⠶⢤⢾⣿⣿⣿⣿⣿⣿⣿
⣿⣿⣿⣿⡿⠟⠋⠄⢘⣿⣦⡀⠄⠄⠄⠄⠄⠉⠛⠻⠻⠺⣼⣿⠟⠋⠛⠿⣿⣿
⠋⠉⠁⠄⠄⠄⠄⠄⠄⢻⣿⣿⣶⣄⡀⠄⠄⠄⠄⢀⣤⣾⣿⣿⡀⠄⠄⠄⠄⢹
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢻⣿⣿⣿⣷⡤⠄⠰⡆⠄⠄⠈⠉⠛⠿⢦⣀⡀⡀⠄
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠈⢿⣿⠟⡋⠄⠄⠄⢣⠄⠄⠄⠄⠄⠄⠄⠈⠹⣿⣀
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠘⣷⣿⣿⣷⠄⠄⢺⣇⠄⠄⠄⠄⠄⠄⠄⠄⠸⣿
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠹⣿⣿⡇⠄⠄⠸⣿⡄⠄⠈⠁⠄⠄⠄⠄⠄⣿
⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⠄⢻⣿⡇⠄⠄⠄⢹⣧⠄⠄⠄⠄⠄⠄⠄⠄⠘
```
**Disclaimer**: This is not political. I'm not american. No hate or love, just memes.
## The GREATEST Demo You've Ever Seen
A lot of people are saying, and I mean **A LOT** of people, that this is the **BEST** fizzBuzz they have ever seen. Nobody has seen a fizzBuzz like this. It's unbelievable. Believe me.
fizzBuzz.covfefe
```
MAKE_IT_BIG fizzBuzz(n) {
LOOK x IS 0!
KEEP_WINNING (x <= n) {
BELIEVE_ME (x % 3 == 0) AND (x % 5 == 0) {
BING("fizzBuzz")!
} BUT_MAYBE (x % 3 == 0) {
BING("fizz")!
} BUT_MAYBE (x % 5 == 0) {
BING("buzz")!
} FAKE_NEWS {
BING(x)!
}
LOOK x IS x + 1!
}
}
fizzBuzz(15)!
```
## Running CovfefeScript: It's VERY SIMPLE, The SIMPLEST!
Running CovfefeScript is VERY SIMPLE. The SIMPLEST. It's so easy, even a child could do it.
You can build it yourself like a WINNER. It's a beautiful thing.
```
// First, you build the interpreter, a strong interpreter.
go build -o covfefescript cmd/covfefescript/main.go
// Then, run your beautiful code. You'll love it.
./covfefescript examples/helloWorld.covfefe
```
Or you can use NPM. SAD! It's a disaster.
```
npm install -g /covfefescript
```
## REPL: It's TREMENDOUSLY Interactive!
You can also run CovfefeScript in interactive mode. It's a beautiful thing, very interactive. Just type your code and see what happens. It's so good, so fast.
```
// Just run the interpreter without a file. It's that simple.
./covfefescript
// or run the binary from npm
covfefescript
```
## Syntax: The BEST Syntax. Everyone Agrees.
A lot of people are saying we have the BEST SYNTAX. It's so clear, so concise. It's the most beautiful syntax.
### Statement Terminator: It Shows STRENGTH!
All real statements, the ones that DO THINGS, the important ones, they MUST end with an exclamation point (!). It shows STRENGTH. It's not optional. We don't do optional.
### Comments: Dealing with FAKE NEWS!
Sometimes you have to deal with FAKE NEWS from the media. It's disgusting. You can put it in comments. We know the truth.
```
// This is fake news. You know it. I know it.
// Everybody knows it. It's a total witch hunt.
FAKE_CODE
This code? Totally fake.
Nobody even runs this stuff.
It's just here to confuse the losers and haters.
SAD
```
### Variables: LOOK for the TRUTH!
You declare variables with LOOK. It's how you find the TRUTH. There are many GREAT types of variables. These are just labels, by the way, not keywords. The language itself is VERY SMART. It knows the type. It's brilliant.
```
// TWEET
LOOK economy IS "booming"!
// MONEY
LOOK small_loan IS 1000000!
// TRUTH
LOOK my_hater IS LOSER!
LOOK my_hand IS YUGE!
// COVFEFE (null)
LOOK empty_val IS COVFEFE!
// COLLUTION
LOOK my_team IS [ "the best", "people", "a beautiful wall" ]!
// PROPERTY
LOOK my_deal IS {
"name": "The Art of the Deal",
"rating": "tremendous"
}!
```
### Conditionals: BELIEVE ME or It's FAKE NEWS!
You use BELIEVE_ME for an if statement. If that's not true, and sometimes it's not, you try BUT_MAYBE (else if). Everything else is FAKE_NEWS (else). SAD!
```
LOOK your_breath IS "good"!
BELIEVE_ME your_breath == "good" {
BING("It's the best breath, very best.")!
} BUT_MAYBE your_breath != "good" {
BING("Do you mind if I sit back a little? ")!
} FAKE_NEWS {
BING("Because your breath is very bad.")!
}
```
Just like the other languages, the ones that are okay, you can use AND. I know it, you know it. Everyone knows it.
### Loops: KEEP_WINNING! It's the BEST STYLE!
You use KEEP_WINNING to start a loop. It's a C-style loop because it's a WINNING STYLE. The BEST STYLE. We only do winning.
```
LOOK j IS 0!
KEEP_WINNING (j < 20) {
BELIEVE_ME j == 17 {
IT_WAS_RIGGED! // break
}
BELIEVE_ME j % 4 == 0 {
LOOK j IS j + 1!
TIRED_OF_WINNING! // continue
}
BING(j)!
LOOK j IS j + 1!
}
```
### Arithmetic: We Have the BEST MATH!
We have the BEST MATH. I love math, nobody does math like this. It's simple, it's effective, it's winning math.
```
LOOK a IS 5!
LOOK b IS 3!
LOOK sum IS a + b!
BING("5 + 3 =", sum)!
LOOK diff IS a - b!
BING("5 - 3 =", diff)!
LOOK prod IS a * b!
BING("5 * 3 =", prod)!
LOOK quotient IS a / b!
BING("5 / 3 =", quotient)!
LOOK rem IS a % b!
BING("5 % 3 =", rem)!
LOOK big_number_calc IS a + b * 2 - 1!
BING("Complex calc:", big_number_calc)!
```
### Functions: MAKE IT BIG! It's SO GOOD!
As you have probably guessed, and you're very smart for guessing, you use MAKE_IT_BIG to start a function. It is SO GOOD, SO SIMPLE. It's the best function declaration. You use GIVE_ME to return a value. It's a beautiful thing.
```
MAKE_IT_BIG buildTheWall(height, material) {
GIVE_ME "My ideal wall is a " + height + " feet wall made of " + material + ". Beautiful."!
}
LOOK my_wall IS buildTheWall("five", "solid gold")!
BING(my_wall)!
```
We have the BEST BUILT-INS. More are coming. They're going to be huge.
- BING(...)!: Prints to the console. Very powerful. Very direct.
## Attributions
This project draws heavily from Writing an Interpreter in Go by Thorsten Ball, some portions of the code closely follow examples from the book, adapted to fit the project’s goals and constraints.
## License
MIT