A
A
Alexey Igoshev2015-03-10 20:14:17
Programming languages
Alexey Igoshev, 2015-03-10 20:14:17

How are programming languages ​​made?

I would like to know how programming languages ​​are developed? As for C / C ++, everything is clear, in Assembler, and how about others? For example, JavaScript or I would especially like to know about HTML, really in C / C ++, because it has nothing to do with it

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey, 2015-03-10
@begemot_sun

In C\C++, an automaton is developed that reads the input source stream and generates an abstract syntax tree of the source code. Then it goes through certain transformations, and the output will be a program for the interpreter or a program in machine codes or a program for a virtual machine (for displaying in particular HTML).
Developing such a tool in C\C++ or something else is not difficult. Because they are all Turing-complete languages. Those. all the algorithms that you can implement within these languages ​​can be implemented by the simplest Turing machine.

M
Mintormo, 2015-03-11
@Mintormo

First, the language is invented. Decide for what tasks it is needed. Then they write a compiler program that converts the source language text into a set of instructions (processor machine code, virtual machine bytecode). This is how Java, C, C++, Rust, Assembler are implemented. Languages ​​can also be interpreted: that is, instead of a compiler program, we write an interpreter program that, unlike a compiler, immediately executes the parsed program. This is how HTML and CSS are implemented, for example. The browser has a built-in HTML interpreter that reads the page code and draws it on the screen. There are also mixed schemes, when the source code is parsed by the interpreter and immediately converted into the machine code of the processor to increase the execution speed (JIT compiler). This is how JavaScript is implemented.

M
Mikhail Potanin, 2015-03-11
@potan

The task of the compiler is to read the text in the programming language and output an executable file or a file with an intermediate representation (for example, assembly language text) that can be executed by previously written programs.
There is no black magic in this.
The first compiler, of course, had to be written in assembler. But the following can already be written on existing ones. Including a compiler from a certain language, you can write in the same language using the previous version of the compiler.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question