How To Make A True Coding Language: Part 1
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.
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.
You do know that there is more than one way to make a programming language, right? Your type one
not programming languages are actually programming languages, just without as many powerful functions. For example, you could create a LOLCODE interpreter using split functions and regular expressions and LOLCODE is a programming language. It's not the most useful, but still a language. Same with Forth which is even easier to create an interpreter for. Then, the type two "not programming languages" really aren't programming languages and just created dialects for known languages. However, Clojure is a dialect of Lisp and is considered a separate language, so why couldn't some of what you call "not programming languages" actually be programming languages? For example, the in-development THAIL programming language is really a dialect of Adapt (my programming language which is also in development). Also, please stop arguing with everyone about the things you call "fake". There is still hard work put into it, just maybe not as much as a real OS or full interpreted/compiled programming language.
@CSharpIsGud That's it, it ends there. Interfaces are for type checking, types are for type checking, what it calls "function overloading" is the stupidest implementation of function overloading I've ever seen, is just for type checking, templates are just for type checking.
All it is, is JS with types.
Dart has types too, and a whole different syntax, but there's more that syntax and types that make a language unique. Until TS really branches off from JS, it's still just a dialect. It doesn't add anything new.
Whereas, like I said before, Dart has a whole browser dedicated to running it, parsing it, etc. Look at TypeScript, Deno, one of the only TypeScript run-times that I've heard of, barely came out a few months ago.
@CSharpIsGud TypeScript has room for improvement, let's look at it's function overloading, it just sets up a pattern of types that a function can accept.
Yet, if it's compiled, can't the TS compiler rename the functions before compiling and separate them? I'm sure it could! I can, and I'm sure you can too, so why can't Mircosoft? It wouldn't matter to the developer, since it should all become minified anyways.
@AmazingMech2418 I agree about this. @CSharpisGud thinks that his way is right and that his way is the way to make a "real" coding language. There are plenty of ways to do something. It's common sense, @CSharpIsGud, that people have different beliefs and stuff! Right now you, @CSharpIsGud is just being a legit party pooper.
@JaydenLiu1 Look, I'm done replying to ignorance. I never said my way is the right way, I said that they should use an actual algorithm instead of faking it with if statements.
There are plenty of parsing algorithms you can use that aren't what I use.
You can act like a chain of if statements is a language all you want, I don't really care(but it still makes me cringe, and I'm being literal with that statement).
Do you know why none of these if statement languages made it into the pl jam? Yeah, I think you do.
It's straight up useless trying to explain to how doing a bunch of if statements or classes in python isn't a language to people that make them because they are always ignorant and grasp at every straw they can to defend their "project" that took them 5 minutes and takes less time for people to get bored of it and not look back.
From calling anything that opposes them "hate" to blindly praising everyone who shares the same narrow mindset.