🌕 Night - My Programming Language 🌑
DynamicSquid (2678)


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";


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.


Standard input:

print "Hello World!\n";

// this is a comment


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


// 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



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";


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";
		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";
		print "Cats are better than dogs\n";
	print "Who are you??\n";


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
DynamicSquid (2678)

@hhbo64 Okay, so first you pass code input through something called the lexer. And what the lexer does is it tokenizes the input into tokens, like this:

print "Hello World!";


KEYWORD: (print)
STRING:  (Hello World!)
SYMBOL:  (;)


array_of_tokens = {
  Token{ KEYWORD, "print"       },
  Token{ STRING,  "hello world" },
  Token{ SYMBOL,  ";"           },

A token is a struct/class. The type is an enum and the actual token is a string.

Then you pass that through a parser. There are many different types of parsers around, but mine looks like this:

array_of_tokens = { "int", "a", "=", "2", "+", "3" }

Variable declaration? Check
Int variable? Check

Extract Expression:

"2 + 3"

Send off to Math Parser.

Math Parser:

2 + 3 = 5
return 5;

So now we have a value. Then we do the runtime:

int a = 5;

Create int variable with value of 5

And that's it :) Let me know if there's parts in which you're confused. Check out the GitHub page for more info