I
I
Ivan Balashov2020-08-18 11:04:38
Programming
Ivan Balashov, 2020-08-18 11:04:38

How to write a programming language?

Is it possible to write a programming language in Flat Assembler to create applications with a compiler, a simple syntax.
"One water" flies on the Internet, and I would like to receive a detailed answer to this question with links to useful articles on this topic

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
Griboks, 2020-08-18
@vanoren

A detailed answer will take many books, so briefly ...
Languages ​​come in two types: compiled and interpreted.
The complexity of creating the former lies in translating a high-level abstraction into low-level code (+ memory management and other complex things). The easiest approach is to come up with your own syntax, which you can translate into some C++ or C#, and then use the standard language tools for compilation.
But I recommend that you make an interpreted language (with Script postage). In this case, you can simply process commands like if cmd='add' then return a+b
A sequentially if you don't want to understand all this, then it's better to use a parser/compiler generator. Then write in your language a compiler for your language (bootstrapping) to get an independent compiler.
PS
Your question about assembler is not clear. Do you want to write a parser and compiler in assembler, or do you want to translate your language into assembler? Or an assembler interpreter? The lower the level, the more options.

G
GavriKos, 2020-08-18
@GavriKos

https://tproger.ru/books/compiler-design-books/
Start here

R
Ronald McDonald, 2020-08-18
@Zoominger

It is possible, but impossible.
Even creating a compiler for an already existing language takes years for teams of professionals, while the team includes excellent specialists in various fields.
As I understand it, you want to make a translator from your language to Assembler? Even for a simple language, the task will be extremely difficult if the language is, of course, Turing-complete.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question