background top icon
background center wave icon
background filled rhombus icon
background two lines icon
background stroke rhombus icon

Download "// Алгоритмизация #9 // Язык программирования //"

input logo icon
Table of contents
|

Table of contents

0:00
Введение
8:23
Интерфейс программы
23:28
Начало написания
32:28
Функция readtall_src (интерфейсная функция)
44:28
Функция _parse_code (главная функция анализа кода)
57:37
Функция _include_instrc (подгрузка файлов расширения .all)
1:02:12
Функция _load_instrc (подгрузка файлов расширения .vms)
1:03:30
Функция _define_instrc (создание функций в языке all)
1:20:24
Функция _proc_instrc (чтение выражений в языке all)
1:35:44
Функция _if_instrc (условное выражение в языке all)
1:44:20
Исправление ошибок компиляции
1:47:30
Создание функции сложения
1:54:24
Создание функции умножения методом сложения, добавление функции вычитания
1:56:30
Создание функций условия на равенство
1:59:18
Исправление ошибок в функциях _if_instrc и _define_instrc
2:01:08
Перенос функции умножения на низкоуровневый код
2:02:02
Добавление функций деления, равенства, возвращения функций
2:04:10
Пример функций высшего порядка
2:07:11
Создание логических функций and, or, not, xor
2:15:15
Создание функций mod, even, odd
2:18:54
Создание функции возведения в степень
2:21:30
Создание функций neg, max, min, (больше или равно), (меньше или равно)
2:28:00
Функция вычисления факториала
2:29:20
Оптимизация факториала
2:31:18
Функция вычисления чисел фибоначчи
2:33:15
Завершение
Video tags
|

Video tags

язык программирования
programming language
программирование
programming
реализация
lisp
си
создание
Subtitles
|

Subtitles

subtitles menu arrow
  • ruRussian
Download
00:00:02
on algorithmization
00:00:03
In this video we will try to implement
00:00:05
high level I language and use
00:00:06
standard language tools
00:00:07
C programming and accordingly
00:00:10
At this stage we need to understand
00:00:11
what are we going to move that is what
00:00:13
will be our programming language and in
00:00:15
Secondly, we need to understand what
00:00:17
we should already have initial knowledge
00:00:20
be well, let's start with the second one
00:00:22
accordingly what initial
00:00:23
knowledge we must first have this
00:00:25
C programming language or its basics
00:00:27
basics
00:00:28
so that you simply understand the code you
00:00:30
you write were able to analyze it
00:00:32
read and implement later
00:00:34
himself
00:00:35
next second second thing we need
00:00:38
this is a ton more than it will hold here
00:00:40
future programming language in this
00:00:42
case it will stay on virtual
00:00:45
car, that is, he will not appear
00:00:47
compile purely and it will not be
00:00:49
purely interpreted language
00:00:51
programming that is, what it will be
00:00:53
do it will be broadcast on
00:00:56
assembler on and representation of virtual
00:00:58
machines followed by a virtual machine
00:01:00
will compile this assembler into and
00:01:02
representation into your byte code and
00:01:05
later this byte code will already be
00:01:08
capable accepted by the virtual machine and
00:01:10
This is how our language is read
00:01:13
programming will have as many as three
00:01:15
stages the first stage is the broadcast then
00:01:17
there is a transition from highland language to
00:01:19
low-level second stage is
00:01:21
compilation transition from low level
00:01:24
language into machine code and the third stage is
00:01:28
direct interpretation that is
00:01:30
interpreted and machine code or
00:01:33
bytecode in this case is already needed
00:01:36
consider from some point of view
00:01:37
machine code from what point of view is it
00:01:39
byte to
00:01:40
one way or another we will need
00:01:42
virtual machines and virtual machine
00:01:45
we realized the benefit in the previous
00:01:47
video on algorithmization respectively and
00:01:49
and you can easily download everything from Github
00:01:52
I will directly leave the links in
00:01:53
description but it’s worth telling us one thing
00:01:57
this virtual machine has been modified
00:02:00
my slightly modified then are contained here
00:02:04
here lies the following firstly I
00:02:08
I just chose a dollar sign here because
00:02:10
that it was just a description of what we are
00:02:13
we use addresses but since ours
00:02:15
functions
00:02:16
more precisely our instructions lot from Torah
00:02:18
are pound are instructions
00:02:22
which work with addresses then in this
00:02:24
there is no longer any meaning as such
00:02:26
accordingly in this case I am
00:02:28
hit, yes of course stor could have done it earlier
00:02:31
load specific values ​​let's say
00:02:34
so that is, let’s say they could be here
00:02:37
some values ​​and to some area
00:02:38
in memory these values ​​could be transferred
00:02:40
but nevertheless, it’s better to do it now
00:02:43
in this way, that is, so that we can
00:02:47
only work with addresses using
00:02:49
of these two instructions this is the second time
00:02:52
I did it, changed the operand, it won't work
00:02:54
that is, now the first arguments are not
00:02:56
is the last one in the list and vice versa
00:02:58
is the first that is, it is first
00:03:00
it’s more convenient for a person and secondly it’s more convenient
00:03:03
even the translator himself will be in
00:03:05
further when we will be all this
00:03:07
directly implement and
00:03:09
the third thing that has changed here is simply
00:03:12
added let's say
00:03:15
interface part that is now it
00:03:17
a completely separate application that is
00:03:19
it can work without make-up files and
00:03:22
accordingly in this case she
00:03:24
takes the following arguments, that is
00:03:26
she can accept
00:03:27
argument build that is, compile and
00:03:30
can accept the ran argument that is
00:03:32
basically run it all
00:03:34
the only change is still there
00:03:36
of course a change regarding the shitty code
00:03:40
let's just say when I was just cleaning this one
00:03:42
the most shitty code and
00:03:44
already provided the program in a better way
00:03:47
order but somehow basic
00:03:49
There are no such global changes here
00:03:51
observed
00:03:52
accordingly you can easily
00:03:53
view previous videos
00:03:56
analyze this code, go further
00:03:59
here view this already code but also
00:04:01
major changes as such in
00:04:03
principle there will not be with this part we
00:04:06
now we understand what will happen
00:04:08
introduce
00:04:10
programming language we will
00:04:12
create
00:04:13
it will be functional and even
00:04:15
not just functional but clean
00:04:17
functional programming languages
00:04:18
it will tell you what's in it
00:04:21
first there will be no such functions as input
00:04:23
output i.e. standard water flow
00:04:25
and there is no standard output stream in it
00:04:27
this will definitely be a minus, that is, we
00:04:29
we will not be able to write any acceptable text
00:04:31
no number from the keyboard and place
00:04:33
it immediately in the meaning of the language or vice versa
00:04:37
derive some meaning from language
00:04:41
directly the terminal we do this
00:04:43
we can't do it then the question is
00:04:45
appears how we can work then
00:04:47
with this language the point here is that
00:04:50
that he will appear
00:04:51
in very mathematical language the essence of it
00:04:53
lies in the fact that he will accept
00:04:55
certain input values ​​and
00:04:57
spit out certain values ​​on
00:04:59
exit that is, he will stick
00:05:01
some such concept of pure functions
00:05:03
when it doesn't exist as such
00:05:05
states accordingly do not exist
00:05:07
no variables and if does not exist
00:05:08
there are no cycles in change because
00:05:10
that cycles are based on state and that's it
00:05:15
arguments all meaning one way or another they
00:05:18
will go from function to function then
00:05:20
there will be a composition going on
00:05:22
functions and ultimately from all this
00:05:25
we will receive compositions of functions
00:05:27
the final result the question may be
00:05:30
what can we call a language?
00:05:34
programming language programming
00:05:35
if it doesn't even have cycles like us
00:05:38
Let's say we implement some function
00:05:40
Fibonacci factorial of greatest common
00:05:42
divider even if taken purely
00:05:44
mathematical functions and the point is that
00:05:46
we will use recursion recursion
00:05:48
there is an excellent option for cycles, they even
00:05:51
are in fact above the set of these
00:05:53
most cycles but here concluded in that
00:05:56
that this tea minus will even be included in
00:05:59
what we have
00:06:00
functions will not be optimized for
00:06:02
tail recursion is done for the purpose
00:06:05
in order to simplify the language itself
00:06:07
programming so that it can be
00:06:09
easier to analyze differently if we
00:06:10
created support for tail recursion
00:06:13
this language would become more complex many times over
00:06:16
this is one minus next 2 minus what
00:06:20
concluded this is what is the only one
00:06:23
in the language there will be only one data type this
00:06:25
they are 32 t, that is, a 32-bit number
00:06:28
there won't be any lines
00:06:30
no big numbers allowed and so on
00:06:33
further that is, it will be purely created on
00:06:36
based on a virtual machine which
00:06:38
only supports these 32-bit numbers
00:06:40
and nothing more
00:06:41
further functions will be in this language
00:06:45
global, that is, it will not be possible to have one
00:06:48
insert a function into another function and
00:06:50
use it as a local function
00:06:52
purely for one specific external
00:06:55
functions
00:06:56
that is, there is no such thing in this language either
00:06:57
there will be but it will be local
00:07:00
arguments
00:07:01
that is, to allow an argument x where
00:07:04
one function was not the same
00:07:07
argument x to another function that is
00:07:09
and we will be at least in this language
00:07:12
will be implemented like this
00:07:14
encapsulation or just local
00:07:17
variable local data for
00:07:20
a certain function here in principle
00:07:22
This language will have such disadvantages but
00:07:25
what are the advantages first of all?
00:07:26
minimalism because of which it
00:07:28
I tried to make it as small as possible but
00:07:31
at the same time as functional as possible, well as
00:07:34
if it weren't about a pun what is it
00:07:36
is a functional language and we
00:07:38
functional we will do next we will have
00:07:42
mathematical clarity that is, like me
00:07:44
said this before
00:07:45
this language will adhere to the concept
00:07:47
pure functions and the third plus is
00:07:50
we compile and there is bytecode, that is, it
00:07:52
is not purely interpretable
00:07:54
language and it is created on the basis
00:07:57
specific virtual machine and
00:07:59
accordingly, he supports in fact
00:08:02
its all the functions that exist in it
00:08:04
and accordingly the final code
00:08:08
compiled it will be obtained
00:08:10
will be more accurately reproduced where
00:08:12
faster than we interpret
00:08:15
option, basically everything is like this
00:08:18
the main criteria are the main advantages
00:08:21
We have discussed the disadvantages of this language
00:08:24
now let's start implementing
00:08:25
well first of all right away
00:08:29
let's copy the virtual machine and from
00:08:33
and let's start directly
00:08:36
develop like this here we write git clone
00:08:39
then we indicate this and copy the class
00:08:44
virtual machine directly
00:08:46
copied then go to this
00:08:47
compiling the virtual machine
00:08:50
a library first of all is a library
00:08:53
used by the virtual machine itself and
00:08:55
Next we compile this myself
00:09:01
Here's the program we're writing: Mike compiles
00:09:04
we got the result back in this case
00:09:06
the result is this factorial
00:09:08
that is, in this case it’s simple
00:09:09
provides an example of a program that
00:09:13
capable of being launched by this very
00:09:14
a virtual machine, or rather
00:09:15
compile and then run
00:09:17
here is the compiled version of it all in the end
00:09:20
we received a binary file which
00:09:22
is just this virtual
00:09:23
with a car like this, that is, in this
00:09:28
case we have two commands this
00:09:30
let's compile and run now
00:09:32
Let's copy this file g.p.
00:09:36
virtual machines from copy everything here
00:09:40
Now we need this file.
00:09:42
this is the directory we already need
00:09:45
no need, we just need this one here
00:09:47
file to compile and
00:09:48
run everything now what we do we
00:09:51
create a file
00:09:52
let's call our language as or others glorious as
00:09:57
she is for the captive HIV this language he will
00:10:01
functional and it will be, let's say,
00:10:04
be based only on expressions then
00:10:06
there will be a sheet of similar language
00:10:08
programming or will have
00:10:10
be a dialect of English so well
00:10:13
let's create a file let's say considered .
00:10:18
sen in this case he is talking about
00:10:20
what language is this?
00:10:22
programming you say that
00:10:24
this is a translator of this language
00:10:25
C programming says this
00:10:27
that the implementation of this translator
00:10:31
created in the C programming language
00:10:33
how in principle and family we all created
00:10:36
this file is now what we need
00:10:37
make this file will be exactly
00:10:40
just like in
00:10:41
families will have a virtual machine
00:10:43
interface file, that is, this file in
00:10:48
sorrows and a new form will speak of
00:10:50
then it would be more accurate to give the user well
00:10:55
let's say this is the file we need
00:10:57
necessary
00:10:59
broadcast well, let’s say the build and further
00:11:01
let's say main there. what file is it in?
00:11:04
let's say mine. Navy is basically like this
00:11:07
us this will happen let's all
00:11:10
in this case we need to write
00:11:12
use the library stage next
00:11:14
we will also need
00:11:16
shame on them to use the library
00:11:18
and we will need to use
00:11:19
with the string library we further define
00:11:23
possible errors that may occur
00:11:26
when broadcasting our program here
00:11:30
we will have these mistakes
00:11:32
6 and let's define them, that is, etc.
00:11:35
further we write mouths here as well
00:11:39
root tm here we first define that
00:11:42
that there is no error
00:11:44
then we determine what was indicated and
00:11:49
not a certain number of arguments
00:11:51
namely what is acceptable in this case
00:11:54
when we wrote let's say I thought
00:11:58
build and mine.
00:12:00
[music]
00:12:02
in this case we need a minimum
00:12:04
three arguments if there are no three arguments
00:12:07
then we get this error even for us
00:12:10
there will also be error commands in this
00:12:15
case it will arise
00:12:19
when we when was not determined
00:12:22
let's say some other team
00:12:24
we will have a team for this place next
00:12:26
more
00:12:27
be determined by i'm open error
00:12:31
this is when the file is not opened for reading
00:12:34
there is, accordingly, a more powerful file and the
00:12:36
main. it will be determined by us too
00:12:38
out open air error
00:12:40
this error will be determined if we do not
00:12:44
were able to open the touch and create a file
00:12:46
which will already be broadcast
00:12:49
file, that is, represent yourself with
00:12:52
engineering code here
00:12:54
and then the last mistake will be
00:12:56
translate.ru
00:12:58
well this error will represent
00:13:00
from oneself in fact incorrectness
00:13:04
translation of the code in this case there
00:13:07
May be there may be various errors allowed in
00:13:12
the junction was supposed to be a lot
00:13:14
values ​​one way or another
00:13:16
the virtual machine will return us an error and
00:13:18
we made this mistake in front of him as a broadcast, well
00:13:21
means very much from the virtual machine here
00:13:25
I already forgot about the virtual machine then
00:13:26
it doesn't depend it depends on itself
00:13:29
broadcasts, that is, we will allow
00:13:31
write a certain command incorrectly
00:13:33
And
00:13:36
well, let's say there you know, let's skip it
00:13:38
some bracket came out and so on
00:13:39
in the end you see this is the mistake
00:13:41
broadcasts, we figured it out
00:13:43
now we need to determine how these
00:13:48
errors will be named
00:13:50
static then we write const char
00:13:56
here we write airus errors in this case
00:14:00
this is Hernan and here we write firstly she
00:14:04
holds but it is correspondingly empty
00:14:06
line
00:14:07
then we write arc one take or queen
00:14:12
error is directly v.n. arks
00:14:15
less than 3 then we will have teams I will give birth
00:14:19
these are direct commands further in open
00:14:28
air
00:14:29
but here we just write open input file
00:14:33
further here also out put your open
00:14:37
output file and the last error is
00:14:41
broadcast translate.ru translate
00:14:45
file we all sorted it out now what do we have
00:14:49
we must first we must
00:14:51
be one interface function which
00:14:54
will be responsible for the broadcast highly
00:14:55
language level to low level in this
00:14:58
case we will write and 8 t that is the code
00:15:00
errors further read tol we will have
00:15:04
this is called but in this case source
00:15:06
0 here we write
00:15:07
where the result will be placed and from where
00:15:11
the code will be read, that is, a Russian cat
00:15:16
will we need to speak
00:15:18
implement two more functions but they will
00:15:23
And appear only for this file
00:15:25
functions and they will have the following
00:15:28
view firstly this is the translate resource function
00:15:33
it will accept names instead of threads
00:15:37
files that is const
00:15:39
further damn and here output of and far from
00:15:43
char input f and the second function it will be
00:15:49
just a representation of help, how about it
00:15:54
let's say when we describe it as virtual
00:15:56
machines in this way is strong
00:15:58
we were given this look like this
00:16:02
help info
00:16:03
we will have the same principle, let's
00:16:05
let's try to do this
00:16:07
function should return us a string and
00:16:09
she doesn't accept anything, it's all us
00:16:13
created now we need to create
00:16:16
the function we write was given to them here arks
00:16:21
then we write all these arguments const
00:16:24
then ark here we immediately return 0 and
00:16:32
here first of all we will do
00:16:35
require the charred code will equal
00:16:39
we initially have a lie
00:16:40
that is, no error was detected
00:16:44
further if the number of arguments is less
00:16:48
three then display this same error red
00:16:51
hat equals ark damn well in this case
00:16:54
in case don't kick me don't throw me
00:16:57
Are slippers something like that?
00:16:59
I'll use Klaus's head and
00:17:01
here we will indicate everything and when Klaus
00:17:05
we indicated here klaus here to us
00:17:07
it is necessary to analyze the code if red
00:17:11
hot will not equal our hero this
00:17:15
will report an error accordingly
00:17:16
Well, and accordingly we
00:17:18
output to standard stream
00:17:21
error output and here we will write
00:17:23
the next one like this and so on
00:17:26
also dreams here we write first what
00:17:32
the error was detected i.e. red hot and
00:17:35
secondly, we write help, that’s basically it
00:17:40
All
00:17:41
further we need here more
00:17:43
determine what team we need
00:17:46
arrived but in this case we just
00:17:48
do washing m.p.
00:17:51
further or kv-1 and here we compare
00:17:55
build if bells is zero then
00:17:57
we need to do the following differently
00:18:00
If
00:18:01
build was not detected then it says
00:18:03
that the command was not found let's go
00:18:07
then if the number of arguments
00:18:09
greater than or equal to 5 and that is in
00:18:15
in this case greater than or equal to five
00:18:17
this means that here let's
00:18:19
copy this says that here
00:18:23
another such argument is worth windows this is
00:18:26
there is output file & main . what kind of navy
00:18:31
it is the file that is needed
00:18:33
compare 5 arguments we have
00:18:35
and then what we do is we compare
00:18:37
washing m.p.
00:18:38
then or kv-3 and compare with minus it
00:18:44
if so then we do the following
00:18:46
action
00:18:47
that is, we call the translate function
00:18:50
become here source tags
00:18:54
source yes then we specify the file arch in 4
00:19:01
then specify the input file and here
00:19:06
let's specify the error more precisely
00:19:09
error code in red hot and here it is
00:19:14
this code is the most transferable red hot
00:19:19
this way we will compile our
00:19:21
directly the program
00:19:23
more precisely, we compile from broadcast differently
00:19:26
what do we do if this one is not specified?
00:19:29
the very argument is that it will talk about
00:19:31
what we will use
00:19:33
the standard name in this case in
00:19:35
as standard name we will make
00:19:37
main. vms then specify the file and
00:19:41
indicate the error code in this case as well
00:19:45
use the head wire ucoz everything now
00:19:48
we only need to determine these
00:19:50
two extern functions will be derived from
00:19:52
another file
00:19:54
so now in this case, come on
00:19:59
first we implement help it's easier
00:20:01
Total
00:20:02
statics further char help in this case
00:20:06
writer
00:20:07
write next write next run
00:20:12
let's get this structure in its entirety right away
00:20:14
let's take it like this, then like this
00:20:25
so let's do one two three 4 5 here 6
00:20:32
0 what will we do and this is what we will try
00:20:35
It’s more accurate to give the company right away though
00:20:41
we take this before complain and ran and write
00:20:44
we gave
00:20:46
here it will be the second action and here
00:20:48
the first action will be
00:20:50
translate trance but in this case too
00:20:54
we indicate instead of seven counted
00:20:57
and here we indicate main navs here in
00:21:00
in principle, what is not main navy e-mail floor
00:21:03
that is, as our programming language
00:21:05
everything is called with this we
00:21:08
but here, in principle, you still need dc
00:21:11
of course put it everywhere let's do it
00:21:13
let's do it and here they are everywhere like this
00:21:18
brackets brackets
00:21:23
bracket here too. , that's all for us now
00:21:26
you need to define a translate file
00:21:29
source let's try to do this and
00:21:33
here we just need to open
00:21:36
these two files are basically everything
00:21:38
input equals fill up in next
00:21:41
we indicate to them here and then we indicate
00:21:45
reading and if the path was zero
00:21:50
then return it more precisely yes here red hot
00:21:56
will equal i'm open error and
00:21:59
will return just exit from functions yes I
00:22:03
we will do exactly the same with but then
00:22:06
here we write output further here
00:22:10
out put off next here output here out
00:22:15
a pen error, then we call this one
00:22:20
function 1 equals repton source
00:22:26
send here the spider out put and send
00:22:29
here and here by the way in
00:22:32
you need to write in and now further with in
00:22:39
in this case we now need
00:22:40
close these files in claus put input and
00:22:44
then f claus output we put it and
00:22:49
accordingly we check if the rice is not
00:22:53
equals zero this indicates an error
00:22:56
that is, this function should give us
00:22:58
return 0 to fact if returned mute then
00:23:02
accordingly we have
00:23:03
rap code will be equal to translate.ru
00:23:06
Well, basically everything is like this
00:23:09
wrote the first part
00:23:11
the question is about the interface component
00:23:14
now we need to define everything
00:23:17
this very function and let's do it
00:23:19
let's try to do it in this case for
00:23:21
we already have definitions of this function
00:23:23
you need to create a separate file
00:23:25
which will be broadcast like this
00:23:29
go here and create a file under
00:23:32
Let's say the name is ride at all.
00:23:36
everything is like this and so on
00:23:40
what we're doing here first of all let's get started
00:23:42
let's connect all the libraries we
00:23:44
we will use these otherwise this
00:23:46
first stage library next this
00:23:48
library etc.
00:23:49
int is then a library for working with
00:23:51
in strings this is a library
00:23:54
count . we will need more
00:23:58
one let's say third-party library
00:24:00
you can call it so let's do it
00:24:02
let's try to create a folder here x silver
00:24:06
we'll write here and we need it
00:24:08
copy this stack, that is, the stack.
00:24:11
systick. let's go on and on
00:24:13
let's try to do it right away
00:24:15
go to Vertova machines further exquisit
00:24:18
and from here we will copy all this and
00:24:21
Let's move it to excel and that's all in theory
00:24:26
moved
00:24:28
then sit xtreme vs yes moved everything
00:24:31
It's just not displayed here, that's okay
00:24:34
now we delete everything first
00:24:37
hash tables of hashtags because they help us
00:24:41
not needed then delete accordingly
00:24:43
all the trees
00:24:44
because we don't need them we don't need them
00:24:46
you just need a step on the facts further like this
00:24:55
let's get virtual machines here right away
00:25:02
ritual it's me with ter
00:25:05
ok let's get the file here in a moment
00:25:07
Let's edit the Mike file further first
00:25:11
we will remove 3 and hashtab from here
00:25:13
0 here also 3 and delete the hashtag here
00:25:18
also delete, then save everything and now
00:25:23
let's compile everything we all compile and
00:25:26
Now we have an excel file. He
00:25:29
which will be used for our
00:25:32
directly goals and
00:25:33
accordingly in this case we can
00:25:34
let's even write another mike file
00:25:38
let's try to do it here in this case
00:25:40
will
00:25:41
there will be the following arguments firstly this
00:25:43
bill secondly and let's ram right away
00:25:46
we'll write, I'll take it
00:25:47
what will he take first?
00:25:49
in this case we need
00:25:50
use build for yourself of course
00:25:53
we indicate
00:25:54
current and considered considered
00:25:57
given build here we indicate
00:26:01
the original file, that is, my . wolf
00:26:04
further minus about mine. The Danish Navy is here for us
00:26:07
it is necessary to indicate the wine with mine. V
00:26:10
m.s. well, they gave it accordingly
00:26:12
the virtual machine needs this all
00:26:14
run main.
00:26:15
v.n. and in this way here
00:26:19
By the way, let's do this rand here too
00:26:24
default operations we will write as default
00:26:27
here is the default built from here by the way
00:26:35
Of course you can do it a little differently
00:26:38
in fact, that is, we can do this
00:26:40
so on here
00:26:42
register Jessie compiling further
00:26:45
mine. more precisely we do not have. SEO considered . sim further
00:26:49
excel excel ip .
00:26:52
he considered this a minus in principle
00:26:57
here you can even do it like this
00:26:59
still equals jessie and here files
00:27:04
equals these files we indicate here
00:27:10
right away that we use some
00:27:12
files are they moving here to whether we are here
00:27:15
must be indicated by mine .
00:27:18
further here we indicate considered with a Jew
00:27:22
and here, in principle,
00:27:27
we wrote everything this way
00:27:32
a fairly simple script purely for
00:27:35
compilation now what are we doing let's
00:27:38
Let's write it down again here
00:27:39
deleted it all in cloud stadio.
00:27:43
further incubus std im. right up to her in the cloud
00:27:50
string . consider h&m club
00:27:53
retinue as much as but further of course
00:27:57
is included in the include library itself
00:27:59
excel and pc
00:28:00
further text more precisely further stack.
00:28:04
We've sorted it all out, now what?
00:28:07
we will do more first to us
00:28:10
it is necessary to identify three main
00:28:13
constants first 1 constant is the stack
00:28:15
says stack site will talk about that
00:28:17
How many
00:28:18
maximum number of arguments
00:28:20
valid functions in this case
00:28:22
let's let this be equal to 16
00:28:24
Next we will change the buff site, that is, we will
00:28:31
we'll use one of them
00:28:33
use a smaller measure, let's say 256
00:28:36
in this case, baksis is more accurately a buffer
00:28:41
there will be a class exactly all different
00:28:44
functions of all different variables and so on
00:28:46
further this is purely temporary
00:28:49
storage and accordingly in this
00:28:52
In this case, 250 ml will be in principle
00:28:54
enough
00:28:55
let's go further further we need
00:28:57
determine both the number of instructions and
00:29:00
in this case we will have 4 of them
00:29:02
instructions to us and give them right away
00:29:04
we will define pdf for us and here we write ems
00:29:10
instruction then here also instruction
00:29:13
pace and in this case, first of all, we
00:29:16
there will be a define instruction
00:29:20
this instruction will say that
00:29:24
so by the way here I am for us yes these are instructions
00:29:30
will talk about creation
00:29:32
functions directly if you know
00:29:35
roughly what language is like
00:29:37
lisp programming
00:29:38
well, let's say some kind
00:29:40
dialect scheme and common lisp
00:29:43
then you most likely know what it is
00:29:45
define is just a function definition
00:29:47
as in a programming language
00:29:48
python dev this function definition is here
00:29:51
example the same thing further we should
00:29:54
be another if instruction
00:29:57
we write them but this instruction is the limit for
00:29:59
in order to actually create threads
00:30:03
is we can move from one to
00:30:06
I act to another and so on and
00:30:08
accordingly, thanks to these already 2
00:30:10
we can create instructions after the fact
00:30:12
full-fledged programming language
00:30:13
no but we will make one more boost
00:30:16
stage we will create two more instructions in
00:30:19
first, these are instructions in the cloud, let's
00:30:22
so let's write the instruction code
00:30:24
this instruction will load us
00:30:26
other files are the same, that is, the same
00:30:31
programming languages ​​that we
00:30:33
we will implement it and then we should have more
00:30:35
one instruction called loop
00:30:37
instruction it will load into itself
00:30:39
assembler files and use them in
00:30:42
high-level environment, well, let's say
00:30:45
we can implement
00:30:46
addition instruction as a function because
00:30:50
which is based on a high level language
00:30:53
this instruction will not be possible in any way
00:30:55
implement accordingly we implement
00:30:57
at a low level this addition instruction
00:30:59
further and we will tinker into the highland language and
00:31:03
we will use it as usual
00:31:05
function of this language, this is the approach we take
00:31:09
we will use it after the fact and
00:31:10
accordingly, any addition operation
00:31:12
multiplication and division subtraction she will
00:31:15
the default is normal functions then
00:31:17
it can also be transferred to
00:31:19
her arguments can also be
00:31:21
return as the result of another function
00:31:23
that is, it will not be any different from
00:31:27
the usual functions that we follow
00:31:29
we will implement it using this
00:31:30
high level programming language
00:31:32
that's all, this is how we are
00:31:35
we implemented basically 4 instructions and
00:31:37
we will write the last instruction as a pass
00:31:39
instruction
00:31:40
just like a virtual machine does not
00:31:42
we did the pass code, basically everything is now
00:31:47
what do we need to do
00:31:48
it is also necessary to determine all these
00:31:52
instructions write const chart further here
00:31:55
we are writing
00:31:56
from capital letter instruction onwards
00:31:59
here we write
00:32:00
in scary we were given here define will
00:32:05
look like just define further iv
00:32:11
instruction will look exactly the same
00:32:12
as further in cloud instruction will be
00:32:16
look like hawking loud
00:32:18
and lot instruction will look like
00:32:21
lord everyone in this way so opportune
00:32:26
I forgot here:
00:32:28
so now we need to do
00:32:31
following
00:32:32
Well, in principle, we can now immediately
00:32:36
start implementing this
00:32:39
interface function let's immediately
00:32:41
imported so this is the exact function
00:32:45
imported and what will it do with us?
00:32:48
first of all we need
00:32:50
initialize the entry point to
00:32:52
program, that is, in this case our
00:32:54
programming language touch our dialects
00:32:56
language sheet will suggest a point
00:32:58
input as let's say the main function
00:33:00
in the C programming language in the language
00:33:02
programming column there in the language
00:33:04
programming husky not so much more this
00:33:05
this will be our entry point into the program
00:33:08
function we directly but also let's
00:33:10
let’s initialize this, that is, in this
00:33:12
case we write a new function and no
00:33:15
entry here we will pass on our experience in this
00:33:19
in case let's just write it
00:33:21
there will be a static fractional function
00:33:23
and here and there is no entry file output well and in
00:33:29
in this case we write in our
00:33:34
directly file directly label
00:33:36
further start what is it directly
00:33:40
start all marks
00:33:43
further here we will write immediately here
00:33:48
in this way mascara 0 that is this
00:33:51
initial let's say argument
00:33:53
because the original argument
00:33:56
will always be for all functions even if
00:33:58
the function doesn't take anything into itself
00:34:01
there is if she doesn't take any
00:34:02
arguments as quality and default
00:34:05
the argument is always a function
00:34:07
there is always at least one argument for
00:34:11
why is this done because every
00:34:12
function she always comes back
00:34:14
any result even the main function
00:34:15
it will return a the result and accordingly
00:34:18
this result will be the decisive functions
00:34:20
it is worth saying it does not apply to
00:34:23
to some separate class of some
00:34:25
you know there are no special functions for sure
00:34:28
will also be implemented like everyone else
00:34:30
other functions and exactly the same
00:34:31
accept arguments, that is, in
00:34:33
in this case, this is the argument she
00:34:35
accepted and will also return the argument in the given
00:34:39
In our concept there will be no such
00:34:40
functions that do not accept anything and
00:34:42
they don't return anything they just won't
00:34:44
Accordingly, this is such a pure concept
00:34:47
pure functions we go further further here we
00:34:51
indicate coleman hill and then this
00:34:56
the function will directly return
00:34:57
result here in this area
00:34:58
memory and accordingly this result
00:35:01
we have to pay to put her in
00:35:04
virtual machine local variable
00:35:07
and then we need to output this
00:35:09
the result is to stop working
00:35:14
the translator is more precise than the translator
00:35:16
stop the interpreter
00:35:18
virtual machine and output the result and
00:35:20
silk is basically all of us in this
00:35:23
case we can still do we hear everything
00:35:27
this is the first thing we need to do
00:35:30
now the second one is already immediate
00:35:32
interpretation of all the code we
00:35:35
wrote
00:35:36
Well, let's write the code right away
00:35:37
some in this case let us
00:35:39
will be acceptable. regiment so sorry
00:35:44
Let's rename it a little in this case too
00:35:48
what will it roughly look like?
00:35:49
first we implement let's function
00:35:52
main let's load the syntax here
00:35:56
We'll upload the diagrams further here
00:36:00
the simplest program let's say 2 + 3 in
00:36:03
As a result, we should output
00:36:05
print the number 50 it is worth saying what it has
00:36:08
we have no function plus that is our language
00:36:12
no default programming
00:36:14
understands what this one imagines
00:36:15
the most plus accordingly necessary
00:36:17
will implement even more accurately load
00:36:20
assembly code which will be just
00:36:23
imagine yourself this very operation
00:36:25
plus, accordingly in this case,
00:36:27
there will be some more of us
00:36:30
let's directory here
00:36:31
new folder in cloud and Denmark in this
00:36:34
directory we will create another one
00:36:36
directory called like
00:36:40
I have an IUD, it doesn’t work here, I have this one
00:36:44
yourself
00:36:45
let's go to in cloud here
00:36:52
then let's move on to the Navy and here we are
00:36:54
let's create a file from . navy and give
00:37:00
so we'll try it later
00:37:01
he will edit accordingly
00:37:03
connect in cloud. further in m son.
00:37:09
vms so we connected the function
00:37:13
plus and in the end we can already do it
00:37:15
use this is basically the minimum
00:37:18
code for this language
00:37:20
it is also worth saying that every every
00:37:23
expression
00:37:24
it always accepts a function and arguments
00:37:28
there is nothing that doesn't happen here
00:37:31
there won't be any here
00:37:33
let's say functions like this
00:37:34
this can't happen or something like this
00:37:37
it can't be
00:37:39
from similar programming languages ​​here
00:37:42
This syntax is quite acceptable, that is
00:37:44
in the end it will come back to us in others more precisely
00:37:48
in languages ​​the construction will return, but we will have it
00:37:50
we will do it a little differently like this
00:37:52
way, that is, we will do some
00:37:55
operation is allowed 0 so that the result is not
00:37:57
changed and let's print three
00:37:58
that is, necessarily always necessarily
00:38:01
at least some
00:38:03
let's say the function in fact we can
00:38:06
write a function in assembly language
00:38:08
which will simply return us this very
00:38:09
let us give the function and it will return more precisely
00:38:13
value and in the end it will simply return this
00:38:15
the top three one way or another as
00:38:17
first argument is always required
00:38:21
functions we figured it all out
00:38:23
let's go back to the source code
00:38:26
this is the file we will basically use
00:38:29
broadcast to them and, accordingly, what
00:38:31
we next do we do read the crowds
00:38:34
internal, let's say ritual function
00:38:37
source and enter output here and
00:38:40
enter input everything now give it
00:38:43
let's try to implement static further an-8
00:38:47
so-called
00:38:48
then we write ride the source here we write
00:38:52
file, by the way, let's have this function
00:38:55
let's do it straight up as an externa function
00:39:01
this is how the file is received here
00:39:06
input and
00:39:07
more precisely, let's copy the question now
00:39:13
let's go to the valleys first we need
00:39:16
read character by character all this code which
00:39:20
we will write and in the end we should also
00:39:24
return some result
00:39:25
Initially the result will be equal to
00:39:27
zero, but as we analyze the code we
00:39:31
we will discover or not discover that the result
00:39:34
will be something else, well
00:39:37
we will count directly
00:39:38
character by character ch equals then we write g
00:39:41
from where we will read this input and while
00:39:43
does not equal the end of the files further that we
00:39:47
do we immediately return this ngc
00:39:51
ch into the stream from which we read
00:39:57
this must be done because
00:40:00
subsequent functions they will be
00:40:01
analyze start and end 7 characters
00:40:05
Well, in this case the symbol of the beginning is
00:40:07
the opening bracket character at the end is
00:40:09
closing parenthesis when we read that
00:40:13
this symbol has simply been missed for us
00:40:15
needs to be done on these translators
00:40:18
so that this symbol comes back
00:40:19
but basically we are so we
00:40:21
done
00:40:22
let's go further next we have to call
00:40:24
the following function called pars cop
00:40:27
it will already accept its output
00:40:30
further it will accept input and into
00:40:33
in this case she will accept herself
00:40:34
stack nose because initially we will say
00:40:37
there won't be any
00:40:40
further we will have this function at the junction
00:40:43
on tachai met us arguments are stored
00:40:46
as you remember, next we will have root
00:40:50
directories but initially there is none
00:40:53
no root directory
00:40:54
what is he talking about, let's say
00:40:56
add + 2
00:40:59
more precisely 2 plus 3 and in the end here we have
00:41:02
definite result and which one is pink
00:41:04
the directory for this expression is gelik
00:41:06
Itachi doesn't have a directory function it's
00:41:08
main function and no matter how deep we go
00:41:10
there let's say you know here we can still
00:41:12
let's say 522, then let's say 11 here
00:41:18
and so on we will always have labor
00:41:20
function this is mine by the way it’s worth saying
00:41:22
that the difference between our language and all
00:41:26
the rest of the faces of languages ​​is what we are not
00:41:29
we can do it like this, that is, we have
00:41:31
there must be a final one
00:41:33
number of arguments in this case
00:41:35
this is exactly the same quality
00:41:37
simplification that is, not to do there
00:41:39
some individual cases and so on we
00:41:41
we put everything under one criterion
00:41:44
that is, under one criterion of functions and not
00:41:46
Moreover, we are not trying to do the same
00:41:48
make more advanced languages
00:41:50
trying to fix a certain error
00:41:51
We are not trying to optimize this language
00:41:53
and then I'm all with this stage we too
00:41:55
we figured it out now let's move on to this
00:41:59
case we also need a pointer
00:42:01
two arguments the first argument is
00:42:03
nesting, that is, let's say that
00:42:05
mobility is understood here, let's say
00:42:07
nesting starts with with
00:42:12
the number of joints, well, let’s say here
00:42:14
us
00:42:15
argument x cannot be its functions
00:42:18
but nevertheless here are the arguments x and
00:42:21
nesting starting from one if here
00:42:24
y scissors starts with 2 what
00:42:26
represents itself nesting
00:42:29
nesting it will simply be
00:42:31
signal about what
00:42:32
quantity in
00:42:34
assembler listing we need
00:42:37
move to take this one
00:42:39
argument well, let's say in this case x
00:42:41
how much do we need to move from
00:42:44
current position reading
00:42:45
to get this value but in this
00:42:48
In this case, this is exactly the situation, let’s say
00:42:51
so let's go further and the last argument is
00:42:54
count that is, this is the counter the counter will be
00:42:57
analyze exactly you know jump that is
00:43:00
let's say jump mole jump one jump 2 and
00:43:03
so on, that is, where exactly should we go
00:43:05
necessary assembler new listing then
00:43:08
there is just go that is either this
00:43:11
there will be a conditional transition or an unconditional transition
00:43:12
it doesn't matter here
00:43:13
we just need to generate labels
00:43:16
labels can be generated using
00:43:18
using a counter
00:43:19
there let's say the main counter is mine, that is
00:43:24
label
00:43:25
play balmain 0 next we will have the label
00:43:28
main 1 will also be further
00:43:31
label let's say main two and so on and in
00:43:35
in the end we have if it is here
00:43:37
certain nested conditions are allowed
00:43:40
if i've i've and so on we will have
00:43:42
generated thanks to a counter such
00:43:44
numbers that is 0 1 2 3 4 5 and so on
00:43:48
everyone with this in this case we
00:43:50
figured it out and accordingly this
00:43:53
the function will have to do the following
00:43:55
if rest is not equal to zero that is
00:43:59
accordingly, if we received at
00:44:00
parsing a certain error then we have
00:44:02
the same error should return
00:44:04
after all, he grew up and, in principle, we immediately
00:44:06
let's finish reading because further
00:44:08
there will be no meaningful reading anymore because
00:44:10
that an error has been detected
00:44:12
and accordingly all subsequent
00:44:14
actions are not just undefined
00:44:15
that is, they can either cause an error like this
00:44:18
and not cause an error and accordingly
00:44:19
better just don't do anything right away
00:44:23
stop working and report an error
00:44:25
we are all with this directly
00:44:28
we figured it out now let's move on
00:44:29
Accordingly, it is necessary to understand that
00:44:32
is this function of pairs
00:44:33
cattle and let's try to do it
00:44:39
let's declare right here that is
00:44:42
static we write further we write and 8 t further
00:44:46
write a couple score
00:44:48
let's get her, yeah, basically, couples scott
00:44:50
further here we have
00:44:55
file output file input exactly the same
00:44:58
further accepted here
00:45:01
stack accepted
00:45:03
further arguments we take here
00:45:08
directory root, more precisely directory a
00:45:11
root function
00:45:12
Next we accept nesting
00:45:15
instinct let's call it
00:45:16
and we accept this very counter
00:45:20
count everything in this way and
00:45:23
now we will try this function
00:45:26
implement here
00:45:30
she first she what does she first
00:45:37
must skip all possible
00:45:40
comments that is the groove cummins and
00:45:44
space, that is, there may be spaces
00:45:47
a few there you know limitless
00:45:49
number of spaces and we can also
00:45:51
be certain comments
00:45:52
your comments will begin with .
00:45:56
comma like this
00:45:59
accordingly we should skip
00:46:01
comments and space space is input
00:46:05
Well, in principle, this function will be
00:46:09
implemented as follows let's do it
00:46:10
we will immediately implement strikes further and pass
00:46:15
cummins and in this case the input file
00:46:20
further here
00:46:21
int ch further while sage equals ges
00:46:25
input does not equal j do next
00:46:30
next we check if it is a space
00:46:33
then we need to skip that is
00:46:38
continue
00:46:39
Next we need to understand if ch
00:46:42
equalize symbols
00:46:43
. a comma then we need
00:46:46
skip the entire next line
00:46:47
that is, we make the following comment
00:46:50
and in this case ch we further do
00:46:53
input and here we all do cantinas and
00:46:55
accordingly, if you did not have any
00:46:58
space no comment accordingly we
00:47:00
we interrupt this cycle and, in principle, everything and
00:47:03
return ch, let's give this function
00:47:08
Let’s also write down that is, in this case
00:47:09
static and was coming
00:47:14
here we take the current symbol
00:47:16
then inter is accepted further if ch
00:47:23
equals ; then what are we doing we will
00:47:29
to reach the end, that is, to tears
00:47:33
not yet
00:47:35
file endings sash equals input and in
00:47:41
basically everything is far away
00:47:43
let's return like this now
00:47:47
what next we will do first of all
00:47:51
you need to understand which symbol is on which
00:47:54
we stopped if these are symbols of WWII
00:47:56
speaks of the end of the file, that is, the writer
00:47:58
0 further if this character is not equal to the beginning
00:48:04
that is, the beginning of reading
00:48:06
expressions then this indicates an error
00:48:09
re-therm 1 that is, this means not a symbol
00:48:13
space means not a comment
00:48:15
accordingly, if this is not the beginning of reading
00:48:18
accordingly it's something else
00:48:19
symbol that expresses an error everything
00:48:23
Next we create another door, two arrays
00:48:28
in fact, the procedure is a reading procedure
00:48:31
current in this very expression but
00:48:33
Let's say in this expression the current
00:48:35
the procedure is a plus by the way in papal rice
00:48:39
terminology
00:48:40
often functions are not named as functions but
00:48:42
how are the procedures
00:48:43
such an ironic component because
00:48:46
that in C language this is actually a procedure but
00:48:48
referred to as functions in down language
00:48:50
on the contrary, that is
00:48:51
are called procedures are in fact
00:48:54
functions one way or another let's
00:48:58
we can call it different things like this
00:49:01
First of all, we create a procedure on
00:49:04
in this case we update this and further
00:49:07
create a buffer, that is, a temporary buffer
00:49:11
in this case, the site will be exactly the same
00:49:13
and reset it exactly the same way
00:49:14
Next we need to read from input
00:49:19
on procedure name, that is, it is possible
00:49:23
done using the read function
00:49:25
simple
00:49:27
then we make them fun then where do we go
00:49:30
we will place and what is the size in says after that what we
00:49:35
we will have to do we will have to determine
00:49:38
what we will have to determine
00:49:40
instructions, that is, does this apply?
00:49:43
here is the procedure
00:49:44
here are these instructions if it doesn’t apply
00:49:48
then let's return the seal of that return
00:49:51
pass instruction otherwise return some
00:49:54
one of these
00:49:55
well, this can be done accordingly
00:49:59
as follows, that is, in this
00:50:01
in case of surgery or instructions
00:50:03
equals ripd df about well, that is, operations
00:50:08
default and read from buffer
00:50:11
Well, in this case, let's try
00:50:13
implement these two functions like this
00:50:17
here let's go straight away
00:50:18
let's try to implement that is static
00:50:20
further damn it here rip percent let u
00:50:27
there will be us then this takes of course input
00:50:29
then takes the buffer ball buffer and
00:50:32
takes say'st size and is acceptable here
00:50:35
site in this case what we will have
00:50:38
we will do exactly the same
00:50:39
read to the limit
00:50:41
that is, we will skip all characters
00:50:43
space all characters
00:50:45
comments and so on until we
00:50:47
let's get to some other symbol
00:50:49
Next we will do the following with us
00:50:53
will be directly
00:50:55
counter that is, thanks to which we
00:50:57
we will place all the characters in the buffer further
00:50:59
Bye
00:51:00
and the character is not equal to the spaces in the given
00:51:04
case and while and in less says -1 and
00:51:10
ch does not equal the start character and
00:51:15
ch does not equal the end character then we are in
00:51:19
we always put these same values ​​in the buffer
00:51:21
we make a workshop and then here ch
00:51:24
equals dc input, that is, take this
00:51:28
the symbol itself and place it again in
00:51:32
buffer at the next iteration further and further
00:51:35
we compare if ch equals character
00:51:37
start or ch equals end character
00:51:40
we need to bring these back
00:51:42
characters into the stream from which we read then
00:51:46
there is he gates sage and they gave them everything here
00:51:50
entered and now we return the buffer
00:51:52
this way now let's try
00:51:54
implement the relapse function let's
00:51:57
static next instruction tempo
00:52:01
reed is defaulted and she only accepts
00:52:05
line that is, this very buffer in fact
00:52:07
let's put it on the buffer themselves further
00:52:10
what are we doing first of all we need
00:52:14
just go through all these instructions
00:52:16
let's say the here
00:52:18
and equals zero or less instruction
00:52:22
us it here + + and further if strcomp in
00:52:31
in this case we will write it as a buffer and in
00:52:36
in this case the instruction will be
00:52:39
equal to zero then return the record and in
00:52:43
in this case, how we do extraction and
00:52:46
everything is fine, otherwise we will have a pass back in fact
00:52:50
instruction
00:52:51
everything is like this, we'll say this
00:52:56
implemented these two operations now we
00:52:59
we need to go further what is here now
00:53:01
we need to implement
00:53:03
after we got the operation to us
00:53:07
it is necessary to include this very thing in the procedure
00:53:10
buffer and indicate here as if in the site
00:53:14
to do this procedure directly
00:53:16
remembered everything for further action
00:53:19
now we need to define
00:53:21
operation, that is, this very instruction
00:53:24
because it will be define instruction
00:53:27
either it will be their destruction because it is
00:53:30
there will be influence truction
00:53:32
for it will be lord instruction but otherwise
00:53:35
we will have a default default that's all
00:53:37
other functions that we will do and how
00:53:39
either implement or create
00:53:41
how to call everything in this case
00:53:45
What do we mean by definitions?
00:53:47
define is one of the most important parts
00:53:49
of this code it will define the functions
00:53:52
and further these functions
00:53:54
will be able to indicate one way or another
00:53:56
and be used accordingly in this
00:54:00
case to us for each new function to us
00:54:02
it is necessary to allocate a stack stack equals
00:54:05
until in this case penalties we write further
00:54:08
indicate the joint says that we made and
00:54:12
this will be a string type, that is
00:54:15
each each function argument will be
00:54:19
represent a specific string that is
00:54:21
let's say arguments x y z there nbb and so on
00:54:26
further that is, one way or another this is all
00:54:28
are arguments and they will have
00:54:32
type string and further after
00:54:36
using the joint we need it
00:54:38
it is necessary to release it so that it does not happen
00:54:41
no
00:54:42
well let's just say no memory leak
00:54:45
Well, then we have to return SRS we
00:54:49
we will get from here, that is, in this
00:54:51
case, let's int 8 tr. s equals and
00:54:55
here we will write define or scary define
00:54:59
with truction here we will transfer a
00:55:01
We will further transfer the experience here and input
00:55:03
let's pass it here let's rename it
00:55:07
a little differently it will be new arguments
00:55:09
newark sleep or just n arks let's call it
00:55:13
so we pass these arguments here
00:55:16
Next, we’ll pass the buffer here and pass
00:55:18
here is the current procedure that we will say
00:55:23
so we basically use everything like this
00:55:28
I’m wondering how this procedure will work for us and
00:55:31
hereinafter referred to as all of us
00:55:34
done in this case by the way
00:55:37
open brackets because here we have
00:55:40
all variables are initialized
00:55:45
we did this first, then let's
00:55:47
let's immediately define all other instructions
00:55:49
riter further iv instruction
00:55:53
we'll write here here we'll have oops here
00:55:57
further we will have input here as well
00:56:00
arguments will be passed to us further
00:56:02
Sleeves and directory will be transferred
00:56:03
attachments will be transferred and will
00:56:05
transfer the count
00:56:06
everyone let's move on here we will have in
00:56:10
principle very little that is, it is an experience input i iv
00:56:14
the buffer is also here, same thing, because it’s here
00:56:20
By the way
00:56:21
the incubus is the same here, that is, here
00:56:25
let's do it here through the lower ones
00:56:28
here is the lot instruction
00:56:31
here output input and buffer are all now
00:56:37
here we need to understand that we
00:56:39
we do but in this case we'll call it
00:56:40
how to process instruction
00:56:43
here we also do out input
00:56:47
then we pass the arguments here
00:56:49
we pass argun so we pass the argument
00:56:52
they gave us a buffer here, we send it here
00:56:54
the called procedure is then passed to ru
00:56:57
we even transmit such a procedure
00:57:00
investment and count counter are all in this
00:57:05
case, there is no need to be surprised by what is here
00:57:08
there are so many arguments because it is
00:57:09
the function is in fact the main one and
00:57:12
evaluates all expressions this instruction
00:57:15
she creates functions this is instructions she
00:57:18
creates threads, that is, there
00:57:21
allow 1 1 thread 2 threads so on
00:57:25
but in the club laut this is purely loading
00:57:27
code and nothing more
00:57:29
in this case it will be easiest
00:57:32
implement in cloud and lot of instructions
00:57:34
let's try to do just that
00:57:37
write static then int
00:57:39
8 t further in construction
00:57:43
and in this case we will have a file like this
00:57:50
output then the input file and here we have
00:57:54
there will be another char buffer channel we will also
00:58:00
put
00:58:01
int ch next what we do we must
00:58:04
indicate
00:58:05
index is zero to read the buffer
00:58:07
further until the king
00:58:13
input does not equal the end of the files then we
00:58:17
do the following action first
00:58:19
need to skip everything
00:58:22
white that is if it is a space ch then
00:58:26
we let him through first, then we
00:58:29
you need to skip all the characters
00:58:32
which follow the comment that is
00:58:34
if ch equals comment then we
00:58:38
skip the comments, that is, the groove
00:58:40
comment in this case we write ch input
00:58:45
Well, we do it exactly the same way in the picture
00:58:47
further here we should have answers in
00:58:51
a new buffer must be created each time
00:58:53
symbol that is Yandex plus equals
00:58:55
and here when we say so
00:59:00
skipping spaces this may indicate
00:59:02
two meanings
00:59:04
first of all the words were read in full
00:59:07
Well, let's say look at the first word it all
00:59:11
out then the second word is in this case
00:59:14
by words we will understand everything without
00:59:16
space characters in this case are not
00:59:19
Navy whip of this n.s.
00:59:21
but besides everything else, we can also
00:59:23
so let's do it there, let's say saab further
00:59:27
here we say and so on, that is
00:59:30
accordingly after we
00:59:33
detected a space character or a symbol
00:59:36
completion with an expression we need
00:59:39
do the same actions with what you read
00:59:43
line accordingly in this case
00:59:45
what do we do well first of all if
00:59:48
check if the index is not zero
00:59:50
but this is to skip all these things
00:59:54
variations when we have simple here
00:59:56
characters are spaces then we must
00:59:59
add a final index to the buffer
01:00:03
the symbol was given the index to be immediately reset and
01:00:06
after that we need to open the file
01:00:08
that is, in this case the file is equal to
01:00:12
movie file equals fiab and further here
01:00:17
we indicate the buffer, that is, read
01:00:19
line and then we open this file at
01:00:22
reading given here immediately and taste files to
01:00:25
win and further here in principle immediately
01:00:30
the cantina will go next what do we need
01:00:33
needs to be done here but first of all we
01:00:35
We need to understand the files are zero
01:00:39
that is, this means that our file
01:00:41
it just didn't open
01:00:42
accordingly we must return one
01:00:45
let's move on after we opened
01:00:50
this file we need to do everything
01:00:53
the same thing we would do with our usual
01:00:57
the specified file here, that is, we
01:01:00
should just call the same one
01:01:03
fact procedure but not pars procedure but
01:01:05
procedure he let's find it procedure
01:01:09
lithol we need to call her let's
01:01:12
let’s do this, that is, the source ritual and
01:01:14
here we specify output but as
01:01:17
input parameter we specify the file then
01:01:20
there is a bottom line we have to read this
01:01:22
the very file that is listed in included in
01:01:25
in this case it will look like in
01:01:26
cloud then we do the same actions
01:01:30
do it with the symbol if we meet it
01:01:33
ending symbols, that is, we are exactly the same
01:01:39
indicate if the index is not zero
01:01:42
exactly the same buffer but except that
01:01:45
what are we doing here instead of what bricks?
01:01:49
that is, the conditions were completely completed
01:01:52
that is, nothing further is needed
01:01:55
read we all agree with this in principle
01:01:58
figured it out and here we will just return 0
01:02:03
this is how easy it is in principle
01:02:05
young lad procedure and give it right away
01:02:07
let's put it up here somewhere
01:02:12
the mode instruction is done in exactly the same way, but
01:02:15
It’s even easier here, let’s even say this
01:02:18
instruction
01:02:19
then copy this instruction directly
01:02:23
insert the whole thing here, change it to the forehead
01:02:28
instruction and what it will represent
01:02:31
it's just reading the code, that is, reading
01:02:33
line by line and nothing more is not even necessary
01:02:36
nothing, no function, this is a ritual
01:02:38
cause and so on and so forth to us
01:02:39
you just need to read it line by line, that is
01:02:41
file in g
01:02:43
write further indicate
01:02:46
buffer somewhere, that is, it will all be
01:02:47
rush around and indicate the file not yet
01:02:50
equals zero while we can read
01:02:53
we will simply enter these same lines
01:02:56
lines
01:02:57
that is, we indicate the buffer in output, so
01:03:00
we delete all this and we do the same thing
01:03:03
we do it here
01:03:05
everyone, in this way we have already implemented 2
01:03:08
in fact functions that can either
01:03:12
otherwise apply
01:03:13
that is, these are the lightest ones
01:03:15
let's put them here as well
01:03:19
and here I have already contributed everything and now we
01:03:23
it is necessary to proceed to three main
01:03:25
instructions that precisely determine
01:03:29
our program
01:03:30
Well, of course, we’ll start with the instructions
01:03:33
let's define define scary because
01:03:35
it just determines all subsequent
01:03:37
functions and an expression without a function they are not
01:03:39
will be performed more accurately we will have
01:03:42
a certain error is immediately called
01:03:45
and let's immediately define this here
01:03:47
this very file, or rather this very one
01:03:51
function by the way to further and 8 times here
01:03:54
indicate define is not scary, well
01:03:56
it takes this function file output
01:04:02
next file input next stack arcs
01:04:09
then takes the buffer and accepts
01:04:14
procedure
01:04:16
everything else starts the same way for us
01:04:19
en en sage further we have exactly the same wild
01:04:23
Sasha equals dc input does not equal yet
01:04:27
after eating we will have to do exactly this
01:04:30
all subsequent actions are exactly the same
01:04:31
we write space age and further here
01:04:35
do continue
01:04:37
further in the same way if ch equals
01:04:39
symbol
01:04:41
comments then do the same
01:04:43
skip comment pascal and
01:04:48
and then continue that is continue
01:04:52
this is how we did it now
01:04:55
what do we need to do first
01:05:00
after more precisely we need
01:05:03
define explicitly
01:05:05
Let's just say what the procedure was
01:05:09
analyzed i.e. what procedure
01:05:10
has been read, we need all these in
01:05:13
first procedures and read that is, how she
01:05:15
this will be determined by us
01:05:19
let's function Ren TV she returned it to us
01:05:22
give up and moved the pointer here
01:05:24
that is, at the beginning
01:05:27
main functions then we need everything
01:05:30
Read the next ones yourself
01:05:32
Accordingly, we need first
01:05:34
determine the name of this very function
01:05:37
secondly, we need to determine everything
01:05:40
subsequent arguments to this very function
01:05:42
and thirdly, we need to call
01:05:45
these are all the expressions that are found
01:05:47
in this function all these are basic
01:05:50
tasks directly and give them
01:05:52
Let's try to solve this case in
01:05:55
As a result, we will try to create one
01:05:58
function called let's here
01:06:00
iv define construction state that is
01:06:05
setting the state in this case we
01:06:08
let's pass the arguments here, that is, the stack
01:06:10
next we will pass the buffer here before this
01:06:13
procedures here and here we will create more
01:06:16
let's say in fact there are two components of this
01:06:23
procedure found
01:06:24
that is, the procedure was not found then
01:06:28
there is this
01:06:29
naming the one found or not found yet
01:06:32
further we still need to determine
01:06:34
index in this case we are Yandex
01:06:36
plays exactly the same role as here
01:06:37
that is, purely for accumulating a buffer and
01:06:40
no more Well, accordingly, what are we doing here?
01:06:42
we simply pass found here and pass
01:06:46
Yandex here, well, let's define this
01:06:48
the static function itself further
01:06:51
will return exactly the same int 8 t and so on
01:06:54
define extraction speed
01:06:58
here we will have a file oh more precisely a file
01:07:03
stack stack arcs
01:07:07
next char buffer next chart percent and here
01:07:13
will be the process and say'st and index here
01:07:21
By the way, we check everything further
01:07:25
if the index is not equal to zero in principle
01:07:29
as you have we will do it in principle
01:07:32
similar action to start with is
01:07:35
index + + t7 inn express press simply
01:07:38
index equals pa to the terminating character
01:07:44
Further
01:07:46
index is zero here by the way
01:07:49
pointer go further next if
01:07:52
the procedure has already been announced it will be
01:07:56
talk about next steps to us
01:07:58
Now you need to enter all the arguments
01:08:01
this very procedure on the stack, that is
01:08:04
make a push stack, then specify arcs and
01:08:08
we indicate this very argument in this
01:08:13
case the buffer stores arguments
01:08:16
Next we need to understand that is
01:08:18
side step
01:08:20
we write further here we indicate arcs and if
01:08:24
stack equals stack says it says about
01:08:27
stack overflow accordingly we have
01:08:29
will return one otherwise if the procedure is not
01:08:33
was found, this indicates that we have
01:08:35
procedure read accordingly we
01:08:38
must be copied into the procedure, that is
01:08:41
here in this array of ours
01:08:44
read procedure we indicate the buffer from
01:08:47
buffer and how much to read buff site well
01:08:49
and then we indicate that the procedure was
01:08:52
found everything here return 0 at once well
01:08:57
and here we have a unit returned like this
01:09:00
this is how we move on now
01:09:03
accordingly, here we have by the way if
01:09:06
this is fulfilled when we return
01:09:09
units let's move on
01:09:11
further if ch equals the beginning that is
01:09:16
in fact the expression was found for us
01:09:20
needs to be analyzed
01:09:21
was this expression caused by reading
01:09:24
procedures or was this expression a reading
01:09:27
the body of this very procedure in this
01:09:30
case we do the following if percent
01:09:32
found
01:09:33
then we have to do certain things
01:09:38
action otherwise just skip
01:09:40
certain actions that we will
01:09:42
mean firstly we immediately and that
01:09:44
we return the same symbol, that is, here
01:09:46
this boss
01:09:48
the beginning of the expression and enter it into the flow
01:09:53
read more what we do we determine
01:09:56
first time label
01:09:59
our procedure, that is, in this case
01:10:01
what are we doing we are in and the experience is out
01:10:05
we put the thread, that is, the label further from the gigin
01:10:11
that is, this is the beginning of our marks and here
01:10:14
under our marks we will be
01:10:16
imply this very procedure and
01:10:18
after that we will call steam scott
01:10:21
that is, here we pass output here we
01:10:24
we pass the input I need to pass it here to you
01:10:26
we pass the arguments to the procedure until
01:10:29
transfer the amount of arm
01:10:32
more accurately, nesting is conveyed by nesting
01:10:35
and we pass the count equals zero, that is
01:10:38
we just initialize the counter counter
01:10:40
everyone go further further if Sasha equals
01:10:46
completion it will talk about
01:10:49
next upon completion we definitely
01:10:52
we need to complete our execution
01:10:55
procedures what we do first we
01:10:58
for now we are doing exactly the same thing, that is,
01:11:01
we will have to read the procedure
01:11:04
because there may not be any here
01:11:07
spaces as this implies
01:11:10
accordingly we can have it like this
01:11:12
accordingly we again define
01:11:14
procedure further further what we do we
01:11:21
specify side step
01:11:22
arks, that is, we indicate how much
01:11:26
arguments
01:11:29
how many arguments are on our stack
01:11:31
located
01:11:33
and then we do the following if
01:11:36
procedure was not found just not
01:11:39
found
01:11:40
then we create procedures for the first time here
01:11:43
this label only indicates the beginning
01:11:45
procedure actions while here
01:11:48
the following marks we will write
01:11:50
they will point to the beginning of the arguments
01:11:53
this very procedure is what we are doing here
01:11:55
First of all, we do exactly the same in
01:11:57
printf here is output and here we pass well
01:12:01
firstly we can indicate the quantity
01:12:02
arguments
01:12:03
that is, we indicate the ldn and transmit it here
01:12:07
arts
01:12:08
further we can also indicate exactly
01:12:10
current indicate already and create a variable
01:12:12
that is, create a label and send
01:12:16
here procedure the name of the procedure that
01:12:19
we read with the help of these here
01:12:23
this function go further so on here
01:12:28
we are creating a certain pace that will
01:12:31
equal arts
01:12:34
what are we doing so far the more unity we are
01:12:39
we will have to download the value from
01:12:43
memory that is f printf further and experience and
01:12:47
here we will have
01:12:49
let's do it here right away
01:12:53
it was beautiful
01:12:54
and from where we should load i.e. into
01:12:56
in this case minus ld.
01:12:58
and in this case it is unloading
01:13:04
arguments will simply go under + 1
01:13:07
arks and all why + 1 because like me
01:13:11
I said earlier we always have at least one
01:13:14
argument i.e. functions without arguments
01:13:16
we simply will not exist in
01:13:21
in this case, so far all these arguments
01:13:23
directly
01:13:25
are isolated here tempo -1 everything and further
01:13:31
here we need to do more
01:13:32
do the following f printers exactly like this
01:13:35
same out put and here we need
01:13:37
point jump jump to run run and here you go
01:13:44
here we indicate the percentage that is
01:13:46
Jenkinson and this is the very beginning after
01:13:49
after we unloaded all the arguments we
01:13:51
she started jumping and that is on the body
01:13:53
procedures
01:13:54
Well, what else are we doing here?
01:13:57
we can, in principle, indicate the symbol of the new
01:14:02
lines and everything further if after all
01:14:05
procedure was found process found
01:14:08
then what do we do we if procedure
01:14:13
was found, this means that we
01:14:16
read everything in this function because
01:14:20
couple scott he says that we are all
01:14:23
expressions inside this very function
01:14:25
read accordingly we found
01:14:26
this very symbol is because I myself
01:14:29
the procedure has already been found, that is, this
01:14:31
symbol we respectively skip and
01:14:33
accordingly we have reached the very end
01:14:36
accordingly in this case we are
01:14:37
do we indicate the end of our
01:14:40
procedures oh here and further here we create a label
01:14:44
label with and as called and we are here
01:14:50
indicate the procedure further if
01:14:53
number of arguments is not zero
01:14:56
then we make the following offset
01:14:58
output here we write 100 and here
01:15:05
firstly minus ld -1 that is minus 1
01:15:09
will indicate the result of this very
01:15:11
functions, that is, what result we take
01:15:13
ld will indicate the offset itself
01:15:16
is there somewhere we should put this one
01:15:19
the result and this is actually a memory area
01:15:25
where should we put it is calculated
01:15:27
according to the following formula we need to
01:15:29
add two arts
01:15:31
multiply by 2 about this
01:15:35
let's say so you can say so I
01:15:38
this one incl.
01:15:42
I found this formula empirically but
01:15:45
in fact, you can do it yourself
01:15:48
analyze its essence of work and there
01:15:51
indeed the arguments are always
01:15:54
pressed, or rather, always even in
01:15:56
the fact is otherwise that we are doing this unloading
01:16:03
unload the storm here that is, if
01:16:07
arguments
01:16:08
still equals zero then it is
01:16:10
default is 3 minus 3 that is
01:16:16
why -3
01:16:17
because first we will start first
01:16:20
argument further we subtracted my pointer
01:16:23
to the label and as the third argument
01:16:25
this is the argument itself that was submitted in
01:16:30
this very function, respectively, these are three
01:16:34
this is how we are already here
01:16:37
done now let's move on here
01:16:41
you need to immediately push from this
01:16:43
value functions, that is, we indicate pop
01:16:46
so that we don't have any leakage
01:16:48
memory and then we will do this
01:16:51
look, that is, the tempo is equal to arcs
01:16:54
and further for now the more of us are here for now
01:17:01
the more units we do what we do
01:17:04
in the same way we unload all the values ​​of a
01:17:06
experience pop and here the temp minus is equal to 1 o
01:17:12
what does this mean what does this mean
01:17:14
every time we do laut we
01:17:18
fill the stack accordingly all these
01:17:20
the lots we made we need
01:17:22
release from because
01:17:23
that's all therefore in this case for
01:17:26
This is exactly what we are using, and
01:17:29
next what we do is return
01:17:33
result and what we return control with
01:17:35
calling function that is, it is red
01:17:38
and here it’s simple and butt out put symbol
01:17:44
new line and further after we
01:17:49
I finally got to the end of the expression
01:17:54
we need to take back control
01:17:56
calling function
01:17:57
writer 0 and further what else do we need
01:18:04
to do this, let's say, to understand more precisely in
01:18:12
In this case we need to do more
01:18:15
one variable called what will it be
01:18:19
percent peephole equals
01:18:23
in this case one here here by the way
01:18:29
I'm sorry, I made a mistake here
01:18:31
found a process Klaus must be given
01:18:36
here should be proc clouseau you and her
01:18:39
will be indicated here will serve
01:18:40
equals one and here continue percent
01:18:43
the closet will just say that
01:18:45
this procedure was completely closed
01:18:47
that's it and then in the end what else are we
01:18:53
do next if percent closet
01:18:58
when we return record error
01:19:03
otherwise buffer index plus plus equals
01:19:07
ch what does it say what does it say
01:19:10
define should never be read
01:19:12
all subsequent characters are the essence
01:19:15
define is to
01:19:17
read the procedure and read everything
01:19:19
arguments
01:19:20
everything that comes next is by no means
01:19:22
should read exactly what it says
01:19:24
about this if the procedure was closed then
01:19:27
there is if there was an end to this
01:19:28
character and we are trying to read more
01:19:31
new symbol then this indicates an error
01:19:33
accordingly, return the error and that’s it
01:19:36
after all we are here
01:19:39
return not 0 but one
01:19:42
because in this case it’s below zero
01:19:44
this is just the argument here
01:19:46
that is, that the procedure was successful
01:19:49
closed and if a symbol was found
01:19:54
line endings and the procedure was not
01:19:56
closed this also indicates an error
01:20:00
that's basically all there is and this one
01:20:02
we finally described the function given
01:20:04
massive but she is let's say
01:20:08
the basic function is enough for us
01:20:12
we now needed to implement
01:20:13
two more functions need to be implemented
01:20:15
this is firstly this is firstly a function
01:20:21
f and secondly this function is percent well
01:20:24
let's try to implement the function
01:20:25
percent because she’s not very like them
01:20:28
important for execution, that is, we of course
01:20:32
we can’t make conditions there, but still
01:20:34
less here is such a performance we are quite
01:20:35
we can do it without her and let's do it
01:20:38
let's try to do this, come here and
01:20:43
we declare this very function, that is, in
01:20:46
in this case static then int 8 topics and
01:20:48
here we will have
01:20:49
iv instruction this function also
01:20:52
accepts the following arguments then
01:20:54
there is firstly this is output then this is
01:20:56
also input further is a stack that is
01:21:02
arguments more precisely take me if a I'm sorry
01:21:07
prostration instruction which we
01:21:09
we create directly further what we need
01:21:14
we need a buffer buffer
01:21:17
Next we need an indication of the procedure
01:21:20
current and we need to indicate the root
01:21:23
procedures further we need instructions
01:21:26
investments site investing and we need
01:21:29
account and account for everyone in this way
01:21:34
then we do exactly the same with next
01:21:36
file ch equals gds they are not here
01:21:41
equals and a file then exactly the same
01:21:44
skip if
01:21:45
and space Sasha when in this case
01:21:49
continue write 0 and if
01:21:51
[music]
01:21:53
if ch equals comment character
01:21:56
in the same way here continue we write a
01:21:59
write a comment here
01:22:03
sash input further here we are exactly the same
01:22:07
create the sst variable
01:22:08
index is 0 it is exactly the same here
01:22:12
buffer index plus plus equals ch
01:22:16
Well, that is, we are already in such an architecture
01:22:18
basically done in all previous ones
01:22:20
functions now what we need
01:22:23
What we need to do here is something like this
01:22:27
the same as with define and call your
01:22:30
function perc instruction
01:22:32
and here is this function needed for this
01:22:37
to determine what values ​​we need
01:22:41
must be placed directly into
01:22:43
the virtual machine in this case is
01:22:46
not necessary for arguments like this
01:22:48
there are two three these values ​​we need
01:22:50
insert into the joint into this one in the stack exactly
01:22:53
virtual machine accordingly is
01:22:55
let's just try to do that
01:22:58
we have here what we should have at all
01:23:02
transmitted firstly is out put where
01:23:04
should go to bed
01:23:06
then these are all the arguments that should
01:23:10
Let's say it's checked, it's a buffer then
01:23:16
is in this case from the buffer just
01:23:19
takes arguments next is index next
01:23:26
and this is another arx variable
01:23:29
let's define the Stan Arts site here too
01:23:33
And
01:23:34
equals 0 this indicates the quantity
01:23:37
arguments in this expression, that is, in
01:23:39
in this case, two arguments we all are
01:23:44
definition now let's function
01:23:46
Let's implement static further in this case
01:23:49
howl percent strashinsky
01:23:53
and here is the output file next to the stack
01:24:00
arks dalia buffer
01:24:05
investing website
01:24:08
then here we have it and here we have it and here it is
01:24:16
further arks
01:24:17
We have a buffer and here we’ve been wearing sting for a long time
01:24:19
let's try to implement this
01:24:21
investing index rts 0 here we go
01:24:25
say'st and Yandex and side-step Arks in well and
01:24:36
here is exactly the same if the index is not
01:24:38
equals zero we make the following buffer
01:24:42
index plus plus equals slash 0 further
01:24:48
index value like this index equals
01:24:54
zero and further soloists and and here to us
01:24:58
need to check is not in
01:24:59
stack this same or read argument
01:25:01
that is, in this case, what can we do?
01:25:03
do if the function accepts
01:25:05
certain argument we need
01:25:07
understand there is this argument
01:25:09
x on the stack and accordingly if
01:25:11
exists then we need to download
01:25:13
this argument to a specific address
01:25:17
the address is indicated to the virtual machine all
01:25:20
further accordingly if they stack further
01:25:24
indicate arcs
01:25:25
buffer and indicate and and it will be
01:25:32
return this very address in fact, well
01:25:36
more precisely the address relative to the current one
01:25:38
positions because now we will find out
01:25:41
how to calculate the real address of a cell
01:25:43
memory in this case is specified in printf
01:25:46
gave oh here and here we indicate t lot then
01:25:51
there is a load from a memory cell minus ld
01:25:54
and load using the following formula
01:25:57
arks en plus listing minus and in fact
01:26:01
this formula was also found
01:26:02
empirically but she is quite herself
01:26:06
functions what we do next next
01:26:09
we are here in the printer doing further out and
01:26:11
here we do push push and
01:26:14
indicate the buffer in this case
01:26:18
Let's just say why is this needed at all?
01:26:22
in this case the number two and the number 3 are not
01:26:26
are arguments
01:26:27
accordingly, they will fluff in addition to
01:26:29
everything else can even fluff
01:26:31
function we'll talk about this later
01:26:33
because thanks to this we can
01:26:35
implement the concept
01:26:37
so let's say the functions that are capable
01:26:40
accept a function or return
01:26:42
function that is quite useful
01:26:45
Well, let's try to do this further
01:26:48
fax and accordingly after
01:26:50
we extinguished the values ​​​​we have quantity
01:26:54
arguments
01:26:55
arcsin is added plus equals 1 now
01:27:00
let's move on further so here we are all
01:27:05
this has already been done, so if
01:27:08
Sasha equals the beginning of the expression that we
01:27:11
we must do everything we do
01:27:14
did in Bethany, that is, sage questionnaires
01:27:16
input then we call steam in the same way
01:27:19
scott couple scott let's say stooop here
01:27:23
we pass it here
01:27:24
input pass here arcs pass here
01:27:26
root rights
01:27:27
well and further here only with the exception of
01:27:30
what we convey here is not just
01:27:32
nesting and we pass on missing plus arts and
01:27:35
so that this is the offset it is always
01:27:38
replenished in this specific function
01:27:41
so that all other functions
01:27:44
so that all these arguments are capable
01:27:46
were finding themselves
01:27:47
that's all, well, then we do transmit
01:27:51
count the cautery hasn't changed yet
01:27:53
will only change in the if statement
01:27:55
Well, further in this case, arcs is a plus for them
01:27:58
equals 1 we add again
01:28:00
because let's say for this
01:28:04
expressions this expression is like
01:28:09
one argument
01:28:10
they are like here, let’s say 2 respectively
01:28:12
we only need to add one
01:28:14
everyone let's move on further we need
01:28:19
understand and if symbol
01:28:21
equals the end of the expression well and in
01:28:25
in this case, what do we do, well, first of all
01:28:27
we do exactly the same thing, call this one
01:28:28
the very function of the instruction is worth
01:28:31
called and then we need
01:28:34
determine the number of arguments arcx and
01:28:36
on equals zero if the shares are on
01:28:39
equals zero then what we do is
01:28:42
indicates that the function has no arguments
01:28:44
but as I said earlier each function
01:28:46
has at least one argument
01:28:47
accordingly, here we push the furs, let's go
01:28:53
next next we do
01:28:55
and by the way, we haven’t implemented this one yet
01:28:58
here's the function itself, let's give it in principle
01:29:02
then let's try to implement it, I think not
01:29:06
so complicated let's get here right away
01:29:09
I will define statics further here
01:29:12
bull in stock next here stack arcs
01:29:17
further char buffer and further here say'st and
01:29:21
Yandex
01:29:23
then we have to sort through 32 you and
01:29:28
is very much zero and
01:29:31
Well, yes, in principle, let’s do a side step right away
01:29:35
and equals zero or less
01:29:38
side-step arcs and further + + and further if
01:29:45
string was found string m.p.
01:29:49
Arx will start bad stack Arx and . string with
01:29:59
buffer equals zero then we go to
01:30:03
index we add current with ours, this is the same
01:30:06
meaning and and return what the value was
01:30:08
found 0 otherwise 0 here we are in principle
01:30:12
we have implemented this function now
01:30:14
you need exactly the most accurate and the same
01:30:17
let's call the function again
01:30:19
let's try to call if it's already on the stack
01:30:23
there is a certain value of arcs then
01:30:25
yes if there is a procedure on the stack
01:30:28
procedure name what are we doing
01:30:33
we call this very procedure like this
01:30:36
in general it may be in this case
01:30:37
maybe as follows, that is, here
01:30:42
so let's say so here maybe
01:30:46
there must be a certain procedure and
01:30:49
here are some arguments to go
01:30:51
Accordingly, this procedure should
01:30:53
be called upon that's all let's move on tags
01:30:57
Arks further here we will have because
01:31:02
and here we indicate minus ld.
01:31:06
that is, each procedure in fact also
01:31:08
have your own address, that is, to which we
01:31:10
should contact this address as well
01:31:12
we calculate using the same formula
01:31:13
arsen plus missing minus and well, otherwise if
01:31:22
countries the procedure is zero and no
01:31:26
I'm sorry and here when I did this
01:31:29
in this way, that is, when we have
01:31:30
a certain procedure was returned and
01:31:32
here the X game was performed here
01:31:34
this is the code like this and this is the code and it’s like this
01:31:41
yes it is executed if this procedure
01:31:43
is in the arguments in theory, that is
01:31:46
if right here is in
01:31:48
arguments this procedure then it
01:31:49
everything works with this it seems
01:31:53
we figured it out, let's change it here to
01:31:57
defaulted so the building we held here
01:32:00
f printer we do further here and experience
01:32:03
here by the way also out
01:32:06
we must not forget further here we are
01:32:10
call further
01:32:12
ld and here the formula will be simply arcs
01:32:17
and because it's just an argument number
01:32:20
and nothing more
01:32:21
then we go as follows, that is
01:32:23
out put
01:32:24
and here we need to unload
01:32:28
know load values ​​that is l d n
01:32:33
minus 1 that is
01:32:37
arks and and further as the second
01:32:39
we specify the following arguments
01:32:44
minus equals 1 that is, if the argument
01:32:48
number of arguments 0 or equal to one
01:32:51
then return one anyway
01:32:53
Well, otherwise, in principle, we can do this
01:32:57
in the same way there is nothing here
01:32:58
will change, and then return the arcs and
01:33:01
-1 all this is, in this case, like
01:33:06
some result of this very call
01:33:09
we will have this very function, but otherwise
01:33:11
if not this is not this we have not fulfilled
01:33:13
that is, if y and process equals
01:33:17
zero by the way why am I here he just
01:33:19
equals 0, the whole point is that
01:33:21
when we do this, we have a reading
01:33:24
here, that is, the functions between the beginning
01:33:28
expressions and the end of the expression is 0 that is
01:33:31
We didn’t read any procedure, but the whole one
01:33:34
the point is that with this expression we
01:33:36
return some other procedure and
01:33:40
we put it here basically
01:33:44
so let's just say this is all
01:33:47
implemented
01:33:48
go further further here in printf
01:33:50
here we have output and here we do
01:33:55
ordinary call that is, count and so on
01:33:57
we pass here the procedure percent but in this
01:34:02
In this case, let's say this in fact
01:34:06
a regular call to another procedure
01:34:08
let's say there's some kind of ark procedure
01:34:11
just called
01:34:12
that is, it is not used as arguments
01:34:14
not as some kind of return
01:34:15
there are meanings and so on, it’s just itself
01:34:18
in fact, that's all it is
01:34:23
return value it is needed let's say
01:34:25
we write here re-therm ark and some
01:34:29
another function just returns
01:34:30
here and she uses these two
01:34:33
argument when she's completely there
01:34:35
the other one, well, we'll talk about that later
01:34:38
these functions that are capable of themselves
01:34:40
there to accept yourself which you which
01:34:45
can accept other functions that
01:34:47
can return other functions like this
01:34:48
further and similar we will talk about this more
01:34:50
let's talk, basically we're all here
01:34:52
we figured it out and now all we need is
01:34:54
All that's left to do is clear the stack then
01:34:57
There is file arx in more than one we will do
01:35:01
just f printer output
01:35:03
and under we indicate because here we are
01:35:11
in fact they scored
01:35:12
certain meanings and here we are
01:35:14
scored certain values
01:35:15
accordingly, all the values ​​that we
01:35:17
they should have used it, let's put it this way
01:35:21
leave here and we write everything here
01:35:25
more
01:35:26
arcs and minus equal de all return 0
01:35:31
Well, otherwise, of course it’s coming back to us
01:35:33
unit
01:35:34
if everything is over with us but at the same time
01:35:38
expression is not completely about
01:35:41
was analyzed so now everything we need
01:35:45
All that's left to do is implement the function
01:35:47
f instructions
01:35:48
let's try to implement it, that is
01:35:50
in this case we write it like this: static
01:35:55
right away by the way kent 8 then if in
01:35:59
terrible and in this case exactly the same
01:36:02
output file
01:36:05
next file input next stack arcs
01:36:11
then the ore directory is accepted and then
01:36:14
attachment accepted
01:36:16
nesting and apply accepted
01:36:19
the counter here is exactly the same
01:36:23
int ch by the way there is inter everywhere here
01:36:28
then the sachet file is equal to dc input
01:36:33
does not equal it we will do it in fact
01:36:37
all these operations are of the same type and space ch
01:36:41
then we continue if ch equals
01:36:46
skip the comment accordingly
01:36:50
comment sage input further exactly the same
01:36:54
continue to register further here we
01:36:59
Of course, we put the index plus in the buffer
01:37:02
plus equals as much as and accordingly here
01:37:04
We
01:37:09
so yeah
01:37:14
or even a buffer buffer we have even in
01:37:16
basically it won't be needed here
01:37:18
look at the interesting feature
01:37:20
concluded that is, we first read all the characters
01:37:24
Next we need to understand that is, if
01:37:27
ch ch equals the beginning of the expression then this
01:37:31
indicates that the conditions in fact
01:37:33
begins and we need to analyze
01:37:37
have we read the terms and conditions or is it already
01:37:40
expression and we have it look like
01:37:42
it will look like
01:37:43
those. in this case iv here is some
01:37:46
condition let's say there 0 equals 5 and go
01:37:51
two arguments that is, if zero equals 5
01:37:55
then return 1 otherwise return 2
01:37:59
we will have it so we need it
01:38:02
read this first
01:38:04
the conditional expression was given already read here
01:38:06
these two
01:38:07
enemies under the expressions let's say so, well
01:38:10
Accordingly, our task is precisely to
01:38:12
this is concluded
01:38:13
those. in this case what do we do in
01:38:16
first for us we always have
01:38:20
only two arguments that is
01:38:23
air conditioning arcs
01:38:25
equals two well, that is, as I said
01:38:27
previously there is the first and second expression and
01:38:31
further we must have more conditions
01:38:34
was not closed
01:38:36
the first expression that is responsible for
01:38:39
condition low z equals 0 and
01:38:44
accordingly we do the following
01:38:46
first we need to remember
01:38:48
current counter, that is, this contour
01:38:53
then we do the following if air conditioning
01:38:56
closet then we need to define
01:39:00
the original mark in fact, that is
01:39:02
do output then put the label here and
01:39:07
here we indicate with and here we indicate
01:39:10
l.d.
01:39:12
well, by s we mean sleeves and
01:39:14
directory a under ld.
01:39:16
we will understand the current counter
01:39:19
account but here we have to
01:39:21
subtract he arcs that is, we initially
01:39:28
account let's add a two here
01:39:30
deuce
01:39:32
further here accordingly we will have
01:39:33
subtract first 0 will be the counter next
01:39:36
then there will be 1 0 in the next expression
01:39:39
By morning there will be four of us equal to then
01:39:41
the counter will be equal to 3 and then 4 and
01:39:44
so on and accordingly that's all
01:39:46
initially we do it and then here
01:39:49
we have air conditioning arts minus equals 1 and so
01:39:54
Next we need to do the following
01:39:57
that is, execute the expression that is, he
01:40:00
gch waist input and expression we must
01:40:03
execute and everywhere be it conditional
01:40:05
expression be it meaningful expression
01:40:08
accordingly we make the next bar
01:40:10
Scott and let's do it, that is, out here
01:40:13
further input arks root nesting but here already
01:40:19
we transmit because under that is the counter
01:40:21
increase for a specific procedure
01:40:23
which we call next if
01:40:26
air conditioning closet
01:40:31
if that is the conditions have already been completed
01:40:34
and condition arcs equals one then
01:40:37
we do the following in printf given
01:40:39
out here we put jump here and here and then
01:40:52
yes in this case we need it
01:40:54
so that the knife in this case is
01:41:00
necessary for our meaning
01:41:02
air conditioning arcs closed
01:41:04
alternative expression that is when
01:41:06
we did, let's allow them there
01:41:10
condition x y when this condition is allowed
01:41:16
it will be carried out there in fact
01:41:19
another value is acceptable there if not
01:41:22
equal to zero, that is, if the conditions are not equal
01:41:24
is not equal to zero then we go to
01:41:27
X, otherwise we move on to Igor here
01:41:30
this is otherwise possible only under the condition
01:41:31
condition arcs equals one
01:41:34
because we have already read this
01:41:36
read the second one and that's it
01:41:38
accordingly, it is possible for us only with
01:41:41
Kadish narc equals dice let's move on
01:41:43
next now if candychan arks not
01:41:46
equals zero
01:41:48
that is, to be more precise, not orcs from lost
01:41:51
sorry lost
01:41:53
if the condition was not closed then we
01:41:57
what do we do first we push the values
01:42:01
a mole to which everything will be compared
01:42:05
because 0 is the default in ours
01:42:07
language will fall we took what we do
01:42:10
here we do the same via output
01:42:12
Then we compare if the final result is this
01:42:17
here's an expression we didn't make
01:42:20
equals zero then it is true
01:42:23
accordingly what we do we must
01:42:25
for jumpy c
01:42:26
that is, in this case ld.
01:42:30
we have to get hooked people and here it is
01:42:33
counter must be specified counter -2 then
01:42:38
there is minus 2 indicates the very first
01:42:39
expression
01:42:40
well otherwise it should be pointed to the first
01:42:44
expression and here we will simply have
01:42:45
jiang that's all in this way and that's it
01:42:52
here we have continue in this case
01:42:54
I don't need to do anything because
01:42:56
that these functions are more accurate than instructions
01:42:59
they eat two arguments by default
01:43:02
that is, they don’t return them back to back and that’s it
01:43:04
Well, then what do we do, we check
01:43:07
if condition arcs is zero then
01:43:12
with us everything ends successfully differently
01:43:15
ends with one well in this
01:43:19
case as you already understand
01:43:24
the conditions will no longer be met because
01:43:26
What is air conditioning OJSC RKS
01:43:30
there are only two conditions in fact
01:43:33
if candychan arcx is not zero
01:43:35
this indicates an error
01:43:38
Well, basically everything is this way we
01:43:43
Really implemented all the functions
01:43:46
now let's take out their prototypes
01:43:48
to the top that is, in this case include
01:43:51
laut further here if in is scary for us
01:43:54
necessary before fiennes is scary
01:43:55
register ax we are looking for water fiennes
01:44:00
scary and we need more percent
01:44:07
construction let's write
01:44:09
the percentage is scary copy and paste
01:44:15
tags in theory we've done it now let's
01:44:18
let's try to compile compile
01:44:22
that is, we write make build so more precisely
01:44:26
come back here we'll write a Mike build and
01:44:31
let's see so first of all let's
01:44:33
let's check, oh yeah here arks
01:44:38
we have to establish and check now
01:44:41
39 before counted 39
01:44:46
Arks, yes, orcs, of course, orcs further
01:44:50
what else are we doing? thought it was 42 a
01:44:55
By the way, I didn’t forget to indicate this here, yes
01:44:58
Of course I forgot the ritual. si us
01:45:02
Of course you still need to compile
01:45:04
so on here
01:45:08
translate resource of course, so let's do it
01:45:11
let's run it like this, let's check all the errors
01:45:15
which we had first is a ritual
01:45:18
184 let's check 184
01:45:23
this is Arts Arks with us, of course
01:45:27
tags yes
01:45:31
arcs we don't have here we need
01:45:35
Arks of course, let’s register further
01:45:38
Further
01:45:39
tax 255 let's go like this 255 255 argument but
01:45:49
there's no escape here
01:45:51
park let's move on so passing argument a
01:45:57
[music]
01:46:00
well yes 274 so let's move on there's still left
01:46:11
a little like this 379 let's go like this output here
01:46:19
remove this update like this 496
01:46:28
496 what do we have here declare that arcs
01:46:35
here before
01:46:36
on the house arts paint of course tags
01:46:40
compile further 505 like this
01:46:56
so wait we have something else
01:47:00
directly assumed let's
01:47:05
let's try to look at it, but yes here
01:47:09
there is simply no need to indicate it
01:47:14
so on, let's compile again
01:47:19
and here 523
01:47:21
so with wrong porn and expression yes
01:47:26
of course here?
01:47:29
we compile everything here
01:47:31
compiled I hope I hope we have
01:47:34
everything will work now, so what if it doesn’t
01:47:37
it works, I'll try to figure out why it is
01:47:39
didn’t work so well first of all
01:47:41
let's define this file
01:47:45
that is, in this case we go to in
01:47:49
cloud then go to VMS and then write
01:47:54
this is the navy and let's try to describe it in
01:47:58
in this case what are we doing we are the label
01:48:00
do further label plus it speaks about
01:48:03
function as it will be called below
01:48:06
need to load two lauth arguments
01:48:08
-3 in this case what is it why exactly
01:48:13
-3 address the whole point is that
01:48:15
the first argument is what address it is at
01:48:17
there is 1, that is, we skip the address
01:48:20
associated with this very mark gave two
01:48:23
this is the second argument and 3 is the first
01:48:25
the argument is exactly the same with the second one, that is
01:48:27
1 2 and 3
01:48:28
that is, we take the second argument further
01:48:30
we use the ap operation that is
01:48:32
we add these two values ​​and the result is this
01:48:35
operation in this case this operation
01:48:40
returned only one value
01:48:41
accordingly this value is for us
01:48:43
must be saved, that is, indicate
01:48:46
minus 4 minus 1 why minus 4 that is
01:48:48
this is 1 then 23 skip the second
01:48:51
argument and 4 Matt the fourth argument we save then
01:48:54
there is all conservation will occur
01:48:56
only on the first argument, well
01:48:59
accordingly, what do we do next?
01:49:00
that is, we release this stored
01:49:03
meaning and
01:49:04
return the result of the function all
01:49:07
save and now let's try
01:49:09
run that is clear
01:49:12
further let's here as here through us
01:49:16
when this is all done, well, let's try
01:49:20
so indicate in a moment tags
01:49:24
we have 0 back, well let me try
01:49:27
see what we need of course
01:49:33
let's try to start it again
01:49:35
Let's check that we have returned the value 5
01:49:42
finally we have already developed something
01:49:45
ok now let's check it out
01:49:48
does it work with big big
01:49:50
humidity, let's say we'll be here, well
01:49:53
more precisely
01:49:54
first on initial nesting
01:49:56
check the question 244 plus 37 works
01:50:00
then we check another nested like this
01:50:03
let's get more nested here
01:50:05
let us have deuces everywhere so that
01:50:08
easier to check check 14 times two three
01:50:13
4 5 six 7 before this 14 next we can
01:50:16
nesting somewhere else here
01:50:18
do check 18 times two three 4 5 6 7
01:50:24
8 9 9 multiply by 8 us is correct and look
01:50:28
what are the interesting features of this one
01:50:30
the very function from well that we wrote
01:50:32
in assembly language directly it
01:50:36
it works quite normally, that is, it
01:50:39
works like normal function of this
01:50:41
the language itself is not
01:50:44
do you know a separate operation like
01:50:46
let's say in imperative languages ​​where there
01:50:49
let's say the operation is built in by default
01:50:51
plus by default stitched operations
01:50:53
multiply and divide subtract and so on
01:50:55
in this language these operations are
01:50:57
ordinary functions and we can also
01:50:59
how to connect a regular function but it’s true
01:51:01
the only exception here is that these
01:51:04
operations can only be implemented if
01:51:06
using assembly language, that is, more
01:51:08
low level but nevertheless their
01:51:10
Can be connected as normal functions
01:51:13
and let's see how we have this code
01:51:16
at all transferred to
01:51:19
assembly language representation
01:51:21
that is, in this case, look we
01:51:24
created
01:51:25
label label start which is
01:51:28
the beginning but in this case we are under the beginning
01:51:30
as you understand, did the following wherever
01:51:34
this mark was not there let's find it already
01:51:37
in the end so stop start yes there you go
01:51:44
she is a mark and we made her first
01:51:46
then we connected this one
01:51:48
the assembly code that we indicated is like this
01:51:51
let me restart this
01:51:53
we forget that everything can be seen there
01:51:56
everything here is finally working for us
01:51:59
then so and this is the same code it’s simple
01:52:03
how copied let's go here
01:52:05
again turned on, it was simply copied
01:52:08
Next, what do we do? We call the function.
01:52:11
mine and here it started
01:52:13
that is, by the way, let's do this operation
01:52:16
let's make pop more beautiful
01:52:17
where we have here pop pop yeah right here
01:52:21
hear you do and here also hear you and
01:52:25
here red hear
01:52:28
or compile back and look at the code
01:52:33
like this again somewhere no means no
01:52:37
that place right here you can hear again
01:52:43
piri-piri we compile more and more than me
01:52:49
it's beautiful here as you see all these
01:52:51
operations are collected in this case as well as
01:52:53
you see this translator here already
01:52:56
able to analyze quite well
01:52:58
action must be performed in what
01:53:00
okay, that is, he is capable in the first place
01:53:05
process the entire linear
01:53:06
subsequence
01:53:07
given if the media follower is
01:53:09
linear it is already distributed between
01:53:11
look at how you can these
01:53:13
sequences linear and nonlinear
01:53:14
let's do this in this case
01:53:16
removing here let's say 2 and 2
01:53:19
let's compile and check the result and here it is
01:53:23
two plus two
01:53:24
that is, in this case, everything is yours
01:53:26
Fine
01:53:27
countries merged let's go further further we
01:53:29
we can make it linear
01:53:30
the sequence is like this and
01:53:34
we are pushed push push push and then this
01:53:37
the transmitter remembers what we had
01:53:39
some meanings and these meanings were
01:53:41
it will be nested accordingly
01:53:43
perform a certain task every time
01:53:44
withers procedure
01:53:46
but at the same time if it is not
01:53:48
linearity
01:53:49
that is, in this case it’s not
01:53:51
is linearity, let's see what happens
01:53:54
us here
01:53:55
22 plus gave 2 plus because
01:53:59
impact first calculated this
01:54:01
passed this was calculated together with this and here it is
01:54:05
so that's how it is and in the end that's basically it
01:54:08
we can already do the expression now
01:54:11
let's try to implement everything
01:54:14
a list of ordinary khaman is acceptable there
01:54:16
add multiply and divide subtract this
01:54:19
we must do everything with the help of language
01:54:21
assembler, but nevertheless, by the way, you can
01:54:25
to say that we are multiplying in fact
01:54:27
we can do it through addition and let's
01:54:29
We'll try to do this later, of course.
01:54:31
this is all
01:54:32
let's translate it into assembly language so that it is
01:54:34
more efficient because multiplication
01:54:37
of course you can do this through addition
01:54:39
but still we can do it
01:54:40
let's do it, we multiply here
01:54:43
this is how we will call it
01:54:45
here x y and what we will do in
01:54:48
first we will check the example if y
01:54:52
will be equal to tea or and will be
01:54:56
dress
01:54:58
let's say zero then return 0 that is
01:55:04
this is 0 0 otherwise if we have y here
01:55:12
less than 0.
01:55:17
let's do it the other way around here y is greater than 0 we
01:55:22
multiply x by x by x principle then
01:55:30
multiply x by here x and then this is more accurate
01:55:36
add apologies here when
01:55:37
give him the pressure
01:55:39
perform this operation x and here we are
01:55:42
subtract one from the game
01:55:45
y is one otherwise we return one
01:55:51
01 well let's try this me now
01:55:54
To be honest I haven't checked this code
01:55:56
we'll try to make it but we need it for this
01:55:58
I need another operation to do this
01:56:00
let's try to do it ourselves and describe it
01:56:04
sub navy and here we change the minus sign
01:56:09
and here we further connect here with us
01:56:20
there will be a garden
01:56:22
let's do sap like this and here
01:56:26
we will be here again by the way
01:56:29
to say what we will have here
01:56:30
Hitler you
01:56:31
We will also have more equality, well
01:56:36
that is, we will have conditions, let's give them
01:56:39
Let's also add that in this case and
01:56:41
qual. we will do a naval force and then we will have
01:56:45
also glitter. navy
01:56:51
if I'm not mistaken then we are we greed
01:56:54
or we use this yes yes we use
01:56:57
grid let's try to implement them
01:56:59
directly that is in this case
01:57:00
what are we doing we are creating a label
01:57:02
equals equality further load
01:57:05
first argument load second
01:57:06
argument
01:57:07
further if that is in this case if
01:57:16
they are equal these two arguments then we
01:57:18
should go to this very label label
01:57:22
equals 0 otherwise here we also have
01:57:25
there should be another mark
01:57:26
which will be equal to one and also
01:57:29
we also have to have it otherwise
01:57:33
label called like label and here
01:57:38
like this here she will just take
01:57:40
the result and put it into the value minus 4
01:57:44
we'll have it here
01:57:45
Herod further here we are what are we doing
01:57:51
unit and Jenkins on n that is
01:57:55
equals m, otherwise here we push mole and
01:57:59
basically everything is like that until we push it says
01:58:12
about the fact that our value does not equal that
01:58:15
there is accordingly here john equals
01:58:17
1 everything is like this, that is, if
01:58:21
these two values ​​are equal then it will return
01:58:23
units if these values ​​are not equal
01:58:25
when will mine come back everything is like this
01:58:27
usually we copy exactly the same way
01:58:29
insert oh .
01:58:31
sorry to grid we translate here
01:58:34
there will be more further here more more
01:58:38
here we change everywhere this is a sign more
01:58:43
more and here is Jack Ritter in principle
01:58:47
that's all we do now let's get here
01:58:49
let's connect this dream mushroom and then here
01:58:56
there will be more of us, so come on
01:58:59
let's check if we have it at all
01:59:01
first of all let's just run it like this
01:59:04
us
01:59:05
translation error translation error could
01:59:08
and let's remove it like this accordingly
01:59:11
somewhere there is a mistake here let me
01:59:15
I'll try to analyze it now
01:59:17
I'll be back so I fixed the mistake, I'm here
01:59:21
even in a row who is this code but the error
01:59:23
It happens
01:59:24
the main thing was not that they were here
01:59:27
certain mistakes made in the code
01:59:30
translator firstly I added air conditioning
01:59:33
claus equals one in if statement
01:59:37
that is, they were here secondly
01:59:40
also mistakes made in define
01:59:43
instructions let's find them a year ago
01:59:46
the file the larger the unit became wild n
01:59:49
more than zero here was the same thing wild n
01:59:52
the more one became the more 0
01:59:55
that's all, that is, these are the main ones
01:59:58
mistakes I made sadly from the rules and
02:00:03
now let's check and here we have
02:00:05
how the algorithm works it doesn't work with
02:00:07
odd numbers but nevertheless he
02:00:09
work with black numbers here
02:00:11
checked if y equals zero then
02:00:15
and return 0 further if y is greater
02:00:19
units
02:00:21
then what do we do we from and we
02:00:27
add X to the result of this one
02:00:29
recursive function that is, we refer
02:00:31
on itself in this recursive
02:00:33
function we also add x that is x
02:00:36
does not change but is subtracted from the game
02:00:38
one and further if y is still not
02:00:43
greater than one and not equal to zero
02:00:46
this means that y is equal to one
02:00:49
we return x that is to zero
02:00:52
add x and check what we have
02:00:54
it turns out 15 that's right now let's
02:00:57
let's try some other value
02:00:58
well let's say 10 in the end we have to
02:01:02
get 50 get 50 try 1000
02:01:06
we get 5 thousand, everything works but
02:01:09
this algorithm, as you understand, is not
02:01:10
effective because it is in this case
02:01:12
uses multiplication through addition
02:01:15
respectively for a similar
02:01:18
optimization we what can we do
02:01:21
we can just move this multiplication
02:01:24
from high level language to low level language
02:01:27
level thereby optimizing our
02:01:29
source code final more precise code let's
02:01:32
let's try to do it enough
02:01:33
easy, that is, we'll just make a mule.
02:01:36
VMS and here we simply add multiplication
02:01:40
here we change it for us
02:01:41
because our virtual machine is
02:01:44
supports multiplication operation
02:01:46
Well, accordingly, what do we do?
02:01:47
we delete all this, we delete it in fact
02:01:50
that's all, that is, we are now just
02:01:53
change us check here we get that one
02:01:57
the same result and this is basically the case
02:01:59
we are all successfully functioning and working
02:02:03
now let's try it all
02:02:04
you lose with such operations then
02:02:07
yes let's add
02:02:08
subtraction and we have already done subtraction
02:02:11
let's add a div division. we do naval forces here
02:02:17
div here do deep added let's
02:02:21
Let's turn it all off here and concentrate
02:02:27
only with this code now what
02:02:31
we can still add
02:02:33
we still have it, let's add it here
02:02:36
operations
02:02:37
more and not equal even less and not equal
02:02:42
VMS further add here let us
02:02:46
will not be equal
02:02:48
fact not equal not exactly not equal we all
02:02:54
it's all added here
02:02:55
g not equal we change all this we don’t
02:03:01
let there be quality and we should too
02:03:05
be a lawyer well let's change that
02:03:07
number . Navy here we have this sign
02:03:12
let's try to change it to the opposite
02:03:14
we directly change it all with us
02:03:20
there is a new feature now that we
02:03:23
more we can do here we can by
02:03:25
in fact
02:03:26
write this function that will
02:03:31
return other functions to us because
02:03:32
by default our language does not do this
02:03:35
capable but let's try it
02:03:37
we'll do the next label
02:03:40
then we indicate the ricker and here we are
02:03:45
we do we load the first argument
02:03:47
and we return the same argument
02:03:51
-1 do for red in the end this way
02:03:55
we will be able to return it ourselves
02:03:58
functions as the result and this is
02:04:02
quite useful because it's us
02:04:04
can be used in these very
02:04:05
arguments let's try this
02:04:07
directly done using
02:04:10
eterno let's have it here
02:04:12
define let's say it x y let's say x here
02:04:18
plus y let's add this right away
02:04:23
So
02:04:24
in cloud navy and . navy
02:04:27
Well, let's also add this same red
02:04:31
Danish Navy
02:04:33
let's also add a comparison operation
02:04:37
navy
02:04:38
and qual. Danish Navy what we do we
02:04:41
we can multiply here
02:04:43
values ​​that is, we can make mun
02:04:47
do it like this we will have it
02:04:49
function definition look like so on
02:04:52
what can we do we can do
02:04:54
the following make conditions if let's
02:04:59
although we’ll do it you know how through a separate one
02:05:02
let's say the function will be with us for a year
02:05:06
and here we will have some
02:05:07
parameter x further if x equals
02:05:11
zero then we will have to return
02:05:13
functions
02:05:14
otherwise it will come back in the face of a mule
02:05:18
and see what crazy things we can do
02:05:21
g let's here my grandfather that is this
02:05:27
addition and we now apply this
02:05:30
operation that is, we return from and
02:05:32
we can do the following let's say 53
02:05:35
let's check if we have it
02:05:37
function we got the result
02:05:40
8 that is, the function from now we is returned
02:05:43
we can change this to one let's check
02:05:45
we returned the value 15 and at the same time
02:05:48
we can use the same
02:05:50
returned result as result
02:05:53
another function as argument another
02:05:54
functions that is define let's say set f x
02:05:57
y and what we'll do we'll just apply
02:06:00
f by x y and see what we have in
02:06:03
plus let's even do this
02:06:05
let's say plus 1 and here we will do more
02:06:10
so we check plus 2 as an example
02:06:16
the result was 35 and added 6 4
02:06:20
added to three added 2 that is
02:06:23
further here we got 5 here y
02:06:26
we got it more precisely here
02:06:28
it turned out 6 here it turned out 5 next we
02:06:31
applied function f and function f is
02:06:34
multiplication and in the end we multiplied 6 again
02:06:37
multiplied by 5 and got the result 30
02:06:39
this is basically how we
02:06:42
constructed higher order functions then
02:06:44
there is a function that can accept
02:06:48
includes other functions and which are capable
02:06:50
return other functions i.e. this
02:06:52
called higher order functions
02:06:53
quite an interesting concept and it’s in
02:06:56
basically makes programming easier
02:06:57
very much so and so we are
02:07:02
done only with the help of the fact
02:07:04
the main functions are like this
02:07:08
reacts like this:
02:07:09
returns another function
02:07:10
well now let's do some more
02:07:12
any other functions that are already
02:07:15
will find which will already be
02:07:17
be these functions of this very
02:07:19
language let's call it here under loading as
02:07:23
let's say gender is part of this language
02:07:26
well here's what we're going to do let's
02:07:30
here we will immediately delete it and here we will be
02:07:35
do the following let's say here
02:07:40
let us have no logical
02:07:42
operations that is, we do not have operation and
02:07:44
it's a sour note let's try them
02:07:47
implement and let's say here hall and
02:07:52
and can be implemented as follows
02:07:54
so here we have plus will be define
02:07:58
let's include the schema syntax here
02:08:04
this can be implemented quite easily
02:08:06
that is, we take two arguments x and y
02:08:08
further if x is not equal to zero then
02:08:15
check the following condition
02:08:17
otherwise we return 0 further if y is not
02:08:23
equals zero then we return here
02:08:29
0 and here we return units this is an operation
02:08:33
and we can, in principle, even
02:08:34
try to do it, that is, let's
02:08:36
let's dive into the cloud further
02:08:38
[music]
02:08:40
include all and .
02:08:43
and also don’t forget about these same ones
02:08:47
Let's just say these functions are not
02:08:49
will show the automatic VMS does not load
02:08:52
functions according to the necessary fax
02:08:55
again nothing is loaded here
02:08:57
it's expensive, we need to load
02:09:00
additional functions, that is, no
02:09:01
equals and plus well let's do it
02:09:04
let's try to do this IUD further, but you
02:09:08
qual and exactly the same, we also change the IUD
02:09:13
and then that’s all, use the and no function
02:09:19
1 and 0 let's say so here we have what
02:09:28
that's not true
02:09:33
well, let me try to go back and
02:09:35
check error
02:09:37
Well, of course I stepped, I loaded
02:09:42
high level language to low level
02:09:45
languages Lord we have this low level
02:09:48
languages ​​accordingly we do in the cloud
02:09:49
and load this function now
02:09:51
everything is checked by the writer 0 everything is more correct
02:09:57
let's try with one liqueur one all
02:10:00
that's right, next we'll try with zeros
02:10:03
0 everything is correct, that is, in the end we have
02:10:06
the and operation works successfully now
02:10:09
let's try with other operations
02:10:11
we implement other operations in the same way
02:10:13
here we will add about .
02:10:16
all and try this very operation
02:10:18
implement that is in this case
02:10:20
define well, let's go without backlighting
02:10:23
syntax for x and y and we will have here
02:10:26
the following if x is not zero then
02:10:33
we add one, that is, then
02:10:36
the mass is returned directly
02:10:37
units otherwise what do we do if y is not
02:10:42
equals zero then we return
02:10:47
unit
02:10:48
otherwise we return zero zero that is, otherwise
02:10:51
this will indicate that x is 0 and
02:10:54
y is equal to 0 and that’s all, now let’s dive
02:10:57
the same operation
02:10:58
and check
02:11:03
unit
02:11:04
true 0 here we have units
02:11:07
that's also true yes I'm here let it be 01
02:11:10
true and check with zero true here
02:11:14
so we have implemented now
02:11:16
let's try the laptop operation
02:11:17
implement all these operations for him now
02:11:20
let's say we implement it and our language will be
02:11:22
to have at least some kind of
02:11:24
library and in this case define further
02:11:27
not x this is what happens if x equals
02:11:32
zero then accordingly we have
02:11:34
[music]
02:11:36
returns units that is how back
02:11:39
otherwise it returns 0 that's all and now
02:11:44
let's try
02:11:46
let's implement it right away
02:11:51
By the way, these are all the functions so that they don’t exist
02:11:53
no problems there
02:11:54
and qual further under detailed functions logo
02:11:58
bath for other functions glitter and
02:12:02
other functions
02:12:03
addition, multiplication, subtraction, and so on
02:12:05
further further
02:12:09
and div than all these functions
02:12:14
cut directly and further from us
02:12:18
there will be more flux and come on, here it is
02:12:21
takes only one argument
02:12:22
check one if we are one
02:12:26
we transmit 0 all the lightest logical ones
02:12:31
we completed the operations what about who
02:12:33
that is, as you know in languages
02:12:35
programming in addition to operation and
02:12:38
or but there are no logical ones
02:12:41
Still such an operation is like rubbish, it is very
02:12:43
often used on certain
02:12:45
numbers but nevertheless let us give it
02:12:47
implemented in the form of a logical
02:12:49
The operation is not a bit one, but a logical one
02:12:52
let's try to do this too
02:12:54
It's somewhat easy to do, but more difficult
02:12:57
here we will try let's use
02:12:59
comments and syntax highlighting here
02:13:01
in principle, it will be useful for us, let's quarrel and
02:13:05
further here we will define variety x
02:13:09
or in this case to determine
02:13:11
function cos x y
02:13:13
need to do the following first
02:13:15
apply an operation on two arguments then
02:13:18
there is first argument both must argument
02:13:22
about going through
02:13:23
and but here we have business next in
02:13:25
first notes x y
02:13:27
and secondly, here x is a raccoon y that’s all
02:13:31
accordingly we need this
02:13:33
implement that is, in this case it’s time
02:13:34
next and let's go here
02:13:37
and end we will do here not x y
02:13:42
and here x0 y0 all this is the whole operation
02:13:48
give it away and import it but to
02:13:50
import we need to connect
02:13:53
operations about which she is from
02:13:58
depends and directly in fact we
02:14:00
we can do all these clubs in these
02:14:02
files, that is, which depending on
02:14:05
some other files, that is, nothing
02:14:07
such
02:14:08
Let's just say there's nothing criminal about it, but
02:14:11
nevertheless, in this case we are all this
02:14:13
let's do it here now let's do it
02:14:16
what does ksor do if these are numbers?
02:14:21
different that is, if the bits are different it means
02:14:23
will return ones if the bits are the same
02:14:26
it means it will return 0 let's check the make
02:14:29
and returned 0, then check with zeros
02:14:32
returned 0, then check with one and 1
02:14:36
returned to the bath units, check here
02:14:39
the unit returned, we sold everything according to
02:14:42
fact in sight now let's get down to it
02:14:44
some other functions are allowed
02:14:46
modulo division is very common
02:14:50
function is often used and very
02:14:52
useful firstly it is often used
02:14:55
in certain algorithms similarity
02:14:57
greatest common divisor but in addition to
02:14:59
everything else it is used for
02:15:01
definitions of numbers are neither even
02:15:03
or odd
02:15:05
and let's try to implement this
02:15:07
the function itself and and we can implement
02:15:08
using division after the fact, subtraction and
02:15:12
multiplication and let's try this
02:15:15
do that is, in this case we create
02:15:18
new feature called like mod.
02:15:24
so here right away this is nothing we are not
02:15:27
we will use here we will have
02:15:29
stick further and here mod.
02:15:32
let's try to do it in this
02:15:34
case we can make a mod let's say
02:15:37
groan, well, let's say 20 let's say 27 3
02:15:43
give 0 here we define mod mod will be
02:15:48
be determined as follows, that is
02:15:50
x y equals x minus y times
02:15:55
by x divided by y this formula is
02:16:00
modulo division accordingly we
02:16:02
we can easily implement that is mod x y
02:16:05
we continue to do what we do first
02:16:08
subtraction that is, x is subtracted from to
02:16:11
multiplication by y and what we do next x
02:16:15
we divide everything by y in this way
02:16:18
it's implemented now let's try it
02:16:22
we check and we have returned the value 8 in
02:16:28
in this case, of course it is enough
02:16:31
it’s difficult to edit although what am I talking about here
02:16:34
there is always a calculator at hand groan
02:16:38
divide modulo by 23 8 everything is correct as you
02:16:41
see we really already have it
02:16:43
it works and we implemented it as you can see
02:16:45
functions in fact from scratch, that is, we
02:16:47
we use only the basis of the language
02:16:50
programming we use its core
02:16:52
and here the important principle is functional
02:16:55
language they are good at they always have the core
02:16:58
very small, that is, I don’t really know
02:17:00
let's take the same sheet core
02:17:03
just minimally that is, well, as you can see
02:17:05
indeed this is so next let's take that
02:17:08
same husky core if you look at it
02:17:10
the core is just as minimal, that is
02:17:12
it defines certain
02:17:14
basic functions basic instructions but
02:17:16
thanks to them these instructions are very helpful
02:17:19
grow, that is, let’s say from three
02:17:22
basic instructions we can hundreds of others
02:17:24
give rise to this very useful property
02:17:27
and in this case we apply the same
02:17:29
the most criterion let us now thanks
02:17:31
mod functions we implement functions
02:17:34
[music]
02:17:36
so let's say the receiving function is
02:17:39
number
02:17:40
whether the number is even or odd
02:17:43
let's try to do this, that is
02:17:44
even number first
02:17:47
it will be implemented as follows
02:17:48
define Ivan Tax define ln x and in this
02:17:54
case, what do we do if mod x by 2
02:17:59
will be equal to zero this is all Ivan in
02:18:02
basically let's chop him down
02:18:05
of course, mode dependence is used
02:18:07
that's why we don't remove it anywhere and now
02:18:09
let's check lm-100 whether it will be up to
02:18:14
units
02:18:15
Well, let's say there's 124 multi it up to if
02:18:20
we will do 125 will definitely come back mine
02:18:23
as you can see everything works for us
02:18:25
let's go and further we can also chop
02:18:28
from that is, not parity in this case
02:18:32
we can express from via Ivan either
02:18:34
express it in exactly the same way only not equal
02:18:37
register and in principle this is accurate with us
02:18:40
should also work, that is, in this
02:18:41
in case we just change to from and now
02:18:44
checking
02:18:46
now we should return unit a
02:18:49
if we do 124 should right should
02:18:52
return 0 that's right right now let's go
02:18:54
further further we can do the construction
02:18:57
exponentiation well exponentiation
02:18:58
it's quite easy to do
02:19:00
that is, let's have a floor here. let's do a wolf
02:19:04
and here we will write the construction function
02:19:06
to the power, that is, x y, let’s raise
02:19:09
in the chicken cap next what we have
02:19:11
done here
02:19:12
if y is less than one then we do
02:19:18
next we return one otherwise we
02:19:21
multiply
02:19:22
x to the result of this very function x from y
02:19:26
minus 1 is actually like multiplication
02:19:29
the most was y minus 1 now let's
02:19:33
let's check what it is, that is, multiply
02:19:37
let's say 2 by 10 here we connect the floor and
02:19:44
basically there seems to be no dependencies
02:19:47
No Let's check so the units are back now
02:19:53
if y is less than one then something is here
02:20:04
obviously not true, so let's check additionally
02:20:06
us and
02:20:07
x y if y is less than one then return
02:20:12
1 so let me see, I'll come back
02:20:18
looked around and came back here we need
02:20:21
I just had to transfer the tax here
02:20:24
forgot there was a g-grip here
02:20:26
I have now applied to so here we don't have
02:20:31
no more mistakes like this gin you
02:20:34
qual next
02:20:39
it seems there were no such errors and here we are
02:20:41
This function doesn’t seem to exist anywhere else
02:20:45
used yes if I'm not mistaken of course
02:20:47
in theory, it seems like nowhere else
02:20:49
used ok now let's check
02:20:52
returned 1024 everything is correct that is two
02:20:55
evolved to the power of 10 here we also
02:20:59
we can let him have 5th degree there
02:21:01
let's say 5 returned such a number 5 in
02:21:04
power 2 we can through this function
02:21:07
let's express another function as under
02:21:09
name like square x and then we just
02:21:11
Can
02:21:12
raise pix to the power of 2, let's do it
02:21:15
let's try to do it here
02:21:16
square 5 check it turned out 2511
02:21:23
it turned out to be 120, that is, in this case,
02:21:25
it all works correctly for us
02:21:28
now let's continue
02:21:30
we can also do negative things
02:21:32
number, that is, just change the sign of it
02:21:34
the very date let's try it
02:21:36
make nickname
02:21:37
and in this case it will look like
02:21:39
define nickname x as follows and here
02:21:42
this is all done quite easily minus
02:21:44
0x we are all checking whether we will have it
02:21:49
work let's say nickname 11 the same
02:21:51
the number here is a sign by others we check like this
02:21:56
but for some reason it didn’t happen here anymore
02:22:01
why so nick nick
02:22:05
x Well, in theory, everything is correct here, if not
02:22:09
I'm wrong
02:22:10
of course, let me check
02:22:12
again what is the problem
02:22:14
well, the problem is quite enough again
02:22:17
I'm stupid, I'm just Agnes, Nick VMS, let's do it
02:22:21
Here we define this not as a book.
02:22:23
further here vms here delete this file
02:22:27
to all my friends now let me be here
02:22:30
Nick 11 experimented a little here and
02:22:33
insert that here we have 11 here we have
02:22:36
maybe some other number
02:22:38
well, and accordingly if the number is minus
02:22:40
she is also considered a plus
02:22:42
but in this case we can also minus
02:22:44
express it a little differently, well, let’s say
02:22:47
minus 0 and then minus by minus gives
02:22:50
directly plus so now let's go
02:22:55
further we basically have more functions
02:22:58
there is little left so we
02:23:00
we can implement them and well, first of all
02:23:02
let's try to implement the function
02:23:03
max and y that is, in this case it’s simple
02:23:06
take the maximum number from two numbers
02:23:08
define further max x y and further if x
02:23:15
more y and this means that we
02:23:18
need to return them accordingly
02:23:19
do plus 0x otherwise we do plus 0 y
02:23:23
and in principle all this is max
02:23:25
now we are making a meme that is. him and her
02:23:30
we write exactly the same way, that is, died
02:23:31
only here we make a minus and in principle
02:23:34
everyone now what else can we do we
02:23:39
we can implement the function less or
02:23:41
equal to or greater than or equal to
02:23:44
functions that we don’t have by default
02:23:47
in a virtual machine the edge of the virtual
02:23:48
there are only 4 conditional
02:23:51
function this is not equal to less than or
02:23:53
there is no longer a function less than either
02:23:56
equals and there is no function anymore either
02:23:58
anyway, but in fact we can
02:23:59
implement this in a high-level language and
02:24:02
let's try to do it easily, that is
02:24:04
let's implement the function let's call it as
02:24:11
greater than or equal to equol.
02:24:16
and here we will do the following that is
02:24:19
define further done x y and further here
02:24:25
we'll make the next one if it's bigger
02:24:30
x is greater than y or x is equal to y
02:24:35
then we return directly
02:24:38
one otherwise we return 0 that's all
02:24:42
that is, in this case we did
02:24:44
let's try to see the next one
02:24:47
be it for us to work g aqua in
02:24:52
in this case greater than or equal to 55
02:24:55
let's check what happened here
02:25:02
let's see if x is greater than y and x
02:25:10
and here I apologize, I got confused here
02:25:14
let's restart so confused here
02:25:18
define is greater than or equal to x y danin
02:25:21
if here let's do it right away like this
02:25:23
we'll do it if we write it down here right away
02:25:28
here x is greater than y and x is equal to y then we
02:25:33
we return one otherwise we return 0
02:25:38
let's check like this
02:25:43
sorry here we have it coming back
02:25:47
-1 so let's see what we have
02:25:51
Here's the problem and I'll come back again
02:25:55
how I discovered the problem
02:25:57
Well, of course, this problem is also not in my mind
02:26:00
shines like the previous problem, here I am
02:26:02
I just forgot to connect it, that is, by
02:26:08
fact or operation and nothing more
02:26:10
let's check here we get
02:26:13
one was given if 5 is more than either
02:26:16
equals 10 mass will return of course 0
02:26:19
and if 5 is greater than or equal to three y
02:26:23
unit will return us, that is, in this
02:26:25
in the case of the north, based on this we also
02:26:28
let's try to make the operation smaller or
02:26:30
equal, that is, in this case we will do
02:26:33
lawyer and qual. v.m. Itachi's
02:26:36
I'm sorry and I tried it again here
02:26:39
make a laurel and a qual here.
02:26:43
he and here we will try to do this
02:26:47
is less than or equal to
02:26:48
and further here we can do the following
02:26:51
that is, both and
02:26:54
well, here we just change the sign
02:26:57
and nothing more
02:26:58
now we check here we do we check
02:27:04
here 5 is less than or equal to three no
02:27:08
accordingly we will return returned 0
02:27:10
further 5 5 unit returned further 5 and 11
02:27:16
came back alone while here with us
02:27:19
will return directly 0 so a jay
02:27:25
glitter will come back my that is in
02:27:32
In this case, in fact, everything is correct
02:27:34
now now we can in theory
02:27:39
let's implement some algorithm
02:27:41
let's try to make it easy there, let's say
02:27:43
factorial algorithm greek well there
02:27:45
fibonacci greatest common divisor
02:27:47
maybe and so on let's do it
02:27:49
let's try to do it right away in this case
02:27:52
we will simply assume factorial in other ways.
02:27:54
floor and here we will implement it all
02:27:57
let's say factorial of 10 in this case
02:28:00
if you remember that factorial is only
02:28:02
multiplication several times defined
02:28:04
numbers to yourself in this case
02:28:07
this is a fact x and equals further
02:28:10
compares if x is zero for you
02:28:15
will come back
02:28:16
units otherwise we will continue
02:28:18
factorization that is in this case
02:28:20
needs to be multiplied
02:28:22
x to the result of the function fact x minus 1
02:28:27
that's all, now we check 0 in this
02:28:30
case factorial and here we do not have
02:28:32
no dependencies used
02:28:34
checking the libraries, here we are back
02:28:38
the result is, in principle, the factorial is correct
02:28:40
is it equal to this then we can there
02:28:42
reduce the value let's say to 5
02:28:44
us factorial is now equal to such and such in
02:28:48
in principle, we can, by the way, besides everything
02:28:50
other things if we suddenly need
02:28:53
you know some kind of optimization because in
02:28:57
In this case we have tail recursion
02:28:58
tail recursion is used
02:29:00
ordinary linear recursion linear
02:29:03
recursion or even tree-like
02:29:04
recursions they are not optimized started
02:29:07
linear recursion capable of tail
02:29:09
redo and then using the tail
02:29:11
optimization of this very recursion has already
02:29:14
optimize into a loop
02:29:16
but nevertheless our high-level language
02:29:18
it does not support so we can by
02:29:20
in fact, rewrite this very factorial to
02:29:22
low-level language that is, a language
02:29:24
assembler and then run the same function
02:29:26
let's try to do that in
02:29:27
in this case we are for including now
02:29:29
only loot navy. fact . vms and copy
02:29:33
this is due to the benefit of virtual machines
02:29:34
this virtual machine already exists
02:29:36
function that is, here it is simply and and
02:29:38
copy and paste here
02:29:40
Let's create more precisely a fact file. bms leave
02:29:45
and in this way and now let's
02:29:48
let's run let's try to run mike and
02:29:51
exactly the same 120 that is, as you see we
02:29:54
already
02:29:55
connected this file but at the same time this
02:29:59
the file is more optimized because in
02:30:01
in this case there is no recursion here
02:30:02
we are not there, unlike this you know
02:30:05
how can we even check this in this
02:30:08
there is no point in checking here
02:30:10
of course, but here we can have
02:30:13
it makes sense to check here let's check here
02:30:15
we will register the gender here we will register it here
02:30:18
us fact of childhood it also works but
02:30:20
now we'll just go to the directory
02:30:22
We will connect this VMS file here next
02:30:28
assembly listing and further see
02:30:30
as we do here it’s more accurate to include all
02:30:34
let's clear my everything here in theory
02:30:40
owes us
02:30:41
file so oh sorry not that file
02:30:47
I see we should have it now
02:30:51
see the following code here
02:30:54
factorial and it now calls itself
02:30:57
that is, in fact these are recursive calls
02:30:59
the same factorial on the very
02:31:00
himself and only then does he collect all these
02:31:05
results and multiplies them like this
02:31:08
this way we actually get recursion but
02:31:11
she, as you understand, is enough
02:31:14
bad let's say and a view that is not
02:31:17
optimized normally and so on
02:31:19
let's try something else and
02:31:20
Fibonacci will not allow implementation
02:31:22
fibonacci but that's already a movie give me
02:31:25
aol and let's try to do this, that is, in
02:31:29
in this case
02:31:31
Fibonacci 0 is connected here fib and in
02:31:36
in this case define given fibonacci from x
02:31:40
further if x equals zero or x the
02:31:45
matter minus less than one then
02:31:48
return x otherwise
02:31:51
what do we have to return by the way here iv i
02:31:53
of course I forgot, let's lock here
02:31:56
it is very easy to get confused in fact in these
02:31:58
foliage expressions well one way or another
02:32:01
fibonacci x then if
02:32:06
Let us further assume that if x is less than one then
02:32:12
and return x otherwise what are we doing this by
02:32:15
the fact of addition, that is, Fibonacci
02:32:19
let's do the same here again
02:32:24
then fibonacci from x minus 2 x
02:32:29
minus 1, in theory, I’m checking to see if it will work
02:32:34
We generally check how it works
02:32:37
10
02:32:38
we launch the reader like this -55 why is that so
02:32:45
Why do we have a minus? Well, if x
02:32:52
and if x is less than two glues up to a year with us
02:32:55
55 now we can, well, let's say there's 8
02:32:58
check if it will be 22 next with us
02:33:02
2221 more precisely 21 + 13 should be 34
02:33:07
let's check here 34 yes that is with us
02:33:11
in this case it all works successfully
02:33:13
and 21 plus 34 equals 55 here in
02:33:16
basically everything is like this
02:33:18
we actually implemented the language
02:33:20
programming as you see it is quite
02:33:22
he works while he is clean
02:33:25
functionally high programming in
02:33:26
we can't bring any arguments here
02:33:29
put from a standard stream of water we
02:33:32
we can't get any arguments
02:33:34
standard output because we
02:33:35
we produce this conclusion through another
02:33:38
program, namely through a virtual
02:33:39
car
02:33:40
the virtual machine gives us the result:
02:33:42
the language itself it is not capable of this language itself yes
02:33:46
and in principle that concept of virtual
02:33:50
she can't do anything with a car
02:33:51
produce
02:33:52
input-output therefore the language is so clean
02:33:55
functional purely mathematical and
02:33:57
got it, in principle it is possible to solve
02:34:00
enough but as you noticed enough
02:34:03
there are a lot of tasks and that’s probably all
02:34:06
I hope I explained more or less clearly how
02:34:08
this is implemented like this is all
02:34:10
reproduced as much as possible
02:34:12
improve this language
02:34:14
to infinity we can still do a lot
02:34:17
a considerable number of different functions
02:34:19
add mathematically that works
02:34:21
with numbers because our language is
02:34:23
capable of working in fact only with
02:34:25
numbers but one way or another all the links I
02:34:30
Of course I leave it in the description there with
02:34:32
link to the virtual machine you are
02:34:34
you can download there and a link to this
02:34:36
the most programming language you can
02:34:38
you can check it
02:34:39
you can analyze it
02:34:41
edit well and that's it for now
02:34:43
everyone good luck everyone bye

Description:

Исходники: Виртуальная машина: https://github.com/Number571/CVM Язык программирования: https://github.com/Number571/ALLang Таймкоды: 00:00:00 - Введение 00:08:23 - Интерфейс программы 00:23:28 - Начало написания 00:32:28 - Функция readtall_src (интерфейсная функция) 00:44:28 - Функция _parse_code (главная функция анализа кода) 00:57:37 - Функция _include_instrc (подгрузка файлов расширения .all) 01:02:12 - Функция _load_instrc (подгрузка файлов расширения .vms) 01:03:30 - Функция _define_instrc (создание функций в языке all) 01:20:24 - Функция _proc_instrc (чтение выражений в языке all) 01:35:44 - Функция _if_instrc (условное выражение в языке all) 01:44:20 - Исправление ошибок компиляции 01:47:30 - Создание функции сложения 01:54:24 - Создание функции умножения методом сложения, добавление функции вычитания 01:56:30 - Создание функций условия на равенство 01:59:18 - Исправление ошибок в функциях _if_instrc и _define_instrc 02:01:08 - Перенос функции умножения на низкоуровневый код 02:02:02 - Добавление функций деления, равенства, возвращения функций 02:04:10 - Пример функций высшего порядка 02:07:11 - Создание логических функций and, or, not, xor 02:15:15 - Создание функций mod, even, odd 02:18:54 - Создание функции возведения в степень 02:21:30 - Создание функций neg, max, min, (больше или равно), (меньше или равно) 02:28:00 - Функция вычисления факториала 02:29:20 - Оптимизация факториала 02:31:18 - Функция вычисления чисел фибоначчи 02:33:15 - Завершение

Preparing download options

popular icon
Popular
hd icon
HD video
audio icon
Only sound
total icon
All
* — If the video is playing in a new tab, go to it, then right-click on the video and select "Save video as..."
** — Link intended for online playback in specialized players

Questions about downloading video

mobile menu iconHow can I download "// Алгоритмизация #9 // Язык программирования //" video?mobile menu icon

  • http://unidownloader.com/ website is the best way to download a video or a separate audio track if you want to do without installing programs and extensions.

  • The UDL Helper extension is a convenient button that is seamlessly integrated into YouTube, Instagram and OK.ru sites for fast content download.

  • UDL Client program (for Windows) is the most powerful solution that supports more than 900 websites, social networks and video hosting sites, as well as any video quality that is available in the source.

  • UDL Lite is a really convenient way to access a website from your mobile device. With its help, you can easily download videos directly to your smartphone.

mobile menu iconWhich format of "// Алгоритмизация #9 // Язык программирования //" video should I choose?mobile menu icon

  • The best quality formats are FullHD (1080p), 2K (1440p), 4K (2160p) and 8K (4320p). The higher the resolution of your screen, the higher the video quality should be. However, there are other factors to consider: download speed, amount of free space, and device performance during playback.

mobile menu iconWhy does my computer freeze when loading a "// Алгоритмизация #9 // Язык программирования //" video?mobile menu icon

  • The browser/computer should not freeze completely! If this happens, please report it with a link to the video. Sometimes videos cannot be downloaded directly in a suitable format, so we have added the ability to convert the file to the desired format. In some cases, this process may actively use computer resources.

mobile menu iconHow can I download "// Алгоритмизация #9 // Язык программирования //" video to my phone?mobile menu icon

  • You can download a video to your smartphone using the website or the PWA application UDL Lite. It is also possible to send a download link via QR code using the UDL Helper extension.

mobile menu iconHow can I download an audio track (music) to MP3 "// Алгоритмизация #9 // Язык программирования //"?mobile menu icon

  • The most convenient way is to use the UDL Client program, which supports converting video to MP3 format. In some cases, MP3 can also be downloaded through the UDL Helper extension.

mobile menu iconHow can I save a frame from a video "// Алгоритмизация #9 // Язык программирования //"?mobile menu icon

  • This feature is available in the UDL Helper extension. Make sure that "Show the video snapshot button" is checked in the settings. A camera icon should appear in the lower right corner of the player to the left of the "Settings" icon. When you click on it, the current frame from the video will be saved to your computer in JPEG format.

mobile menu iconWhat's the price of all this stuff?mobile menu icon

  • It costs nothing. Our services are absolutely free for all users. There are no PRO subscriptions, no restrictions on the number or maximum length of downloaded videos.