+ 4

how to create a programming language with c ++?

how can I create a new language with c ++?

3rd Mar 2018, 12:27 AM
Alexandre Kawan
Alexandre Kawan - avatar
3 Answers
+ 5
As @Jan Markus said, step 1: Finish the course. You will need all of the knowledge you gain from the course and also some from cplusplus.com to be able to design even a simple language. It is no easy task. Step 2: Design the architecture of the language. (Optional) This is the fundamental structure and organization of all of the data. It is not as important in high level languages like Python. If you don’t do this now, you will likely need to make at least a simple one as your language grows. Step 3: Design the language itself. Make a language with whatever syntax you want, and make sure it follows the rules set by the architecture you may have made in the previous step. Now, you should be able to write a program on paper or in Notepad for this language, but you have no way to run it. Step 4: Add your program’s syntax to Notepad++. (Optional) Notepad++ is a program similar to Notepad, but it highlights keywords and some syntax in many programming languages. You can even define your own. Notepad++ is completely free and will make reading your code easier when you are testing. Step 5: Time to choose how it will be run. You can choose to make a compiler or an interpreter. A compiler takes all of the code as input and translates it to a lower level language. This process repeats until it is machine code. Compiled languages usually run much faster than interpreted languages, but a compiler is more complicated than an interpreter. An interpreter reads one, executes what that line is trying to do, and moves on to the next line. Interpreters are often safer than compilers because instead of interacting directly with the computer, the language interacts with a program you created and you can then prevent it from being capable of any harm. Step 7: Create this program. The explanation is in the step above, you should be able to do it with difficulty after step 1. Resources: • stackoverflow.com • cplusplus.com • cppreference.com Anyone feel free to add to this list. You now have your own language.
3rd Mar 2018, 1:04 AM
Jacob Pembleton
Jacob Pembleton - avatar
+ 15
wow, what a question and very interesting answers 👍😉
3rd Mar 2018, 5:37 AM
tooselfish
tooselfish - avatar
+ 1
@Jan Markus I’m currently in the process of creating my own language just as a challenge. You could just make a library in an existing language, but let’s be honest, creating a new one is much more fun.
3rd Mar 2018, 1:14 AM
Jacob Pembleton
Jacob Pembleton - avatar