Programming language: Difference between revisions

From Decimal Wiki
Jump to navigation Jump to search
[checked revision][checked revision]
No edit summary
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{#seo:
{{#seo:
                     |title= Язык программирования
                     |title= Programming language — Decimal Wiki
                     |titlemode= append  
                     |titlemode= append  
                     |keywords= Язык программирования
                     |keywords= Programming language
                     |description= Язык программирования
                     |description= Programming language
                     }}
                     }}
<div class="mikio-article-content">
'''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 meter". An Englishman understands it in English, a Chinese understands it in Chinese. 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 [[wikipedia:Golang|Golang]]. is used as a programming language for implementing [[DecimalChain]] functionality, namely the [[software]] of [[masternode]]s ([[validator]]s).
To write backend modules, we chose [[wikipedia:TypeScript|TypeScript]], which is strictly typed and convenient in the development process, as well as compiled in [[wikipedia:JavaScript|JavaScript]], executed in modern browsers and compatible with [[wikipedia:NodeJS|NodeJS]]. In particular, Workers and Indexer are written in TypeScript.
To implement desktop wallet [[application]]s, the Decimal team used [[wikipedia:ElectronJS|ElectronJS]], which allows creating [[cross-platform application|cross-platform desktop applications]] based on [[wikipedia:JavaScript|JavaScript]], [[wikipedia:HTML|HTML]], and [[wikipedia:CSS|CSS]].


<div class="mikio-tags">
[[Category:Commoninfo]]
 
[[Category:Software]]
 
 
</div>
<span id="jazyk_programmirovanija"></span>
= Язык программирования =
 
<div class="level1">
 
'''Язык программирования''' — это набор формальных правил, по которым пишут программы.
 
 
</div>
<span id="u_jazyka_programmirovanija_est_dva_aspekta"></span>
===== У языка программирования есть два аспекта: =====
 
<div class="level5">
 
<ul>
<li><div class="li">
 
синтаксис (правила написания кода, правописание, порядок слов);
 
</div></li>
<li><div class="li">
 
семантика (идея, смысловая нагрузка или назначение).
 
</div></li></ul>
 
Обычный язык нужен для общения с людьми, а язык программирования — для общения с компьютером. Как и в любом естественном языке, у компьютерных есть лексика и семантика, но, поскольку они намного проще, чем человеческие, грамматика у них не на первом месте, но синтаксис и словообразование важны. А для для понятия «смысл» программисты используют слово «семантика».
 
 
</div>
<span id="otlichie_jazykov_programmirovanija_ot_algoritmov"></span>
= Отличие языков программирования от алгоритмов =
 
<div class="level1">
 
Программы нужны для того, чтобы машина сделала что-то полезное. Это невозможно, если нет чёткого алгоритма — порядка действий и правил выполнения чего-то полезного.
 
Алгоритм работает как маршрут в навигаторе: ''«Из пункта А едем в пункт Б, поворот через 150 метров»'' . Англичанин понимает его по-английски, китаец — по-китайски, а мы с вами — по-русски. Языки разные, а порядок действий один: '''все должны добраться до нужного места.'''
 
'''Любая программа начинается с алгоритма, но на разных языках это может выглядеть по-разному.'''
 
 
</div>
<span id="kak_kompjuter_ponimaet_raznye_jazyki_programmirovanija"></span>
= Как компьютер понимает разные языки программирования =
 
<div class="level1">
 
'''Язык программирования''' — это '''не''' язык компьютера. Машина понимает последовательности нулей и единичек: есть напряжение в цепи — единица, нет — ноль. Поэтому любую программу сначала надо перевести в набор таких машинных команд.
 
Для этого есть два инструмента — '''компилятор''' и '''интерпретатор.''' Первый работает как бюро переводов: вы отдаёте ему весь текст программы, а он превращает его в исполняемый код, набор команд для процессора. Интерпретатор же больше похож на переводчика-синхрониста: сказали фразу — синхронист быстро её перевёл, а компьютер выполнил.
 
Внутри компиляторов и интерпретаторов — сложные наборы правил по превращению языка программирования в машинный код, понятный компьютеру. Это тоже программы. Их пишут создатели нового языка — на каком-то другом, уже существующем. Например, интерпретатор Python написан на C, а сам C — на ассемблере, практически машинном коде.
 
 
</div>
<span id="zachem_nuzhny_novye_jazyki_programmirovanija"></span>
= Зачем нужны новые языки программирования? =
 
<div class="level1">
 
Существует уже несколько тысяч языков программирования, но всё равно продолжают создаваться новые. Обычно это делается для решения каких-то конкретных задач или в случае неудобства использования имеющегося языка.
 
Языки живут, пока люди пользуются написанными на них программами.
 
 
</div>
<span id="jazyki_programmirovanija_v_decimalchain"></span>
= Языки программирования в DecimalChain =
 
<div class="level1">
 
Для корректной совместимости с Cosmos SDK и Tendermint в качестве языка программирования для реализации функционала Decimal, а именно программного обеспечения мастернод (валидаторов), использован язык рограмирования '''Golang.'''
 
Для написания бэкенд-модулей мы выбрали '''TypeScript''' , который строго типизирован и удобен в процессе разработки, а также компилируется в JavaScript, исполняется в современных браузерах и совместим с NodeJS. В частности, на TypeScript написаны воркеры (Workers) и индексер (Indexer).
 
Для реализации десктоп-приложений кошельков команда Decimal использовала '''ElectronJS,''' который позволяет на основе JavaScript, HTML и CSS создавать кроссплатформенные десктоп-приложения.
 
 
 
</div>
<div style="clear:both">
 
 
 
</div>
 
</div>
[[Category:Commoninfo]]

Latest revision as of 11:12, 15 February 2024

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 meter". An Englishman understands it in English, a Chinese understands it in Chinese. 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 DecimalChain 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.