How To Make A True Coding Language: Part 1
h
CSharpIsGud (925)

Im making this tutorial series because almost every language i've seen posted to repl talk doesn't use parsing algorithms and I think it would be nice to see some that do. There are a couple flavors of these languages, typically they come in 2 forms
1) They use string splitting and regular expressions

Technically you can call this "parsing" or a language of some sort.
But you will very quickly discover you run into syntax limitations like having to have a separator for a lot of things.
Example:
set:var,Hello World;print:var

2) They do nothing at all but define some classes or variables

I don't know how people get away with this and then tell you to calm down when someone calmly separates what it is from what it isn't. Even when put in the best possible words as to not directly attack the repl itself.

Which is why I have decided to create a tutorial on making a programming language in hopes people start making ones that don't have the above flaws.

This tutorial is going to go bottom to top using no dependencies at all and will show creation of a lexer all the way up to the hand made recursive-descent parser!

The Lexer (or scanner, tokenizer, whatever you wish to call it)

Located in lexer.py

The other components will get their own files as they are created.

Next: https://repl.it/talk/learn/How-To-Make-A-Language-Parsing/39832

You are viewing a single comment. View All
CodeSalvageON (606)

im pretty tired of seeing fake langs on talk. they're worse than fake os's

CodeLongAndPros (1591)

@CodeSalvageON I don't think of them as OSes, more of shells.

DynamicSquid (4634)

@CodeSalvageON I think fake OS are worse

std::cout << "Booting up system. Please wait a while\n";

for (int a = 0; a < infinity; ++a)
    std::cout << a << "% loading...\n";

@CodeLongAndPros empty shells

JaydenLiu1 (35)

@CodeSalvageON Are you saying that my coding language, S-SPENSE, is fake? https://repl.it/talk/share/S-SPENSE-11/59234

CSharpIsGud (925)

@JaydenLiu1 Also yes, that's pretty much exactly what he was saying.
programmeruser was being nice when he said it was more of a shell than a language, because that's basically what it is.

if (PORTin == "pythn"):
            Python = input ("")
            if (Python == "print"):
                Print = input ("")
                print (Print)

I mean come on, look at it. This is basically all it is.

CSharpIsGud (925)

@JaydenLiu1 Python and basically every other language use parsing algorithms, not a thousand line long chain of if statements.

Why do you think people call them fake in the first place?

JaydenLiu1 (35)

@CSharpIsGud What if the creator never said it was a "real" coding language, huh? Have you thought about THAT?

JaydenLiu1 (35)

@CodeSalvageON That's kinda mean and rude at the same time...

JaydenLiu1 (35)

@CSharpIsGud I neither ever said it was real nor fake. I just said it was a coding language I developed.

CSharpIsGud (925)

@JaydenLiu1 Its either a coding language or it isn't, there is no such thing as a fake one, because it wouldn't be a language any more.

CSharpIsGud (925)

@JaydenLiu1 Exactly, you said it was, but it isn't.
What's ironic is all of the "hate" begins as a simple statement that it isn't what they said it was, the creators and people that make them are the ones that immediately get super defensive.

JaydenLiu1 (35)

@CSharpIsGud I DIDN'T SAY S-SPENSE IS A REAL CODING LANGUAGE! CAN YOU GIVE ME SOME PROOF?

JaydenLiu1 (35)

@CSharpIsGud HOW MANY TIMES DO I HAVE TO SAY THIS TO MAKE YOU LISTEN? I NEVER SAID IT WAS A CODING LANGUAGE!!!

CSharpIsGud (925)

@JaydenLiu1 DUDE SEARCH FOR PEOPLE WHO ACTUALLY MADE A LANGUAGE WITH A PARSER

READ THE CODE

a bunch of if statements isn't a language

CSharpIsGud (925)

@JaydenLiu1 S-SPENSE is a coding language I developed

CSharpIsGud (925)

@JaydenLiu1 By the way, the python interpreter that got 80 upvotes, was done in probably less than 30 seconds if they typed fast.

print(eval(input()))
The people that defended the above cycle farm are people like you who simply don't understand that you can't just make a bunch of if statements and call it a language.

JaydenLiu1 (35)

@CSharpIsGud "How to make a REAL Coding Language"

JaydenLiu1 (35)

@CSharpIsGud "Just a bunch of if statements isn't a REAL language"

JaydenLiu1 (35)

@CSharpIsGud So what? You're just being a party pooper! If it got 80 upvotes then it gets 80 upvotes!

CSharpIsGud (925)

@JaydenLiu1 Now stop filling my notifications with cringe. It's not worth trying to explain how print(eval(input())) is not something that should get 80 upvotes to someone who will just use every excuse possible to say how it took lots of effort and hard work to type one line of python.

CSharpIsGud (925)

@JaydenLiu1 You know what, just to make you stop filling my notifications, I will make a replica of your "language" in 30 minutes or less.

JaydenLiu1 (35)

@CSharpIsGud Okay fine you are just gonna copy code from S-SPENSE and paste it onto your project

CSharpIsGud (925)

@JaydenLiu1 Nope, completely from scratch. its just a bunch of if statements. I might even have time to spare to add in some extra things too because it isn't that difficult.

CSharpIsGud (925)

@JaydenLiu1 It's just if say in command, its not like you can do math equations or anything like that without pythons help.

Even basic bash(echo "Hello World!") does more parsing than that.

CSharpIsGud (925)

@JaydenLiu1 https://repl.it/@CSharpIsGud/S-SPENSE Done.
Removed a lot of redundant code, added an if statement to add two numbers and still could do more with 6 minutes to spare.

JaydenLiu1 (35)

@CSharpIsGud Can't I just create a function that does that? Wait, that won't help.

JaydenLiu1 (35)

@CodeSalvageON "im pretty tired of seeing fake langs on talk. they're worse than fake os's"

CodeSalvageON (606)

@JaydenLiu1 yes, they are. Fake languages suck, and they really suckkkkkkkk

JaydenLiu1 (35)

@CodeSalvageON "yes, they are. Fake languages suck, and they really suckkkkkkkk"

CodeSalvageON (606)

@JaydenLiu1 yeah they’re legit just a bunch of crappy functions, nothing of value there

JaydenLiu1 (35)

@CodeSalvageON "yeah they’re legit just a bunch of crappy functions, nothing of value there"

CodeSalvageON (606)

@JaydenLiu1 yep, stuff like that is completely useless, people who make that stuff should learn how to use lexers and parsers lol

JaydenLiu1 (35)

@CodeSalvageON "yep, stuff like that is completely useless, people who make that stuff should learn how to use lexers and parsers lol"

CodeSalvageON (606)

@JaydenLiu1 fake langs are insipid and delusional

JaydenLiu1 (35)

@CodeSalvageON "fake langs are insipid and delusional"

CodeSalvageON (606)

@JaydenLiu1 good you're finally self aware

JaydenLiu1 (35)

@CodeSalvageON "good you're finally self aware" No I'm not I'm quoting you because you're annoying

CSharpIsGud (925)

@JaydenLiu1 So many pings from here.

Also, you are really only harming yourself by quoting him.
Some of his sentences might go a little overboard but its basically how things are.

If I didn't care about being swarmed by everyone who believes it takes a lot of effort to make a few if statements in a file I would also put the truth in as blunt words as possible.

It's just that it isn't worth doing that because none of them seem to be able to soak in that everyone that isn't one of those people would rather go enjoy the fully working javascript interpreter next door that took more than a day to give basic functionality.

CodeSalvageON (606)

@JaydenLiu1 ok u still aint self aware, have fun with ur fried logic boards

CSharpIsGud (925)

@JaydenLiu1 Typically if you actually call out said things as not being what they said they are they will go crazy.
There are plenty of things they may or may not reply with but I can think of some probable ones and their counterparts:
"Dude, chill" ('chilling' is not necessary when you are already 'chill')
"Hater" (This defeats itself.)
Special: "I diDn'T sAy iT wAs A rEAl C0diNG lAnGuAGE!" ('coding language' implies that it is a coding language)
"It took a lot of effort for him to make that" (If it did, you wouldn't be commenting about how it can be done in less than 10-30 minutes)
"Stop." (If they can't actually think of any reason you shouldn't call out how easy it is to do what they did)
+

JaydenLiu1 (35)

@CSharpIsGud ""Stop." (If they can't actually think of any reason you shouldn't call out how easy it is to do what they did)" Basically that implies you because you said "I can code S-SPENSE 1.1 in less than 30 minutes it's as easy as that"

CSharpIsGud (925)

@JaydenLiu1 Uh yeah, and what did I do literally as soon as I said that?

Made it in less than 30 minutes, because it is as easy as that.

Whippingdot (565)

@JaydenLiu1 is defeated. 0 lives left. Da-da-dun-dun-du-dun-dun-dun.