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

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
Codemonkey51 (802)

this looks amazing it could be added to repl. if you want to do that go here: https://github.com/replit/polygott and look thru some files in languages/ to see how it works and how you could add ur lang in a pr

DynamicSquid (2653)

@Codemonkey51 oh wow! I never knew I could add my language to repl. I'll take a look at it, thanks!!

Codemonkey51 (802)

thats just backend btw they would still have to add it to frontend @DynamicSquid

Codemonkey51 (802)

thats the base docker image it will be on replservers but not a language makeable thru the new repl button @DynamicSquid

DynamicSquid (2653)

@Codemonkey51 oh, I see. is there a way to do the front end?

TheForArkLD (650)

@DynamicSquid ill help you
1. make github account
2. fork polygott
3. open languages/
4. add night.toml
5. ill give you toml file to you by discord ( teach your discord name to me pls )

TheForArkLD (650)

@DynamicSquid and you forgot add run program by file

DynamicSquid (2653)

@TheForArkLD I did steps 1-5, but I don't have discord. but I forked it though. could you send the info through like a pull request or something? https://github.com/DynamicSquid/polygott/tree/master/languages

DynamicSquid (2653)

@TheForArkLD also what do you mean when you say run by file? like when i coded my language I wrote the code in a file, but for this post, I changed it so you can write code in the condole

TheForArkLD (650)

@DynamicSquid i want run program by file
example : ./night main.night

TheForArkLD (650)

@DynamicSquid no, i send toml file for you.
and oh, ill send link here

TheForArkLD (650)

@DynamicSquid nvm i sended pr to you
(./night is for boot repl, ./night file is for run program by file)

Codemonkey51 (802)

check the circleci errors bc those need to pass for it to be merged @DynamicSquid

DynamicSquid (2653)

@Codemonkey51 what is circleci? I can see it building and testing, but what does that mean?

TheForArkLD (650)

@DynamicSquid i want run program by file...

DynamicSquid (2653)

@TheForArkLD couldn't you type in ./night?

TheForArkLD (650)

@DynamicSquid HEY WE DID IT
TEST SUCCESS!!!!

TheForArkLD (650)

@DynamicSquid BUILD_AND_TEST_CHANGED SUCCESS
BUILD_AND_TEST WILL SUCCESS!!!

DynamicSquid (2653)

@TheForArkLD YAY!!! wait, but what does that mean? like what do the tests actually do?

TheForArkLD (650)

@DynamicSquid uhhh build_and_test failed
bc not night error

TheForArkLD (650)

@DynamicSquid that fail means you cant add that

TheForArkLD (650)

@DynamicSquid sorry type miss i fixed comment

DynamicSquid (2653)

@TheForArkLD oh, aw.. is there a way to fix it?

DynamicSquid (2653)

@TheForArkLD oh, it's fine anyway. thanks for trying though!

Codemonkey51 (802)

well if you guys fix the error circle ci is throwing they can merge it :/ @DynamicSquid

DynamicSquid (2653)

@TheForArkLD oh, so, it turns out there was a bug preventing people from merging successfully. the updates are in the pr. but they said that it's better to just create a template with a binary of your language since they're not at that point yet where you can add languages easily