Creation of programming languages โ€‹โ€‹and design of compilers. Are they related?

Well, I think this question has been asked many times here.

I want to create a programming language, not necessarily starting today, but within 2-3 years. I'm not a very good programmer, but I'm improving. I wanted to ask how closely the language is created and the compiler written?

Since the compiler translates a language from one form to another, I think it's all about writing a compiler for a specific piece of text. SO, if I study compiler design, can I write my own programming language?

+7
programming-languages compiler-design
source share
4 answers

You can create a programming language without knowing anything about implementing compilers, and vice versa. The language designer can write a specification for the language, and the compiler developer can then accept it and create the compiler.

However, if this is a personal project, you may have to learn to do both. A programming language for which there is no compiler is purely theoretical, and it is difficult to understand how good a programming language is without writing and executing real programs with it. Even if you find someone who wants to implement a compiler for you, you may not want to wait for this person every time you have a new idea to try, so you will want to know how to do it yourself.

The implementation of the compiler is a fairly advanced software project, so if you are just starting to program, you have a steep learning curve ahead. You can start by studying tutorials and examples for LLVM , although in reality this may not be the appropriate compiler infrastructure for your language.

+4
source share

Naruto, it depends on what type of "Language" you want to create. If it is simple, itโ€™s easy to learn the language, and you choose grammar, etc. Etc., you do not need to know much about programming. BUT, if you are going to deal with the serious, you will have to learn at least one programming language to not only use it, but also try to reach several of its concepts, for example, OO, generics, lambda expressions, etc. etc.

Believe me, this is not the task of the months, but a serious journey. In any case, I wish you good luck;)

+2
source share

Closely connected. You really don't have a language unless you can interpret / compile it into an executable form.

+2
source share

It depends on what you mean by โ€œcompilerโ€. Compilers / translators usually consist of two large parts: the analyzer part, which reads the text in your language and builds an internal structure (AST) from it, and the code generation / interpretation part, which reads the AST and translates it to the machine or byte codes. Although you will definitely need to know how to write a parser for your language, code generation is less important, at least in the early stages. You can start by simply translating your language into C and see where you are going from there.

+1
source share

All Articles