🌕 Night - My Programming Language 🌑
h
DynamicSquid (2669)

Night

I feel like my logo is a little too fancy. I'm working on something simpler. Any suggestions?

Hey guys! This is my language I'm currently working on. It's still in early development, so it can't do much yet, but I still have a long way to go.

Also thanks to @ChezCoder and @targetfanttthat for helping me out in the early stages of my language. And thanks to @mathiasaboye as well for the logo idea.

You can also view my language on GitHub as well for more details and an inside look at future plans, and the code! And don't forget to leave star :)

Anyway, I modified it a bit here, so you can run the repl and code directly. All you have to do is run the repl, write your code in the console, and then, type in RUN, and hit ENTER to run the code.

Like this:

print "Hello World!\n";

RUN

Try it out!

Note: To paste text in the console, use Ctrl + Shift + V.

Another Note: The RUN command actually isn't part of my language, but I added it in so it's easy for you guys to run the code here.


Documentation

Standard input:

print "Hello World!\n";

// this is a comment

RUN

It can basically print any expression (you'll see later).

Variables:

// variable initialization
bit a = true && false; // bool
syb b = 's'; // char
int c = 2 + 3;
dec d = 3.14 * 2.73; // float
str e = "squid";

int f; // variable declaration
f = 10; // variable assignment

RUN

Expressions:

Note: operator precedence follows C++ style.

int a = 2 + 3; // supports '+ - / * % ( )' all of those
print a % (2 + 1);
print "\n";

bit b = !true && false; // supports `! && || == != ( )` all of those
print true && ("Squid" == "smart");
print "\n";

str c = "dynamic " + "squid"; // supports string concatenation
c = c + " is smart";
print c + "\n";

RUN

If Statements:

This is the good part :)

int numberOfLegs = 10;
bit isSmart = true;

if (isSmart && (numberOfLegs == 8 || numberOfLegs == 10))
{
	// nested if statements work fine!
	if (numberOfLegs == 8)
	{
		print "You're an octopus!\n";
	}
	else
	{
		print "You're a squid!\n";
	}
}
else if (!isSmart && numberOfLegs == 2)
{
	print "You're a human!\n";
}
else if (isSmart && numberOfLegs == 4)
{
	print "Hi pet!\n";

	if (true)
	{
		print "Dogs are better than cats\n";
	}
	else
	{
		print "Cats are better than dogs\n";
	}
}
else
{
	print "Who are you??\n";
}

RUN

And that's it! Make sure to check out my GitHub page for more info! And feel free to leave any feedback or questions in the comments below.

Enjoy :)

You are viewing a single comment. View All
SwaroopBappanad (17)

Dude, this is freaking amazing! Great Job!