Russian language in programming
This article provides my brief overview of some programming languages and solutions that allow you to program in Russian.
Language 1C: Enterprises
Despite the fact that this is the most popular programming language with Russian-language syntax, I will not consider it, so as not to breed holivar. For a similar reason, I will not consider
and
(although the latter is an independent programming language, its syntax is based on the built-in 1C: Enterprise language).
1C: Performer
Some strange mix of C#
[с его Console.Write()
]
Java
[var obj = new Object()
]
and probably
Julia[с ;
вместо end
]
.
Also, apparently, the developers of 1C: Performer inspired by Scala/Kotlinby selecting a keyword знч
for immutable variables. IMHO, the word пост
would fit betterконст
already taken).
In addition, poorly chosen keywords попытка
, поймать
, выбросить
.
Keyword selection метод
\method
to declare functions also raises questions.
However, there are also good solutions that do not raise questions. For example, creating an array by writing [1, 2, 3]
sets record {1, 2, 3}
and matching (i.e. “dictionary”) record {"a": 1, "b": 2}
. Just like in Python.
But in general, the language is suitable only for a very limited range of tasks, and its practical value is still in question.
Idol
Already based on the name (Kit
Educational
MIRov) it is clear that the scope of this language is limited to teaching. And this, in my opinion, is a dead end. Few people want to seriously learn a language that, apart from learning to program, is not suitable / not used for anything.
However, some ideas and decisions made in KuMir can be borrowed. For example, the fact that the mathematical functions in it abandoned in English (sqrt, sin, abs, min, max, etc.). And I think it’s completely justified. In math class, we write sin x and nothing.
C++ compiler from Interstron
Russification of C++ service/keywords
made by the author of the legendary article
Evgeny Zuev.
Evgeny did a great job, but this is the main problem: there are too many translated words, and their specificity is such that it is too difficult for them to remember the Russian equivalent.
Verb
Problem
in that it is based on an unpopular language
[Oberon-2]
and also uses rather unconventional terminology, for example:
- “kind”, not “type”;
- “row”, not “array”;
- “task”, not “procedure”/”function”;
- “department”, not “module”;
- “cell”, not “byte”;
- “sign”, not “symbol”;
- “ring”, not “cycle”/”repeat”.
In this regard, I agree with Yuri
[автором сайта compiler.su]
:
ruscomp.bb24.ru/viewtopic.php?id=20#p411:
That is, ordinary Russian words are no longer a “common” language for you?
Common ones are those that I read in books, including those on programming. When I read “byte”, everything is clear to me. This is generally accepted. When I read “40 syllables in size” – I will think for a long time. But “a file of 40 bytes in size” is immediately clear to me, and to you too. Yes, there are borrowed words, but I did not borrow them and I did not deeply introduce them into our language. To be understood, I have to use them.
RuSL
(Russian Scripting Language) is a new scripting programming language with syntax in Russian. After a cursory acquaintance with the language, I have identified several
[возможно субъективных]
disadvantages:
- An unconventional keyword is used to declare variables
изм
. - No support for integers (all numbers are real).
- Assignment operators
+=
,-=
etc. are recorded in reverse order (i.e.=+
,=-
etc.). It’s especially fun to recordn=-n
which does not work liken = -n
but asn-=n
i.e.n = n - n
:)(: - For standard functions
input()
andprint()
translation was chosenввести()
andвывести()
instead of the more usualввод()
andвывод()
.
11l
Semantics
takes as a basis the Python language (the most popular programming language at the moment
[согласно рейтингам TIOBE, PYPL, IEEE Spectrum]
), and the syntax is designed / designed taking into account the cognitive-ergonomic approach in such a way that it can be forgotten
[синтаксис 11l]
almost impossible (especially if it’s the first programming language you learn).
To translate the method name map
in 11l the word was chosen применить
because as said on wikipedia “in functional form map
often called “apply-to-all”“.
pyneng.readthedocs.io/ru/latest/book/10_useful_functions/map.html:
map function applies function to each element of the sequence and returns an iterator with the results.
Using the map function in Python:
Function built into Pythonmap()
is used for applications functions to each element of the iterable object
pythonist.ru/python-map-dating:
map() iterates over the elements of an iterable array (or collection) and returns a new array (or iterable) that is the result applications conversion functions to each element
The word used to throw an exception in 11l is
исключение
by analogy with keyword translation
throw
Evgeny Zuev. Key subwords
исключение.контроль
and
исключение.перехват
also taken from Zuev’s translation.
For numeric types, quite generally accepted ones (accepted, including in the language) are used. RAYA) names Цел
and Вещ
.
Instead of translating each and every feature of the language’s standard library, 11l only translates the features of the language that are required to solve sports programming problems. We can say that the very essence of Russian-language names in 11l is to single out a subset of the language that is sufficient to solve problems in sports programming.
A task
(based
):
цикл 1..Цел(ввод())
пер n = Цел(ввод())
пер a = ввод().разделить(‘ ’).применить(Цел)
пер ответ = (0 .< n).применить(н -> н + 1) // можно сократить до `пер ответ = Массив(1..n)`
если a.послед == 0
вывод_эл(ответ [+] (n + 1))
иначе
цикл(н) 0 .< a.длина
если a[н] == 1
вывод_эл(ответ[0.<н] [+] (n + 1) [+] ответ[н..])
цикл.прервать
A task
(based
):
цикл 1..Цел(ввод())
пер s = ввод()
пер t = ввод()
s = сортй(Массив(s)).соединить(‘’)
если t == ‘abc’ & (‘a’ св s) & (‘b’ св s) & (‘c’ св s)
s = s[0 .< s.найти_и(‘b’)]‘’(‘c’ * s.колво(‘c’))‘’(‘b’ * s.колво(‘b’))‘’s[s.об_найти_и(‘c’) + 1 ..]
вывод(s)
A task
(based
):
цикл 1..Цел(ввод())
пер s = ввод()
пер m = Цел(ввод())
пер b = ввод().разделить(‘ ’).применить(Цел)
пер массив = сортй(Массив(Множество(Массив(s))))
пер ответ = [Символ("\0")] * m // как в Python (1-ый вариант решения)
//пер ответ = "\0" * m // только в 11l (2-ой вариант решения)
цикл сумма(b) != -m
Множество[Цел] индексы
цикл(i) 0 .< m
если b[i] == 0
индексы.доб(i)
b[i] = -1
цикл
пер q = массив.извлечь()
если индексы.длина <= s.колво(q)
цикл(i) индексы
ответ[i] = q // в 11l строки можно изменять
цикл.прервать
цикл(i) индексы
цикл(j) 0 .< m
если b[j] != -1
b[j] -= abs(i - j)
вывод(ответ.соединить(‘’)) // (1-ый вариант решения)
//вывод(ответ) // (2-ой вариант решения)
In addition, 11l comes with a script that translates Russian code into English code (including the translation of commonly used variable names).
Despite the support of Russian keywords, function names and types, I believe that in most cases it is advisable to write the names of short variables in English.
So accepted in the educational algorithmic language:
ввод n; S:=0
And also in Russian texts of programming tasks English/Latin letters are used:
codeforces.com/contest/1559/problem/C?locale=ru:
The first line contains one integer t …
The first line of the input contains one integer n
And similarly in the books:
That’s all for me. Thank you for your attention.