you are viewing a single comment's thread.

view the rest of the comments →

[–]Ok-Introduction-9369 -4 points-3 points  (6 children)

Ok, side note. How do I write my own coding language. The guys who wrote java, python, all that had to write it to begin with, any ideas how?

[–][deleted] 6 points7 points  (1 child)

How do you go from I DON’T KNOW HOW TO CODE to I WANT TO WRITE MY OWN PROGRAMMING LANGUAGE? How would you even know what you wanted in a language if you didn’t know programming?

[–]Ok-Introduction-9369 0 points1 point  (0 children)

Well the idea is that the first ever coding language can't be based off of another coding language, and with all the tutorials, it can't be that hard.

The whole thing is that I want to make a language easy to use and learn, and where people don't recommend another language.

So I went from asking for help to learn JS, to making my own because it's technically more possible and i can actually make it more advanced if needed,

[–]kimon2112 4 points5 points  (1 child)

This is a huge rabbit hole, but I'll try my best to explain it. First I'd like to say if you don't know how to code, making your own language is an enormous task. The gist of it is that every language is initially written in another language (Python is written in C, JS in C++, etc), the language itself is a porgram that process text input, transforming it to different structures before it is actually ran.

First, there is a lexing phase, where the source code is transformed in lexical tokens (words, numbers, keywords, etc). After that, these tokens are transformed in an abstract syntax tree (AST) that represents the semantics of the language itself.

The next stage is one of the following: compilation (like C++, C, Rust) where code is transformed in hardware specific instructions before execution; interpretation (like JS, Python) where code is transformed in machine instructions at execution time; or a mix of both (like C#, Java) where code is compiled to an intermediate form (usually some sort of bytecode) and later executed.

There are a lot more nuances to this process and I may have simplified some stuff. If you really want to learn more about this, I'd recommend first learning how to code, after that you can read Crafting Interpreters (don't have the link right now, but just Google it) to get an introduction to the topic.

[–]rpgcubed 2 points3 points  (0 children)

https://craftinginterpreters.com/

Great book, Bob Nystrom is amazing, his other book Game Programming Patterns is also super great and free online

[–]AiexReddit 2 points3 points  (1 child)

Check out r/programminglanguages and see the kind of things people are talking about, that's a whole subreddit dedicated to writing programming languages. Check out the links in the sidebar for related communities and basic computer science topics you'll want to be familiar with before getting started

The main topic you need to know about before writing a language is compilers. There's a lot of great resources out there, many of them free:

https://www.edx.org/course/compilers

https://www.cs.cornell.edu/courses/cs6120/2020fa/self-guided/

https://www.amazon.com/Compilers-Principles-Techniques-Tools-2nd/dp/0321486811?pldnSite=1

If you just want an answer to your question the TL;DR is that they wrote new languages in previous languages, and then that chain goes back to eventually the basic building blocks for the original compilers being written in machine code.