Hello friends, I know this is weird but Let me just Say it.
Is it actually possible to create a new programming Language like C++ and other. I saw Go( A language made by Google). So is it actually possible, I know it is not within my reach but if the whole team of Repl.it comes together,it is possible. Just a suggestion to start a new project. I found a few videos on YouTube and got inspired though nothing went in my head 😩
I have no idea about it just an inspiration.😃
Absolutely! In making a language, there are three main things you need to do:
- First, write a lexer, which takes a bunch of code and splits it into tokens. Your lexer might convert
a = 5to
[(a, name), (=, op), (5, val)]. This is needed so the computer can understand the code you enter.
- Then you need to write a parser, which takes a list of tokens and generates a parse tree, which is just a more organized form of the token list. The parse tree for
[(a, name), (=, op), (5, val)]might be
program [assign [a 5]]or something similar.
- Then you make either the interpreter or compiler. There are three main things to do here: one is to run the parse tree directly. Another is to compile it to a different format, like C compiles to machine code. The last one, and most common, is to compile it to bytecode, which you then execute. This is what many languages, including Lua and Python, do. Bytecode is just like machine code or something, only it is only for your language.