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

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)

I visited your page a couple days ago and saw this. But when I looked at it, it had a bunch of folders. Right now it looks like a bunch of binary. How did you change this? (And how did you write and understand that gibberish?)

DynamicSquid (2672)

@SwaroopBappanad oh, that's just the .exe ELF file. I coded this in c++, and when you run a C++ program, it generates a .exe ELF file. the actual code can be found on my github page :)

AmazingMech2418 (692)

@DynamicSquid ELF, not .exe! This is Linux, not Windows.

DynamicSquid (2672)

@AmazingMech2418 wait, is there an actual difference between the two?

AmazingMech2418 (692)

@DynamicSquid Yeah. LOL! ELF is on Linux and EXE is on Windows.

DynamicSquid (2672)

@AmazingMech2418 well, yes lol, but I meant other than that

AmazingMech2418 (692)

@DynamicSquid Well, they are both binary files on their respective systems, so not much other than that EXE files don't have as low-level control (i.e. you can't make an OS with an EXE file, but can with ELF)

Lethdev2019 (85)

It's also the way they are encoded, if they were endoed the same, you would have been able to just directly change the extension from .exe to .elf and back. @DynamicSquid

@AmazingMech2418 wouldn't low level access also allow you to create a really dangerous virus.

AmazingMech2418 (692)

@Lethdev2019 Yes, but access to certain parts of the memory storage device on Linux is restricted. Though, if someone could get root privileges, they could completely change the OS and that could cause a huge ransomware attack...