From Decimal Wiki
Jump to navigation Jump to search

Programming language

The programming language is a set of formal rules by which programs are written.

The programming language has two aspects:
  • syntax (rules for writing code, spelling, word order);

  • semantics (idea, semantic load or purpose).

An ordinary language is needed to communicate with people, and a programming language is needed to communicate with a computer. As in any natural language, computer languages have vocabulary and semantics, but since they are much simpler than human ones, grammar is not in the first place, but syntax and word formation are important. And for the concept of "meaning" programmers use the word "semantics".

The difference between programming languages and algorithms

Programs are needed in order for the machine to do something useful. This is impossible if there is no clear algorithm — the order of actions and rules for doing something useful.

The algorithm works like a route in the navigator: ""From point A we go to point B, turn in 150 meters"" . An Englishman understands it in English, a Chinese understands it in Chinese, and you and I understand it in Russian. The languages are different, but the procedure is the same: "'everyone has to get to the right place.

Any program starts with an algorithm, but it may look different in different languages.

How a computer understands different programming languages

The programming language is not the language of the computer. The machine understands sequences of zeros and ones: there is a voltage in the circuit — one, no — zero. Therefore, any program must first be translated into a set of such machine commands.

There are two tools for this — the compiler and the interpreter. The first one works like a translation agency: you give him the entire text of the program, and he turns it into executable code, a set of commands for the processor. The interpreter is more like a simultaneous interpreter: they said the phrase — the synchronist quickly translated it, and the computer executed it.

Compilers and interpreters contain complex sets of rules for turning a programming language into machine code understandable to a computer. These are also programs. They are written by the creators of a new language — in some other, already existing one. For example, the Python interpreter is written in C, and C itself is written in assembler, almost machine code.

Why do we need new programming languages?

There are already several thousand programming languages, but new ones are still being created. This is usually done to solve some specific tasks or in case of inconvenience of using an existing language.

Languages live as long as people use programs written in them.

Programming languages in DecimalChain

For correct compatibility with the Cosmos SDK and Tendermint, the programming language "'Golang."' is used as a programming language for implementing Decimal functionality, namely the software of masternodes (validators).

To write backend modules, we chose "TypeScript", which is strictly typed and convenient in the development process, as well as compiled in JavaScript, executed in modern browsers and compatible with NodeJS. In particular, Workers and Indexer are written in TypeScript.

To implement desktop wallet applications, the Decimal team used "ElectronJS," which allows creating cross-platform desktop applications based on JavaScript, HTML and CSS.