Share your repls and programming experiences

← Back to all posts
🌕 Night - My Programming Language 🌑
h
DynamicSquid (2673)

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 :)

Commentshotnewtop
noquinn (24)

wow, that's incredible
Any plans to add some kind of loop?

DynamicSquid (2673)

@noquinn yup! you can see my future plans on the github page. I'm currently working on functions, then I'll add loops

pr0p3rno0b10 (29)

How did you make your logo? Did you use a website?

DynamicSquid (2673)

@pr0p3rno0b10 it's a coding language that let's you create graphics easily

HenryZelonka1 (83)

@DynamicSquid
That's pretty good for processing. Nice!

Lethdev2019 (86)

How did you create the programming language?
good job btw

DynamicSquid (2673)

@Lethdev2019 oh you can check out my github page for more info on the code. also thanks!!

HenryZelonka1 (83)


Hey! Humans are smart.

Barry123 (53)


It seems like octopuses and squids are smarter

HenryZelonka1 (83)

@Barry123
Hmmmm... So strange considering that @DynamicSquid should not be biased at all.

DynamicSquid (2673)

@Codemonkey51

print "Monkeys are good too!\n";

RUN
firefish (308)

@DynamicSquid You should make it into a REPL... also Shift+Insert is another way to paste in console

CarlosRosiles (153)

Nice! Btw, You should add loops

DynamicSquid (2673)

@CarlosRosiles thank you!! also, you can take a look at my github page to see what I'm working on next. right now, I'm doing functions, but loops are coming after

CarlosRosiles (153)

@DynamicSquid All right. Keep up the good work!

Codemonkey51 (803)

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 (2673)

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

Codemonkey51 (803)

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

Codemonkey51 (803)

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

DynamicSquid (2673)

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

TheForArkLD (660)

@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 (660)

@DynamicSquid and you forgot add run program by file

DynamicSquid (2673)

@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 (2673)

@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 (660)

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

TheForArkLD (660)

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

TheForArkLD (660)

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

Codemonkey51 (803)

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

DynamicSquid (2673)

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

TheForArkLD (660)

@DynamicSquid i want run program by file...

DynamicSquid (2673)

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

TheForArkLD (660)

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

TheForArkLD (660)

@DynamicSquid BUILD_AND_TEST_CHANGED SUCCESS
BUILD_AND_TEST WILL SUCCESS!!!

DynamicSquid (2673)

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

TheForArkLD (660)

@DynamicSquid uhhh build_and_test failed
bc not night error

TheForArkLD (660)

@DynamicSquid that fail means you cant add that

TheForArkLD (660)

@DynamicSquid sorry type miss i fixed comment

DynamicSquid (2673)

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

DynamicSquid (2673)

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

Codemonkey51 (803)

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

DynamicSquid (2673)

@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

BobTheTomatoPie (1052)

Its awesome! The code is so out of my mental range it is frightening

targetfanttthat (98)

I LOVE the fact that you're taking it easy and making it simple since it is your first go at making a programming language. I should've done that. It is way easier to just make a copied version of a language then adapt the copied version of a language into your own as time goes on.
I, on the other-hand, tend to get myself caught up on a whole bunch of useless stuff(that probably don't even have a use) and waist my time when I could be fixing the hundreds of bugs my programming language has, lol.

But good job man! You're by far wayy smarter and wayy more advanced than me. Keep it up you're doing great!!

DynamicSquid (2673)

@targetfanttthat Oh thanks! I've learned the hard way that when trying something new, go the easy route first to learn what you're actually doing. Trust me, I've fell down that rabbit hole many times before and it was a pain. But thanks! You're going great with your language as well!

KimiTian08 (10)
int numberOfLegs = 2;
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
OUTPUT:

Who are you??

umm

a smart human?
MrTheCool (1)


I'm seeing more something like this for the logo..
credit to logomakr.com

MrTheCool (1)

@DynamicSquid thanks. It's definitely simpler, maybe too simple. Feel free to borrow it or merge it with your current logo.
Nice programming language btw!

DynamicSquid (2673)

@MrTheCool yeah, I'll definitely take inspiration form that. and thanks!!

mathiasaboye (62)


I think it could look nice if you removed the "N"

and maybe add more stars?
DynamicSquid (2673)

@mathiasaboye oh interesting... thanks for the idea!

viraatvv (29)

it's built around c# and python, right?

DynamicSquid (2673)

@viraatvv kind of yes. I tried to combine the simplicity of python with the type concepts of the C family

viraatvv (29)

@DynamicSquid wow. also, this is unbelievable. I think your language could actually be successful when you release it

hhbo64 (3)

How do you make a Lang?

DynamicSquid (2673)

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

[lexer]

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

  |
  |
  V

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

hhbo64 (3)

Thanks! Any good tutorials you [email protected]

DynamicSquid (2673)

@hhbo64 umm... there really aren't any great tutorials out there for making a language. I just started coding and learning through trial and error, and I'm still learning a lot. You can try this tutorial to get started, but my best advice is to just start coding. Start with the lexer :)

hhbo64 (3)

K’@DynamicSquid

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 (2673)

@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 (693)

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

DynamicSquid (2673)

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

AmazingMech2418 (693)

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

DynamicSquid (2673)

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

AmazingMech2418 (693)

@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 (86)

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 (693)

@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...

theangryepicbanana (1635)

Always nice to see real languages here :)

rediar (318)

@theangryepicbanana I mean.. “real languages”? That’s pretty subjective, but I would agree if you said this was a higher quality language

[deleted]


Cool

Lethdev2019 (86)

@DynamicSquid That kinda makes me think of a commodore in which you would type the code and then type run.

Don't use goto 0 alone on a commodore, it creates an infinite loop that goes on forever.

Jakman (377)

I like the way your recent projects have been heading lately. Also would you like to give me some programming advice on a project i have been building lately?

DynamicSquid (2673)

@Jakman oh yeah thanks! every since summer rolled around, I've been spending much more time programming. and sure, what's the project?

Jakman (377)

@DynamicSquid A File corrupter. It uses both Rust and python. Are you up for it?

DynamicSquid (2673)

@Jakman that sounds interesting, but I'm not that familiar with rust or python

Jakman (377)

@DynamicSquid I think i just need advice with my thought process. As I haven't used anything as a glue language before.

DynamicSquid (2673)

@Jakman oh sure I guess, I can help

nt998302 (173)

How did you do this? The file is heavily encrypted lol

DynamicSquid (2673)

@nt998302 oh, that's an .exe file. the actual code can be found on GitHub: https://github.com/DynamicSquid/Night

[deleted]

guys upvote this its purely amazing

CodeLongAndPros (957)

This feels like BAPy++L:
BASIC + Python + C++.

(Not a thing.)

DynamicSquid (2673)

@CodeLongAndPros kinda of. I tried to combine the simplicity of Python, with the type concepts of C++. notice how there is no main function/class like in C++ or Java, but it's still statically typed

CodeLongAndPros (957)

@DynamicSquid The next thing is to make it golfable.
for example:
int x = 0; == ix0

DynamicSquid (2673)

@CodeLongAndPros umm... I don't think I want to do that lol

CodingRobot12 (189)

This is a cool language. Do you want me to add this to my upcoming search engine?

PizzaisGood (29)

@DynamicSquid I can't wait to learn (or try to anyways)your new language! :)

DynamicSquid (2673)

@PizzaisGood oh thanks!! I'll also make a website and everything once I'm done

pythoder (183)

how do you create a language?!?!?!?! like say "if typed in blah, do blah?" or how do you do that?

DynamicSquid (2673)

@pythoder Well, at the most basic level, then yeah if basically if use types in this, do something. But it's way more complicated than that. You can check out the github for the complete code

WYLDYR (27)

@DynamicSquid can we get some source code and a github? this is a nice project and ive done some language design in cpp before and would love to solve some issues.

edit: my bad didnt see git

klaefee (0)

I suggest the logo could just be a simple crescent moon.