CookeyLang
h
Coder100 (10529)

CookeyLang

Hello! Today we are introducing a brand new language! This brand new language is very easy to understand and it takes many different features and ideas from different languages making it easy to understand yet still being powerful! We are sure you will have an amazing experience try this language, and transitioning from and to this language will not be a problem! But, what is this language called?

Introducing CookeyLang. CookeyLang is a fast interpreted general-purpose dynamic class-based strong language for beginners, but advanced users can use it as well!

Credits

Language

Design

Beta-Testers

About

CookeyLang was created for the 2020 language jam, but it will not stop there! We already have our very own GitHub repository and docs! We also plan to rewrite in C++ and maybe even a VM! Our plan is to add and update CookeyLang to make it even better! CookeyLang is a great language for beginners to learn!

Purposes

CookeyLang is meant as a general-purpose language for beginners. It promotes good coding practices and is similar to C, JS, C#, and Python for an easy transition to and from the languages. It also contains many new features of its own and new takes on many of the old features of other languages. It aims to solve the problem of python being too "austere" and JavaScript being too "sloppy". It also fixes the problem of semicolons by requiring them throughout the code.

Examples

Fibonacci

function fibonacci(num) {
  if (num <= 1) ret 1;

  ret fibonacci(num - 1) + fibonacci(num - 2);
}

for (var i = 0; i < 20; i ++) {
  printLine(fibonacci(i));
}

99 bottles of beer

function bottle(num) {
  ret num + " of bottles of beer on a wall, " + num + " of bottles of beer on a wall.";
}

function takeOneDown(num) {
  ret "Take one down, pass it around, " + num + " bottles of beer on the wall.";
}

var bottles = 100;

function init(bottles) {
  if (bottles > 0) {
    printLine(bottle(bottles));
    bottles --;
    printLine(takeOneDown(bottles));
    init(bottles);
  } el {
    printLine("No more bottles!");
  }
}

init(bottles);

Links

Documentation
NPM
Github
Repl.it
Tests
CookeyLang Make
Discord

Usage

npx cookeylang [file]

Easy as that!

You can also get a pretty welcome screen.

npx -p cookeylang welcome

Closing

I hope you enjoyed this language as much as we did making it!

You are viewing a single comment. View All
Answered by coderbot100 (76) [earned 5 cycles]
View Answer
firefish (742)

@Coder100 forrep coming to a C/C++ near you...

#define forrep(a, b, c, d) for(int a = b; a < c; a += d)
firefish (742)

@coder100 hehe, is it possible to write the entirety of Cookeylang in defines? #define el else we have the one above, I don't know...

Coder100 (10529)

hey that should be a feature in my lang @fuzzyastrocat

fuzzyastrocat (1208)

@Coder100 No, @firefish and I were attempting to express Cookeylang in terms of C/C++ defines.

If you want to add a macro system though, that would be cool. Macros are nice sometimes, but just beware of precedence issues.

fuzzyastrocat (1208)

@firefish #define printLine(fmt) printf(fmt); printf("\n")

fuzzyastrocat (1208)

@firefish Hey, I like a good challenge! :D

Unfortunately, I'm not sure if this is possible, since CookeyLang seems to share much more in common with JS than the C family... but I could be proven wrong :)

firefish (742)

@fuzzyastrocat Hm... you can't exactly do #defines in JS... well there are classes... maybe in C++?

firefish (742)

@fuzzyastrocat Argh... CookeyLang is typeless... C isn't... this is probably impossible unless we find somthing to typedef var to to create an effectively typeless langauge... a union with a macro together maybe? I don't know...

fuzzyastrocat (1208)

@firefish Yeah, I'm thinking (as @xxpertHacker suggested below) exec(readFileSync("filename", 'utf8').replace(/regex/)) in JS would be the way to do it.
Though I like the union idea — though you'd probably have to use pointers to every non-atomic type and then auto-dereference them....

firefish (742)

@fuzzyastrocat hm... The regex wouldn't exactly work. so oyu wanted to replace el { with else {. what if I have a string "haha cookeylang uses el {" will be converted to "haha cookeylang uses else {". Has nobody else seen this?

fuzzyastrocat (1208)

@firefish No, you can ignore things inside strings with regex — I don't remember the exact pattern off the top of my head but I know I've seen that somewhere.

fuzzyastrocat (1208)

@Coder100 Right, it's a little more complicated since you have to deal with \"'s but I definitely think it's possible (since you can't have nested strings)

Coder100 (10529)

@fuzzyastrocat the problem is you even are using regex for that

Coder100 (10529)

but regex is greedy by default so \" gets ignored what a non-regexer @fuzzyastrocat

fuzzyastrocat (1208)

@Coder100 What do you mean by

the problem is you even are using regex for that

Also, if what you say is true then this would match as one:
"A string!" "Another string"
(And according to regex101.com, this is not true. What a non-regexerr :D)

Coder100 (10529)

yeah because its greedy didn't i say that already @fuzzyastrocat

fuzzyastrocat (1208)

@Coder100 but what you said is objectively wrong... regex will not skip over \", see here:
https://regex101.com/r/5vdTjF/1

firefish (742)

@fuzzyastrocat @Coder100 thanks for the 8 pings... thanks very much.

fuzzyastrocat (1208)

Wait, that pinged you? Odd, I never included your tag, sorry :P

fuzzyastrocat (1208)

@firefish Whoops, sorry — didn't realize that happened.

firefish (742)

@fuzzyastrocat It's fine, I just don't like having dinner then coming back to find 8 pings to answer. Otherwise, all is fine!

firefish (742)

@fuzzyastrocat typedef var auto; sorted. Now casts time

firefish (742)

@fuzzyastrocat here's cookey.h so far: (the typedef didn't work, had to swap it out for a #define)

#include <stdio.h>
#include <stdlib.h>
#define var auto
#define function auto
#define forrep(a, b, c, d) for(size_t a = b; a < c; a += d)
#define el else
#define ret return
#define NaV NULL
#define printLine(fmt) printf(fmt "\n")
#define true 1
#define false 0
firefish (742)

@Coder100 It's cookeylang except in C! :)

fuzzyastrocat (1208)

@firefish lol it's actually starting to work

firefish (742)

@fuzzyastrocat The casts are hideously broken... It doesn't like having a string as the name of the macro... If C++ used to be written in macros, then so can CookeyLang

Coder100 (10529)

ok well anyways im going to make cookeybad @firefish

firefish (742)

@Coder100 you wait until the grilled cookie game comes out (ironically, some of the code for it I stole from projects you have previously made... O_o)

Coder100 (10529)

whattt my code gets used????
Don't worry 90% of the code I make is stolen from a previous project @firefish

firefish (742)

@Coder100 (only the code from your repl.it auth tutorial, that's about it)

Coder100 (10529)

lmao thats not stealing code thats using code @firefish

firefish (742)

@Coder100 I don't see the difference tbh

fuzzyastrocat (1208)

@firefish Ha good point! (referring to the C++ written in C comment)

Coder100 (10529)

haha cookeylang just got compiled

@fuzzyastrocat

firefish (742)

@Coder100

Bye Cookey, Hello cookey.h
<= NaV

also why the weird spelling of cookie

fuzzyastrocat (1208)

@Coder100 Wait I'm confused... is that using something you made, or are you talking about firefish's cookey.h?

firefish (742)

@fuzzyastrocat

Wait I'm confused... is that using something you made, or are you talking about firefish's cookey.h?

Which comment does this reply to? If there are many comments, use quotes

fuzzyastrocat (1208)

@firefish @Coder100 Oh, I'm replying to Coder100's last comment.

haha cookeylang just got compiled

firefish (742)

@fuzzyastrocat

I have a sudden urge to make

I Wonder what the rest of that sentence was.. hmm...

fuzzyastrocat (1208)

@firefish Ha, that's weird... I thought I didn't post that comment, I guess it actually got posted (but only half-saved) and then deleted.

As for the rest of the sentence... you'll know if I make it :D

firefish (742)

@fuzzyastrocat I looked in the url of the comment form my notifications... the old trick

fuzzyastrocat (1208)

@firefish ahhhhh that makes more sense. Well, you'll just have to wait :D (I definitely am going to make it though)

firefish (742)

@fuzzyastrocat Is it a spin-off of cookey.h? hehe my suspicions

fuzzyastrocat (1208)

@firefish Nope (it actually wasn't in response to this post, not sure why it showed up here)

firefish (742)

@fuzzyastrocat Huh, it was actaully an educated guess as to which post, because it doesn't say

fuzzyastrocat (1208)

@firefish Ah ok. Well, you'll see it soon :D

firefish (742)

@fuzzyastrocat Oh, it's the wildest language ideas post, isn't it

fuzzyastrocat (1208)

@firefish EDIT nevermind I forgot where I put my own comment, yes it is

Seth01Master (5)

this is literally the longest thread of replies i've ever seen

Coder100 (10529)

xd check out the welcomes @Seth01Master