Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,050 --> 00:00:31,280
2
00:00:31,280 --> 00:00:31,290
3
00:00:31,290 --> 00:00:33,780
4
00:00:33,780 --> 00:00:33,790
hello friends of darknet I'm in will
5
00:00:33,790 --> 00:00:35,550
hello friends of darknet I'm in will
entereth and you can find me on Twitter
6
00:00:35,550 --> 00:00:35,560
entereth and you can find me on Twitter
7
00:00:35,560 --> 00:00:38,100
entereth and you can find me on Twitter
at Tarot jobs I'm super excited about
8
00:00:38,100 --> 00:00:38,110
at Tarot jobs I'm super excited about
9
00:00:38,110 --> 00:00:40,980
at Tarot jobs I'm super excited about
this event I've rambled about this on
10
00:00:40,980 --> 00:00:40,990
this event I've rambled about this on
11
00:00:40,990 --> 00:00:43,080
this event I've rambled about this on
Twitter I think I was a year ago when I
12
00:00:43,080 --> 00:00:43,090
Twitter I think I was a year ago when I
13
00:00:43,090 --> 00:00:45,720
Twitter I think I was a year ago when I
said how about I do a video series on
14
00:00:45,720 --> 00:00:45,730
said how about I do a video series on
15
00:00:45,730 --> 00:00:47,610
said how about I do a video series on
how to build a compiler from scratch and
16
00:00:47,610 --> 00:00:47,620
how to build a compiler from scratch and
17
00:00:47,620 --> 00:00:49,799
how to build a compiler from scratch and
then I never did anything with that
18
00:00:49,799 --> 00:00:49,809
then I never did anything with that
19
00:00:49,809 --> 00:00:51,870
then I never did anything with that
because it turns out I was super busy
20
00:00:51,870 --> 00:00:51,880
because it turns out I was super busy
21
00:00:51,880 --> 00:00:53,970
because it turns out I was super busy
doing other stuff but thankfully you
22
00:00:53,970 --> 00:00:53,980
doing other stuff but thankfully you
23
00:00:53,980 --> 00:00:55,830
doing other stuff but thankfully you
guys have all pinked me on regular basis
24
00:00:55,830 --> 00:00:55,840
guys have all pinked me on regular basis
25
00:00:55,840 --> 00:00:57,870
guys have all pinked me on regular basis
on Twitter and asked what's going on
26
00:00:57,870 --> 00:00:57,880
on Twitter and asked what's going on
27
00:00:57,880 --> 00:00:59,910
on Twitter and asked what's going on
there I want to see this amazing talk of
28
00:00:59,910 --> 00:00:59,920
there I want to see this amazing talk of
29
00:00:59,920 --> 00:01:02,220
there I want to see this amazing talk of
yours so I finally had the time to put
30
00:01:02,220 --> 00:01:02,230
yours so I finally had the time to put
31
00:01:02,230 --> 00:01:04,259
yours so I finally had the time to put
something together and today is the
32
00:01:04,259 --> 00:01:04,269
something together and today is the
33
00:01:04,269 --> 00:01:06,240
something together and today is the
first episode where we will start
34
00:01:06,240 --> 00:01:06,250
first episode where we will start
35
00:01:06,250 --> 00:01:08,790
first episode where we will start
writing the compiler some of you have
36
00:01:08,790 --> 00:01:08,800
writing the compiler some of you have
37
00:01:08,800 --> 00:01:10,200
writing the compiler some of you have
asked how long will it take to write the
38
00:01:10,200 --> 00:01:10,210
asked how long will it take to write the
39
00:01:10,210 --> 00:01:12,030
asked how long will it take to write the
compiler that's a good question I don't
40
00:01:12,030 --> 00:01:12,040
compiler that's a good question I don't
41
00:01:12,040 --> 00:01:14,490
compiler that's a good question I don't
quite know because my goal is to write
42
00:01:14,490 --> 00:01:14,500
quite know because my goal is to write
43
00:01:14,500 --> 00:01:16,830
quite know because my goal is to write
this live right so the today's episode
44
00:01:16,830 --> 00:01:16,840
this live right so the today's episode
45
00:01:16,840 --> 00:01:20,190
this live right so the today's episode
will be 60 to 90 minutes I will do a
46
00:01:20,190 --> 00:01:20,200
will be 60 to 90 minutes I will do a
47
00:01:20,200 --> 00:01:22,110
will be 60 to 90 minutes I will do a
demo of so I should say I already have
48
00:01:22,110 --> 00:01:22,120
demo of so I should say I already have
49
00:01:22,120 --> 00:01:23,880
demo of so I should say I already have
written the compiler so one of the
50
00:01:23,880 --> 00:01:23,890
written the compiler so one of the
51
00:01:23,890 --> 00:01:25,350
written the compiler so one of the
things that we'll do today is demo what
52
00:01:25,350 --> 00:01:25,360
things that we'll do today is demo what
53
00:01:25,360 --> 00:01:27,240
things that we'll do today is demo what
the end result would look like so you
54
00:01:27,240 --> 00:01:27,250
the end result would look like so you
55
00:01:27,250 --> 00:01:28,920
the end result would look like so you
get an idea whether it's worth you know
56
00:01:28,920 --> 00:01:28,930
get an idea whether it's worth you know
57
00:01:28,930 --> 00:01:31,410
get an idea whether it's worth you know
keeping keeping up with it or whether
58
00:01:31,410 --> 00:01:31,420
keeping keeping up with it or whether
59
00:01:31,420 --> 00:01:32,760
keeping keeping up with it or whether
you want to do something else with your
60
00:01:32,760 --> 00:01:32,770
you want to do something else with your
61
00:01:32,770 --> 00:01:35,880
you want to do something else with your
time yeah before we go into the details
62
00:01:35,880 --> 00:01:35,890
time yeah before we go into the details
63
00:01:35,890 --> 00:01:37,140
time yeah before we go into the details
of a few notes I want to go through it
64
00:01:37,140 --> 00:01:37,150
of a few notes I want to go through it
65
00:01:37,150 --> 00:01:38,970
of a few notes I want to go through it
to make sure we're on the same page so
66
00:01:38,970 --> 00:01:38,980
to make sure we're on the same page so
67
00:01:38,980 --> 00:01:40,320
to make sure we're on the same page so
we will be writing the compiler from
68
00:01:40,320 --> 00:01:40,330
we will be writing the compiler from
69
00:01:40,330 --> 00:01:42,570
we will be writing the compiler from
scratch so there will be no magic
70
00:01:42,570 --> 00:01:42,580
scratch so there will be no magic
71
00:01:42,580 --> 00:01:44,850
scratch so there will be no magic
compiler tools no parser generators is
72
00:01:44,850 --> 00:01:44,860
compiler tools no parser generators is
73
00:01:44,860 --> 00:01:48,210
compiler tools no parser generators is
just plain c-sharp the other thing is I
74
00:01:48,210 --> 00:01:48,220
just plain c-sharp the other thing is I
75
00:01:48,220 --> 00:01:49,830
just plain c-sharp the other thing is I
don't require any computer science
76
00:01:49,830 --> 00:01:49,840
don't require any computer science
77
00:01:49,840 --> 00:01:51,750
don't require any computer science
knowledge even though I have a computer
78
00:01:51,750 --> 00:01:51,760
knowledge even though I have a computer
79
00:01:51,760 --> 00:01:52,470
knowledge even though I have a computer
science degree
80
00:01:52,470 --> 00:01:52,480
science degree
81
00:01:52,480 --> 00:01:54,930
science degree
I think compilers are just you know as
82
00:01:54,930 --> 00:01:54,940
I think compilers are just you know as
83
00:01:54,940 --> 00:01:56,460
I think compilers are just you know as
any other software if you know how to
84
00:01:56,460 --> 00:01:56,470
any other software if you know how to
85
00:01:56,470 --> 00:02:00,150
any other software if you know how to
write it it's just a lot of fun we will
86
00:02:00,150 --> 00:02:00,160
write it it's just a lot of fun we will
87
00:02:00,160 --> 00:02:01,920
write it it's just a lot of fun we will
be using dotnet Korn Visual Studio code
88
00:02:01,920 --> 00:02:01,930
be using dotnet Korn Visual Studio code
89
00:02:01,930 --> 00:02:05,220
be using dotnet Korn Visual Studio code
both are free applications so you should
90
00:02:05,220 --> 00:02:05,230
both are free applications so you should
91
00:02:05,230 --> 00:02:06,930
both are free applications so you should
be able to download them and just follow
92
00:02:06,930 --> 00:02:06,940
be able to download them and just follow
93
00:02:06,940 --> 00:02:10,859
be able to download them and just follow
along without any any major requirements
94
00:02:10,859 --> 00:02:10,869
along without any any major requirements
95
00:02:10,869 --> 00:02:12,210
along without any any major requirements
and the cool thing is also both of them
96
00:02:12,210 --> 00:02:12,220
and the cool thing is also both of them
97
00:02:12,220 --> 00:02:13,589
and the cool thing is also both of them
are cross-platform so even if you're not
98
00:02:13,589 --> 00:02:13,599
are cross-platform so even if you're not
99
00:02:13,599 --> 00:02:16,710
are cross-platform so even if you're not
on Windows you should be able to keep up
100
00:02:16,710 --> 00:02:16,720
on Windows you should be able to keep up
101
00:02:16,720 --> 00:02:17,960
on Windows you should be able to keep up
with the talk um
102
00:02:17,960 --> 00:02:17,970
with the talk um
103
00:02:17,970 --> 00:02:20,339
with the talk um
yeah one thing I should say I am NOT a
104
00:02:20,339 --> 00:02:20,349
yeah one thing I should say I am NOT a
105
00:02:20,349 --> 00:02:22,920
yeah one thing I should say I am NOT a
compiler guy so I work at Microsoft at
106
00:02:22,920 --> 00:02:22,930
compiler guy so I work at Microsoft at
107
00:02:22,930 --> 00:02:25,229
compiler guy so I work at Microsoft at
work on the lunette team so I think of
108
00:02:25,229 --> 00:02:25,239
work on the lunette team so I think of
109
00:02:25,239 --> 00:02:27,089
work on the lunette team so I think of
myself as being a decent developer but I
110
00:02:27,089 --> 00:02:27,099
myself as being a decent developer but I
111
00:02:27,099 --> 00:02:29,820
myself as being a decent developer but I
am definitely not a compiler expert so
112
00:02:29,820 --> 00:02:29,830
am definitely not a compiler expert so
113
00:02:29,830 --> 00:02:32,040
am definitely not a compiler expert so
if you're a compiler expert you might be
114
00:02:32,040 --> 00:02:32,050
if you're a compiler expert you might be
115
00:02:32,050 --> 00:02:34,320
if you're a compiler expert you might be
bored or highly amused I don't know
116
00:02:34,320 --> 00:02:34,330
bored or highly amused I don't know
117
00:02:34,330 --> 00:02:36,390
bored or highly amused I don't know
which game you will fall into
118
00:02:36,390 --> 00:02:36,400
which game you will fall into
119
00:02:36,400 --> 00:02:38,420
which game you will fall into
I'd like to hear your feedback though so
120
00:02:38,420 --> 00:02:38,430
I'd like to hear your feedback though so
121
00:02:38,430 --> 00:02:42,660
I'd like to hear your feedback though so
if you're interested keep watching
122
00:02:42,660 --> 00:02:42,670
123
00:02:42,670 --> 00:02:45,059
124
00:02:45,059 --> 00:02:45,069
so the one thing I would say is the why
125
00:02:45,069 --> 00:02:46,559
so the one thing I would say is the why
do I do this course so my prime
126
00:02:46,559 --> 00:02:46,569
do I do this course so my prime
127
00:02:46,569 --> 00:02:47,730
do I do this course so my prime
motivation is to convince you the
128
00:02:47,730 --> 00:02:47,740
motivation is to convince you the
129
00:02:47,740 --> 00:02:49,800
motivation is to convince you the
compilers of fun because I've written a
130
00:02:49,800 --> 00:02:49,810
compilers of fun because I've written a
131
00:02:49,810 --> 00:02:51,750
compilers of fun because I've written a
few compilers in my spare time and I
132
00:02:51,750 --> 00:02:51,760
few compilers in my spare time and I
133
00:02:51,760 --> 00:02:53,880
few compilers in my spare time and I
think those are cool things to do and
134
00:02:53,880 --> 00:02:53,890
think those are cool things to do and
135
00:02:53,890 --> 00:02:55,230
think those are cool things to do and
there's plenty of stuff that is actually
136
00:02:55,230 --> 00:02:55,240
there's plenty of stuff that is actually
137
00:02:55,240 --> 00:02:57,300
there's plenty of stuff that is actually
very useful in whatever job you are
138
00:02:57,300 --> 00:02:57,310
very useful in whatever job you are
139
00:02:57,310 --> 00:02:59,250
very useful in whatever job you are
doing because turns out compilers are
140
00:02:59,250 --> 00:02:59,260
doing because turns out compilers are
141
00:02:59,260 --> 00:03:01,080
doing because turns out compilers are
really mostly about you know how to
142
00:03:01,080 --> 00:03:01,090
really mostly about you know how to
143
00:03:01,090 --> 00:03:03,660
really mostly about you know how to
handle trees how to walk trees how to do
144
00:03:03,660 --> 00:03:03,670
handle trees how to walk trees how to do
145
00:03:03,670 --> 00:03:05,880
handle trees how to walk trees how to do
interesting stuff with trees and trees
146
00:03:05,880 --> 00:03:05,890
interesting stuff with trees and trees
147
00:03:05,890 --> 00:03:06,810
interesting stuff with trees and trees
are just a very interesting data
148
00:03:06,810 --> 00:03:06,820
are just a very interesting data
149
00:03:06,820 --> 00:03:08,220
are just a very interesting data
structure that if you've never used them
150
00:03:08,220 --> 00:03:08,230
structure that if you've never used them
151
00:03:08,230 --> 00:03:09,810
structure that if you've never used them
you probably should because they're
152
00:03:09,810 --> 00:03:09,820
you probably should because they're
153
00:03:09,820 --> 00:03:12,570
you probably should because they're
really cool so my goal is I will be
154
00:03:12,570 --> 00:03:12,580
really cool so my goal is I will be
155
00:03:12,580 --> 00:03:15,020
really cool so my goal is I will be
streaming every Wednesday 8:00 a.m.
156
00:03:15,020 --> 00:03:15,030
streaming every Wednesday 8:00 a.m.
157
00:03:15,030 --> 00:03:18,000
streaming every Wednesday 8:00 a.m.
Pacific Standard Time which will
158
00:03:18,000 --> 00:03:18,010
Pacific Standard Time which will
159
00:03:18,010 --> 00:03:19,860
Pacific Standard Time which will
probably not work for the entirety of
160
00:03:19,860 --> 00:03:19,870
probably not work for the entirety of
161
00:03:19,870 --> 00:03:21,449
probably not work for the entirety of
the world but hopefully for enough
162
00:03:21,449 --> 00:03:21,459
the world but hopefully for enough
163
00:03:21,459 --> 00:03:23,340
the world but hopefully for enough
people on the world so it makes sense to
164
00:03:23,340 --> 00:03:23,350
people on the world so it makes sense to
165
00:03:23,350 --> 00:03:26,310
people on the world so it makes sense to
do it in a live fashion dependent it
166
00:03:26,310 --> 00:03:26,320
do it in a live fashion dependent it
167
00:03:26,320 --> 00:03:27,180
do it in a live fashion dependent it
doesn't matter where you're watching
168
00:03:27,180 --> 00:03:27,190
doesn't matter where you're watching
169
00:03:27,190 --> 00:03:29,340
doesn't matter where you're watching
whether it's twitch or mixer or youtube
170
00:03:29,340 --> 00:03:29,350
whether it's twitch or mixer or youtube
171
00:03:29,350 --> 00:03:30,660
whether it's twitch or mixer or youtube
I stream to all three of them at the
172
00:03:30,660 --> 00:03:30,670
I stream to all three of them at the
173
00:03:30,670 --> 00:03:32,880
I stream to all three of them at the
same time so just feel free to use the
174
00:03:32,880 --> 00:03:32,890
same time so just feel free to use the
175
00:03:32,890 --> 00:03:36,090
same time so just feel free to use the
chat in there and ask questions and if I
176
00:03:36,090 --> 00:03:36,100
chat in there and ask questions and if I
177
00:03:36,100 --> 00:03:37,440
chat in there and ask questions and if I
don't forget I will actually check the
178
00:03:37,440 --> 00:03:37,450
don't forget I will actually check the
179
00:03:37,450 --> 00:03:38,820
don't forget I will actually check the
chat window every once in a while and
180
00:03:38,820 --> 00:03:38,830
chat window every once in a while and
181
00:03:38,830 --> 00:03:41,850
chat window every once in a while and
try to answer your questions the
182
00:03:41,850 --> 00:03:41,860
try to answer your questions the
183
00:03:41,860 --> 00:03:43,320
try to answer your questions the
recordings of these episodes will go to
184
00:03:43,320 --> 00:03:43,330
recordings of these episodes will go to
185
00:03:43,330 --> 00:03:45,540
recordings of these episodes will go to
YouTube so even if you can't make the
186
00:03:45,540 --> 00:03:45,550
YouTube so even if you can't make the
187
00:03:45,550 --> 00:03:48,180
YouTube so even if you can't make the
life's not you will be able to follow
188
00:03:48,180 --> 00:03:48,190
life's not you will be able to follow
189
00:03:48,190 --> 00:03:51,120
life's not you will be able to follow
later and find the stuff on YouTube as
190
00:03:51,120 --> 00:03:51,130
later and find the stuff on YouTube as
191
00:03:51,130 --> 00:03:55,590
later and find the stuff on YouTube as
well which is super useful yeah of
192
00:03:55,590 --> 00:03:55,600
well which is super useful yeah of
193
00:03:55,600 --> 00:03:57,030
well which is super useful yeah of
course the source code that we going to
194
00:03:57,030 --> 00:03:57,040
course the source code that we going to
195
00:03:57,040 --> 00:03:59,910
course the source code that we going to
write is going to github my goal would
196
00:03:59,910 --> 00:03:59,920
write is going to github my goal would
197
00:03:59,920 --> 00:04:01,500
write is going to github my goal would
be that at the end of every episode I
198
00:04:01,500 --> 00:04:01,510
be that at the end of every episode I
199
00:04:01,510 --> 00:04:04,650
be that at the end of every episode I
have one PR that adds all the code we
200
00:04:04,650 --> 00:04:04,660
have one PR that adds all the code we
201
00:04:04,660 --> 00:04:08,370
have one PR that adds all the code we
wrote in that episode and I think on how
202
00:04:08,370 --> 00:04:08,380
wrote in that episode and I think on how
203
00:04:08,380 --> 00:04:09,509
wrote in that episode and I think on how
much time and how much energy I'm
204
00:04:09,509 --> 00:04:09,519
much time and how much energy I'm
205
00:04:09,519 --> 00:04:10,830
much time and how much energy I'm
willing to spend after the episode
206
00:04:10,830 --> 00:04:10,840
willing to spend after the episode
207
00:04:10,840 --> 00:04:12,990
willing to spend after the episode
hopefully also get some notes so even if
208
00:04:12,990 --> 00:04:13,000
hopefully also get some notes so even if
209
00:04:13,000 --> 00:04:14,340
hopefully also get some notes so even if
it didn't follow the episode or if
210
00:04:14,340 --> 00:04:14,350
it didn't follow the episode or if
211
00:04:14,350 --> 00:04:16,590
it didn't follow the episode or if
you're not a video person you should
212
00:04:16,590 --> 00:04:16,600
you're not a video person you should
213
00:04:16,600 --> 00:04:18,270
you're not a video person you should
still be able to catch up by just
214
00:04:18,270 --> 00:04:18,280
still be able to catch up by just
215
00:04:18,280 --> 00:04:22,230
still be able to catch up by just
reading the notes yeah this brings him
216
00:04:22,230 --> 00:04:22,240
reading the notes yeah this brings him
217
00:04:22,240 --> 00:04:23,430
reading the notes yeah this brings him
back to what's the goal for today so
218
00:04:23,430 --> 00:04:23,440
back to what's the goal for today so
219
00:04:23,440 --> 00:04:25,740
back to what's the goal for today so
today I want to start the project we
220
00:04:25,740 --> 00:04:25,750
today I want to start the project we
221
00:04:25,750 --> 00:04:27,150
today I want to start the project we
want to you know create the github repo
222
00:04:27,150 --> 00:04:27,160
want to you know create the github repo
223
00:04:27,160 --> 00:04:29,219
want to you know create the github repo
get the initial code up and running and
224
00:04:29,219 --> 00:04:29,229
get the initial code up and running and
225
00:04:29,229 --> 00:04:32,460
get the initial code up and running and
then write the first part of it so today
226
00:04:32,460 --> 00:04:32,470
then write the first part of it so today
227
00:04:32,470 --> 00:04:34,890
then write the first part of it so today
what I would like to do is start with
228
00:04:34,890 --> 00:04:34,900
what I would like to do is start with
229
00:04:34,900 --> 00:04:36,450
what I would like to do is start with
something simple like an expression
230
00:04:36,450 --> 00:04:36,460
something simple like an expression
231
00:04:36,460 --> 00:04:38,610
something simple like an expression
evaluator where we handle priorities
232
00:04:38,610 --> 00:04:38,620
evaluator where we handle priorities
233
00:04:38,620 --> 00:04:40,770
evaluator where we handle priorities
already you know basic parsing of basic
234
00:04:40,770 --> 00:04:40,780
already you know basic parsing of basic
235
00:04:40,780 --> 00:04:42,870
already you know basic parsing of basic
structures and then maybe even print the
236
00:04:42,870 --> 00:04:42,880
structures and then maybe even print the
237
00:04:42,880 --> 00:04:44,580
structures and then maybe even print the
parse tree so that we have some
238
00:04:44,580 --> 00:04:44,590
parse tree so that we have some
239
00:04:44,590 --> 00:04:47,760
parse tree so that we have some
foundation that we can play with all
240
00:04:47,760 --> 00:04:47,770
foundation that we can play with all
241
00:04:47,770 --> 00:04:49,409
foundation that we can play with all
right send without further ado let's
242
00:04:49,409 --> 00:04:49,419
right send without further ado let's
243
00:04:49,419 --> 00:04:51,960
right send without further ado let's
just jump into the coding portion of
244
00:04:51,960 --> 00:04:51,970
just jump into the coding portion of
245
00:04:51,970 --> 00:04:52,559
just jump into the coding portion of
this I mean
246
00:04:52,559 --> 00:04:52,569
this I mean
247
00:04:52,569 --> 00:04:54,989
this I mean
really the fun part isn't it so let me
248
00:04:54,989 --> 00:04:54,999
really the fun part isn't it so let me
249
00:04:54,999 --> 00:04:58,529
really the fun part isn't it so let me
first say we need to pick a name as any
250
00:04:58,529 --> 00:04:58,539
first say we need to pick a name as any
251
00:04:58,539 --> 00:05:00,600
first say we need to pick a name as any
given project is and you know I have
252
00:05:00,600 --> 00:05:00,610
given project is and you know I have
253
00:05:00,610 --> 00:05:02,279
given project is and you know I have
type of plenty of names we have been I
254
00:05:02,279 --> 00:05:02,289
type of plenty of names we have been I
255
00:05:02,289 --> 00:05:04,169
type of plenty of names we have been I
wrote the compiler you know tear drops
256
00:05:04,169 --> 00:05:04,179
wrote the compiler you know tear drops
257
00:05:04,179 --> 00:05:07,230
wrote the compiler you know tear drops
compiler in most compiler our compiler
258
00:05:07,230 --> 00:05:07,240
compiler in most compiler our compiler
259
00:05:07,240 --> 00:05:09,809
compiler in most compiler our compiler
and like I've never was really happy if
260
00:05:09,809 --> 00:05:09,819
and like I've never was really happy if
261
00:05:09,819 --> 00:05:12,899
and like I've never was really happy if
you ever considered MIPS
262
00:05:12,899 --> 00:05:12,909
263
00:05:12,909 --> 00:05:14,369
264
00:05:14,369 --> 00:05:14,379
come again have you ever considered
265
00:05:14,379 --> 00:05:19,529
come again have you ever considered
Minsk I'm not entirely sold on the name
266
00:05:19,529 --> 00:05:19,539
Minsk I'm not entirely sold on the name
267
00:05:19,539 --> 00:05:21,629
Minsk I'm not entirely sold on the name
Minsk yet I think maybe we should pick
268
00:05:21,629 --> 00:05:21,639
Minsk yet I think maybe we should pick
269
00:05:21,639 --> 00:05:24,629
Minsk yet I think maybe we should pick
maybe a better name all right fair
270
00:05:24,629 --> 00:05:24,639
maybe a better name all right fair
271
00:05:24,639 --> 00:05:25,230
maybe a better name all right fair
enough fair enough
272
00:05:25,230 --> 00:05:25,240
enough fair enough
273
00:05:25,240 --> 00:05:27,989
enough fair enough
that's not upset the Klingon Minsk it is
274
00:05:27,989 --> 00:05:27,999
that's not upset the Klingon Minsk it is
275
00:05:27,999 --> 00:05:30,540
that's not upset the Klingon Minsk it is
so let's call our compiler and our
276
00:05:30,540 --> 00:05:30,550
so let's call our compiler and our
277
00:05:30,550 --> 00:05:32,489
so let's call our compiler and our
language for now Minsk and then see
278
00:05:32,489 --> 00:05:32,499
language for now Minsk and then see
279
00:05:32,499 --> 00:05:34,709
language for now Minsk and then see
where this leads us so what I have here
280
00:05:34,709 --> 00:05:34,719
where this leads us so what I have here
281
00:05:34,719 --> 00:05:38,309
where this leads us so what I have here
is the visual studio environment for the
282
00:05:38,309 --> 00:05:38,319
is the visual studio environment for the
283
00:05:38,319 --> 00:05:40,439
is the visual studio environment for the
finished product so I want to give you a
284
00:05:40,439 --> 00:05:40,449
finished product so I want to give you a
285
00:05:40,449 --> 00:05:41,969
finished product so I want to give you a
quick demo on what that would look like
286
00:05:41,969 --> 00:05:41,979
quick demo on what that would look like
287
00:05:41,979 --> 00:05:44,600
quick demo on what that would look like
so that you can decide whether you will
288
00:05:44,600 --> 00:05:44,610
so that you can decide whether you will
289
00:05:44,610 --> 00:05:49,079
so that you can decide whether you will
run around the annoying person that I am
290
00:05:49,079 --> 00:05:49,089
run around the annoying person that I am
291
00:05:49,089 --> 00:05:51,799
run around the annoying person that I am
i named it visual minsk because why not
292
00:05:51,799 --> 00:05:51,809
i named it visual minsk because why not
293
00:05:51,809 --> 00:05:55,259
i named it visual minsk because why not
so we have a small program here that we
294
00:05:55,259 --> 00:05:55,269
so we have a small program here that we
295
00:05:55,269 --> 00:05:58,439
so we have a small program here that we
can load and then you have an editor let
296
00:05:58,439 --> 00:05:58,449
can load and then you have an editor let
297
00:05:58,449 --> 00:06:00,570
can load and then you have an editor let
me just maximize this and zoom in a
298
00:06:00,570 --> 00:06:00,580
me just maximize this and zoom in a
299
00:06:00,580 --> 00:06:04,369
me just maximize this and zoom in a
little bit so you have code colorization
300
00:06:04,369 --> 00:06:04,379
little bit so you have code colorization
301
00:06:04,379 --> 00:06:07,199
little bit so you have code colorization
which again is actually done by our
302
00:06:07,199 --> 00:06:07,209
which again is actually done by our
303
00:06:07,209 --> 00:06:09,329
which again is actually done by our
compiler infrastructure you can hover
304
00:06:09,329 --> 00:06:09,339
compiler infrastructure you can hover
305
00:06:09,339 --> 00:06:12,239
compiler infrastructure you can hover
over identifiers and it tells you what
306
00:06:12,239 --> 00:06:12,249
over identifiers and it tells you what
307
00:06:12,249 --> 00:06:14,279
over identifiers and it tells you what
it is so it knows that guesses is a
308
00:06:14,279 --> 00:06:14,289
it is so it knows that guesses is a
309
00:06:14,289 --> 00:06:16,170
it is so it knows that guesses is a
variable of type int so we have type
310
00:06:16,170 --> 00:06:16,180
variable of type int so we have type
311
00:06:16,180 --> 00:06:19,319
variable of type int so we have type
checking going the language that I have
312
00:06:19,319 --> 00:06:19,329
checking going the language that I have
313
00:06:19,329 --> 00:06:23,489
checking going the language that I have
I was very uninspired basically what it
314
00:06:23,489 --> 00:06:23,499
I was very uninspired basically what it
315
00:06:23,499 --> 00:06:25,499
I was very uninspired basically what it
does it's just JavaScript or a little
316
00:06:25,499 --> 00:06:25,509
does it's just JavaScript or a little
317
00:06:25,509 --> 00:06:28,469
does it's just JavaScript or a little
bit of c-sharp maybe I just wanted to
318
00:06:28,469 --> 00:06:28,479
bit of c-sharp maybe I just wanted to
319
00:06:28,479 --> 00:06:30,869
bit of c-sharp maybe I just wanted to
have some language that is something we
320
00:06:30,869 --> 00:06:30,879
have some language that is something we
321
00:06:30,879 --> 00:06:32,399
have some language that is something we
can actually play with like I'm not a
322
00:06:32,399 --> 00:06:32,409
can actually play with like I'm not a
323
00:06:32,409 --> 00:06:34,019
can actually play with like I'm not a
language designer even though I'm going
324
00:06:34,019 --> 00:06:34,029
language designer even though I'm going
325
00:06:34,029 --> 00:06:35,759
language designer even though I'm going
to see sharp language design team I have
326
00:06:35,759 --> 00:06:35,769
to see sharp language design team I have
327
00:06:35,769 --> 00:06:37,529
to see sharp language design team I have
my opinions on what I would like to see
328
00:06:37,529 --> 00:06:37,539
my opinions on what I would like to see
329
00:06:37,539 --> 00:06:39,269
my opinions on what I would like to see
there but for me was mostly about
330
00:06:39,269 --> 00:06:39,279
there but for me was mostly about
331
00:06:39,279 --> 00:06:41,100
there but for me was mostly about
writing the language so I just picked
332
00:06:41,100 --> 00:06:41,110
writing the language so I just picked
333
00:06:41,110 --> 00:06:42,959
writing the language so I just picked
something relatively easy to parse and
334
00:06:42,959 --> 00:06:42,969
something relatively easy to parse and
335
00:06:42,969 --> 00:06:44,909
something relatively easy to parse and
you know we can play with this probably
336
00:06:44,909 --> 00:06:44,919
you know we can play with this probably
337
00:06:44,919 --> 00:06:48,629
you know we can play with this probably
as we're going as well let me open up
338
00:06:48,629 --> 00:06:48,639
as we're going as well let me open up
339
00:06:48,639 --> 00:06:50,730
as we're going as well let me open up
the chat window so that when I'm going I
340
00:06:50,730 --> 00:06:50,740
the chat window so that when I'm going I
341
00:06:50,740 --> 00:06:55,529
the chat window so that when I'm going I
am actually able to see what's going on
342
00:06:55,529 --> 00:06:55,539
am actually able to see what's going on
343
00:06:55,539 --> 00:06:57,449
am actually able to see what's going on
zoom out here there's already plenty of
344
00:06:57,449 --> 00:06:57,459
zoom out here there's already plenty of
345
00:06:57,459 --> 00:07:01,110
zoom out here there's already plenty of
questions
346
00:07:01,110 --> 00:07:01,120
347
00:07:01,120 --> 00:07:05,830
348
00:07:05,830 --> 00:07:05,840
yep all right so one thing so what it
349
00:07:05,840 --> 00:07:08,559
yep all right so one thing so what it
does right now I can actually run this
350
00:07:08,559 --> 00:07:08,569
does right now I can actually run this
351
00:07:08,569 --> 00:07:10,839
does right now I can actually run this
program and I wrote a little guessing
352
00:07:10,839 --> 00:07:10,849
program and I wrote a little guessing
353
00:07:10,849 --> 00:07:12,610
program and I wrote a little guessing
game so you can say I would like to get
354
00:07:12,610 --> 00:07:12,620
game so you can say I would like to get
355
00:07:12,620 --> 00:07:14,739
game so you can say I would like to get
hints and then it will basically say I
356
00:07:14,739 --> 00:07:14,749
hints and then it will basically say I
357
00:07:14,749 --> 00:07:16,570
hints and then it will basically say I
guess that I'm a between 1 and 100 and
358
00:07:16,570 --> 00:07:16,580
guess that I'm a between 1 and 100 and
359
00:07:16,580 --> 00:07:18,459
guess that I'm a between 1 and 100 and
now you know what's your guess and it
360
00:07:18,459 --> 00:07:18,469
now you know what's your guess and it
361
00:07:18,469 --> 00:07:20,230
now you know what's your guess and it
basically does the normal binary search
362
00:07:20,230 --> 00:07:20,240
basically does the normal binary search
363
00:07:20,240 --> 00:07:22,149
basically does the normal binary search
so we can say 50 and then it says well
364
00:07:22,149 --> 00:07:22,159
so we can say 50 and then it says well
365
00:07:22,159 --> 00:07:23,350
so we can say 50 and then it says well
the number is actually higher maybe you
366
00:07:23,350 --> 00:07:23,360
the number is actually higher maybe you
367
00:07:23,360 --> 00:07:25,689
the number is actually higher maybe you
want to get 75 or the number is lower
368
00:07:25,689 --> 00:07:25,699
want to get 75 or the number is lower
369
00:07:25,699 --> 00:07:28,749
want to get 75 or the number is lower
and then eventually hopefully after a
370
00:07:28,749 --> 00:07:28,759
and then eventually hopefully after a
371
00:07:28,759 --> 00:07:32,159
and then eventually hopefully after a
few guesses you get to the actual number
372
00:07:32,159 --> 00:07:32,169
few guesses you get to the actual number
373
00:07:32,169 --> 00:07:35,409
few guesses you get to the actual number
so this is a very basic program here you
374
00:07:35,409 --> 00:07:35,419
so this is a very basic program here you
375
00:07:35,419 --> 00:07:36,760
so this is a very basic program here you
know we have functions in here the
376
00:07:36,760 --> 00:07:36,770
know we have functions in here the
377
00:07:36,770 --> 00:07:39,580
know we have functions in here the
functions take parameters I have the
378
00:07:39,580 --> 00:07:39,590
functions take parameters I have the
379
00:07:39,590 --> 00:07:42,249
functions take parameters I have the
ability to print to the console we have
380
00:07:42,249 --> 00:07:42,259
ability to print to the console we have
381
00:07:42,259 --> 00:07:44,409
ability to print to the console we have
string interpolation going we have basic
382
00:07:44,409 --> 00:07:44,419
string interpolation going we have basic
383
00:07:44,419 --> 00:07:46,420
string interpolation going we have basic
control structures like wire loops and
384
00:07:46,420 --> 00:07:46,430
control structures like wire loops and
385
00:07:46,430 --> 00:07:48,219
control structures like wire loops and
if statements and you can assign
386
00:07:48,219 --> 00:07:48,229
if statements and you can assign
387
00:07:48,229 --> 00:07:50,409
if statements and you can assign
variables and you know what do you were
388
00:07:50,409 --> 00:07:50,419
variables and you know what do you were
389
00:07:50,419 --> 00:07:52,209
variables and you know what do you were
basically expect from a from a from a
390
00:07:52,209 --> 00:07:52,219
basically expect from a from a from a
391
00:07:52,219 --> 00:07:54,100
basically expect from a from a from a
from a boomer decent programming
392
00:07:54,100 --> 00:07:54,110
from a boomer decent programming
393
00:07:54,110 --> 00:07:56,140
from a boomer decent programming
language the idea that we have here is
394
00:07:56,140 --> 00:07:56,150
language the idea that we have here is
395
00:07:56,150 --> 00:07:58,390
language the idea that we have here is
actually it doesn't have code completion
396
00:07:58,390 --> 00:07:58,400
actually it doesn't have code completion
397
00:07:58,400 --> 00:08:00,339
actually it doesn't have code completion
yet although that is something that I
398
00:08:00,339 --> 00:08:00,349
yet although that is something that I
399
00:08:00,349 --> 00:08:02,860
yet although that is something that I
would like to add as well but you get
400
00:08:02,860 --> 00:08:02,870
would like to add as well but you get
401
00:08:02,870 --> 00:08:05,439
would like to add as well but you get
life type checking so if I make this in
402
00:08:05,439 --> 00:08:05,449
life type checking so if I make this in
403
00:08:05,449 --> 00:08:07,689
life type checking so if I make this in
a float you need to get an error message
404
00:08:07,689 --> 00:08:07,699
a float you need to get an error message
405
00:08:07,699 --> 00:08:10,269
a float you need to get an error message
that says this variable here we cannot
406
00:08:10,269 --> 00:08:10,279
that says this variable here we cannot
407
00:08:10,279 --> 00:08:12,189
that says this variable here we cannot
convert float to an int because
408
00:08:12,189 --> 00:08:12,199
convert float to an int because
409
00:08:12,199 --> 00:08:12,879
convert float to an int because
startgame
410
00:08:12,879 --> 00:08:12,889
startgame
411
00:08:12,889 --> 00:08:15,550
startgame
takes an int right you also get some
412
00:08:15,550 --> 00:08:15,560
takes an int right you also get some
413
00:08:15,560 --> 00:08:16,839
takes an int right you also get some
sort of symbol browser here where you
414
00:08:16,839 --> 00:08:16,849
sort of symbol browser here where you
415
00:08:16,849 --> 00:08:19,629
sort of symbol browser here where you
can actually navigate between different
416
00:08:19,629 --> 00:08:19,639
can actually navigate between different
417
00:08:19,639 --> 00:08:22,749
can actually navigate between different
parts of the language so basically what
418
00:08:22,749 --> 00:08:22,759
parts of the language so basically what
419
00:08:22,759 --> 00:08:24,339
parts of the language so basically what
you would expect I guess from anything
420
00:08:24,339 --> 00:08:24,349
you would expect I guess from anything
421
00:08:24,349 --> 00:08:26,980
you would expect I guess from anything
that has the title IDE or something as
422
00:08:26,980 --> 00:08:26,990
that has the title IDE or something as
423
00:08:26,990 --> 00:08:29,829
that has the title IDE or something as
basic as that the other thing that I did
424
00:08:29,829 --> 00:08:29,839
basic as that the other thing that I did
425
00:08:29,839 --> 00:08:31,899
basic as that the other thing that I did
because this is actually compiled so
426
00:08:31,899 --> 00:08:31,909
because this is actually compiled so
427
00:08:31,909 --> 00:08:35,490
because this is actually compiled so
this is literally producing a dotnet
428
00:08:35,490 --> 00:08:35,500
this is literally producing a dotnet
429
00:08:35,500 --> 00:08:37,899
this is literally producing a dotnet
executable so we can actually go to the
430
00:08:37,899 --> 00:08:37,909
executable so we can actually go to the
431
00:08:37,909 --> 00:08:40,839
executable so we can actually go to the
folder here if I remember where I put it
432
00:08:40,839 --> 00:08:40,849
folder here if I remember where I put it
433
00:08:40,849 --> 00:08:44,620
folder here if I remember where I put it
I think it's here under samples yep
434
00:08:44,620 --> 00:08:44,630
I think it's here under samples yep
435
00:08:44,630 --> 00:08:47,860
I think it's here under samples yep
here's our or XE and we can actually
436
00:08:47,860 --> 00:08:47,870
here's our or XE and we can actually
437
00:08:47,870 --> 00:08:50,100
here's our or XE and we can actually
open up this guy you know it's fine
438
00:08:50,100 --> 00:08:50,110
open up this guy you know it's fine
439
00:08:50,110 --> 00:08:52,540
open up this guy you know it's fine
which is actually kind of fun to do
440
00:08:52,540 --> 00:08:52,550
which is actually kind of fun to do
441
00:08:52,550 --> 00:08:55,780
which is actually kind of fun to do
because you know look at the the
442
00:08:55,780 --> 00:08:55,790
because you know look at the the
443
00:08:55,790 --> 00:08:59,439
because you know look at the the
decompiled c-sharp version of our
444
00:08:59,439 --> 00:08:59,449
decompiled c-sharp version of our
445
00:08:59,449 --> 00:09:01,870
decompiled c-sharp version of our
language which is kind of fun so you can
446
00:09:01,870 --> 00:09:01,880
language which is kind of fun so you can
447
00:09:01,880 --> 00:09:03,519
language which is kind of fun so you can
see for example that I use string
448
00:09:03,519 --> 00:09:03,529
see for example that I use string
449
00:09:03,529 --> 00:09:05,110
see for example that I use string
interpolation here but it just compels
450
00:09:05,110 --> 00:09:05,120
interpolation here but it just compels
451
00:09:05,120 --> 00:09:07,090
interpolation here but it just compels
down to a normal string concatenation
452
00:09:07,090 --> 00:09:07,100
down to a normal string concatenation
453
00:09:07,100 --> 00:09:10,090
down to a normal string concatenation
for example right which I think in I
454
00:09:10,090 --> 00:09:10,100
for example right which I think in I
455
00:09:10,100 --> 00:09:11,879
for example right which I think in I
actually call string concatenation
456
00:09:11,879 --> 00:09:11,889
actually call string concatenation
457
00:09:11,889 --> 00:09:15,569
actually call string concatenation
if yeah that's what it does here but you
458
00:09:15,569 --> 00:09:15,579
if yeah that's what it does here but you
459
00:09:15,579 --> 00:09:17,309
if yeah that's what it does here but you
can see it in C sharp of course you can
460
00:09:17,309 --> 00:09:17,319
can see it in C sharp of course you can
461
00:09:17,319 --> 00:09:18,929
can see it in C sharp of course you can
switch to all language because nothing
462
00:09:18,929 --> 00:09:18,939
switch to all language because nothing
463
00:09:18,939 --> 00:09:20,369
switch to all language because nothing
knows about our language right that
464
00:09:20,369 --> 00:09:20,379
knows about our language right that
465
00:09:20,379 --> 00:09:22,650
knows about our language right that
would be maybe even fun to do maybe
466
00:09:22,650 --> 00:09:22,660
would be maybe even fun to do maybe
467
00:09:22,660 --> 00:09:24,269
would be maybe even fun to do maybe
somebody wants to do the D compiler for
468
00:09:24,269 --> 00:09:24,279
somebody wants to do the D compiler for
469
00:09:24,279 --> 00:09:25,799
somebody wants to do the D compiler for
IELTS why for our language that would be
470
00:09:25,799 --> 00:09:25,809
IELTS why for our language that would be
471
00:09:25,809 --> 00:09:29,609
IELTS why for our language that would be
super sweet but that's not what I'm
472
00:09:29,609 --> 00:09:29,619
super sweet but that's not what I'm
473
00:09:29,619 --> 00:09:31,559
super sweet but that's not what I'm
focusing on and the other thing we can
474
00:09:31,559 --> 00:09:31,569
focusing on and the other thing we can
475
00:09:31,569 --> 00:09:33,809
focusing on and the other thing we can
do is we can actually debug there or or
476
00:09:33,809 --> 00:09:33,819
do is we can actually debug there or or
477
00:09:33,819 --> 00:09:37,530
do is we can actually debug there or or
a code so I can actually hit f5 and no I
478
00:09:37,530 --> 00:09:37,540
a code so I can actually hit f5 and no I
479
00:09:37,540 --> 00:09:39,509
a code so I can actually hit f5 and no I
did not write a debugger all it did I
480
00:09:39,509 --> 00:09:39,519
did not write a debugger all it did I
481
00:09:39,519 --> 00:09:42,299
did not write a debugger all it did I
omit a PDB file that actually has
482
00:09:42,299 --> 00:09:42,309
omit a PDB file that actually has
483
00:09:42,309 --> 00:09:45,809
omit a PDB file that actually has
debugging information in it so that
484
00:09:45,809 --> 00:09:45,819
debugging information in it so that
485
00:09:45,819 --> 00:09:47,549
debugging information in it so that
allows us to actually step through our
486
00:09:47,549 --> 00:09:47,559
allows us to actually step through our
487
00:09:47,559 --> 00:09:49,169
allows us to actually step through our
code so all I have to do here now as I
488
00:09:49,169 --> 00:09:49,179
code so all I have to do here now as I
489
00:09:49,179 --> 00:09:54,419
code so all I have to do here now as I
can had f11 and then Visual Studio will
490
00:09:54,419 --> 00:09:54,429
can had f11 and then Visual Studio will
491
00:09:54,429 --> 00:09:56,789
can had f11 and then Visual Studio will
happily load our source file I mean it
492
00:09:56,789 --> 00:09:56,799
happily load our source file I mean it
493
00:09:56,799 --> 00:09:57,780
happily load our source file I mean it
doesn't know anything about our language
494
00:09:57,780 --> 00:09:57,790
doesn't know anything about our language
495
00:09:57,790 --> 00:09:59,429
doesn't know anything about our language
right so there's no syntax highlighting
496
00:09:59,429 --> 00:09:59,439
right so there's no syntax highlighting
497
00:09:59,439 --> 00:10:02,069
right so there's no syntax highlighting
no nothing but I can actually do what
498
00:10:02,069 --> 00:10:02,079
no nothing but I can actually do what
499
00:10:02,079 --> 00:10:04,199
no nothing but I can actually do what
you normally do it you can do an f10 you
500
00:10:04,199 --> 00:10:04,209
you normally do it you can do an f10 you
501
00:10:04,209 --> 00:10:06,150
you normally do it you can do an f10 you
know you can say do I want to jump into
502
00:10:06,150 --> 00:10:06,160
know you can say do I want to jump into
503
00:10:06,160 --> 00:10:07,590
know you can say do I want to jump into
the method ask for hints or they want to
504
00:10:07,590 --> 00:10:07,600
the method ask for hints or they want to
505
00:10:07,600 --> 00:10:10,710
the method ask for hints or they want to
jump over that do an f10 so it asks for
506
00:10:10,710 --> 00:10:10,720
jump over that do an f10 so it asks for
507
00:10:10,720 --> 00:10:14,519
jump over that do an f10 so it asks for
hints I say no and then for the run game
508
00:10:14,519 --> 00:10:14,529
hints I say no and then for the run game
509
00:10:14,529 --> 00:10:15,809
hints I say no and then for the run game
I can decide whether I want to run into
510
00:10:15,809 --> 00:10:15,819
I can decide whether I want to run into
511
00:10:15,819 --> 00:10:18,210
I can decide whether I want to run into
that I can do this and as you can see
512
00:10:18,210 --> 00:10:18,220
that I can do this and as you can see
513
00:10:18,220 --> 00:10:19,739
that I can do this and as you can see
here is we even see the variables
514
00:10:19,739 --> 00:10:19,749
here is we even see the variables
515
00:10:19,749 --> 00:10:23,280
here is we even see the variables
because they are actually part of the of
516
00:10:23,280 --> 00:10:23,290
because they are actually part of the of
517
00:10:23,290 --> 00:10:25,139
because they are actually part of the of
the debug file so the four videos three
518
00:10:25,139 --> 00:10:25,149
the debug file so the four videos three
519
00:10:25,149 --> 00:10:27,720
the debug file so the four videos three
notes what local variables exist of
520
00:10:27,720 --> 00:10:27,730
notes what local variables exist of
521
00:10:27,730 --> 00:10:29,609
notes what local variables exist of
course what you can't do you cannot
522
00:10:29,609 --> 00:10:29,619
course what you can't do you cannot
523
00:10:29,619 --> 00:10:31,679
course what you can't do you cannot
divide expressions in here because again
524
00:10:31,679 --> 00:10:31,689
divide expressions in here because again
525
00:10:31,689 --> 00:10:33,269
divide expressions in here because again
Visual Studio knows nothing about our
526
00:10:33,269 --> 00:10:33,279
Visual Studio knows nothing about our
527
00:10:33,279 --> 00:10:34,530
Visual Studio knows nothing about our
language so there's no expression
528
00:10:34,530 --> 00:10:34,540
language so there's no expression
529
00:10:34,540 --> 00:10:36,989
language so there's no expression
evaluate or anything like that but you
530
00:10:36,989 --> 00:10:36,999
evaluate or anything like that but you
531
00:10:36,999 --> 00:10:38,309
evaluate or anything like that but you
are at least able to debug your code
532
00:10:38,309 --> 00:10:38,319
are at least able to debug your code
533
00:10:38,319 --> 00:10:40,499
are at least able to debug your code
right so long your visual studio
534
00:10:40,499 --> 00:10:40,509
right so long your visual studio
535
00:10:40,509 --> 00:10:43,590
right so long your visual studio
installed but you get the idea right
536
00:10:43,590 --> 00:10:43,600
installed but you get the idea right
537
00:10:43,600 --> 00:10:45,659
installed but you get the idea right
basically we just admitted Samael and
538
00:10:45,659 --> 00:10:45,669
basically we just admitted Samael and
539
00:10:45,669 --> 00:10:47,879
basically we just admitted Samael and
then had a debug information to it and
540
00:10:47,879 --> 00:10:47,889
then had a debug information to it and
541
00:10:47,889 --> 00:10:53,359
then had a debug information to it and
that's all it took all right so that is
542
00:10:53,359 --> 00:10:53,369
that's all it took all right so that is
543
00:10:53,369 --> 00:10:59,359
that's all it took all right so that is
what I want to demo about the actual
544
00:10:59,359 --> 00:10:59,369
what I want to demo about the actual
545
00:10:59,369 --> 00:11:02,699
what I want to demo about the actual
finished product yeah somebody's asking
546
00:11:02,699 --> 00:11:02,709
finished product yeah somebody's asking
547
00:11:02,709 --> 00:11:04,979
finished product yeah somebody's asking
what language is the compiler written in
548
00:11:04,979 --> 00:11:04,989
what language is the compiler written in
549
00:11:04,989 --> 00:11:07,499
what language is the compiler written in
I will be using c-sharp somebody asks
550
00:11:07,499 --> 00:11:07,509
I will be using c-sharp somebody asks
551
00:11:07,509 --> 00:11:10,529
I will be using c-sharp somebody asks
for VB but I don't know VB anymore it's
552
00:11:10,529 --> 00:11:10,539
for VB but I don't know VB anymore it's
553
00:11:10,539 --> 00:11:13,859
for VB but I don't know VB anymore it's
a long time yes somebody was asking what
554
00:11:13,859 --> 00:11:13,869
a long time yes somebody was asking what
555
00:11:13,869 --> 00:11:15,749
a long time yes somebody was asking what
y'all stands for again I'm uninspired
556
00:11:15,749 --> 00:11:15,759
y'all stands for again I'm uninspired
557
00:11:15,759 --> 00:11:22,380
y'all stands for again I'm uninspired
it's yet another language so not really
558
00:11:22,380 --> 00:11:22,390
it's yet another language so not really
559
00:11:22,390 --> 00:11:25,170
it's yet another language so not really
super curiously interesting so I think
560
00:11:25,170 --> 00:11:25,180
super curiously interesting so I think
561
00:11:25,180 --> 00:11:26,759
super curiously interesting so I think
yeah that's pretty much it what we have
562
00:11:26,759 --> 00:11:26,769
yeah that's pretty much it what we have
563
00:11:26,769 --> 00:11:28,230
yeah that's pretty much it what we have
for questions right now so alright let's
564
00:11:28,230 --> 00:11:28,240
for questions right now so alright let's
565
00:11:28,240 --> 00:11:29,850
for questions right now so alright let's
get started so let's actually closed
566
00:11:29,850 --> 00:11:29,860
get started so let's actually closed
567
00:11:29,860 --> 00:11:32,880
get started so let's actually closed
room studio for now and let's actually
568
00:11:32,880 --> 00:11:32,890
room studio for now and let's actually
569
00:11:32,890 --> 00:11:36,690
room studio for now and let's actually
start so let's let's start by creating
570
00:11:36,690 --> 00:11:36,700
start so let's let's start by creating
571
00:11:36,700 --> 00:11:40,590
start so let's let's start by creating
our or bare-bones folder so we have a
572
00:11:40,590 --> 00:11:40,600
our or bare-bones folder so we have a
573
00:11:40,600 --> 00:11:43,740
our or bare-bones folder so we have a
Minsk folder here let me populate this
574
00:11:43,740 --> 00:11:43,750
Minsk folder here let me populate this
575
00:11:43,750 --> 00:11:49,980
Minsk folder here let me populate this
with some basic basic file to you so we
576
00:11:49,980 --> 00:11:49,990
with some basic basic file to you so we
577
00:11:49,990 --> 00:11:51,360
with some basic basic file to you so we
have at least to get attribute to get
578
00:11:51,360 --> 00:11:51,370
have at least to get attribute to get
579
00:11:51,370 --> 00:11:54,210
have at least to get attribute to get
ignore get license let me do it get in
580
00:11:54,210 --> 00:11:54,220
ignore get license let me do it get in
581
00:11:54,220 --> 00:11:57,509
ignore get license let me do it get in
it so we have an actual repository to
582
00:11:57,509 --> 00:11:57,519
it so we have an actual repository to
583
00:11:57,519 --> 00:12:02,750
it so we have an actual repository to
work with and then I think I want to
584
00:12:02,750 --> 00:12:02,760
work with and then I think I want to
585
00:12:02,760 --> 00:12:11,680
work with and then I think I want to
create the Roppongi to make it public
586
00:12:11,680 --> 00:12:11,690
587
00:12:11,690 --> 00:12:14,440
588
00:12:14,440 --> 00:12:14,450
let's do this let's come with what we
589
00:12:14,450 --> 00:12:19,570
let's do this let's come with what we
have initial commit yeah it helps if you
590
00:12:19,570 --> 00:12:19,580
have initial commit yeah it helps if you
591
00:12:19,580 --> 00:12:26,170
have initial commit yeah it helps if you
add everything I know let's just keep
592
00:12:26,170 --> 00:12:26,180
add everything I know let's just keep
593
00:12:26,180 --> 00:12:33,850
add everything I know let's just keep
forgetting yep let's do that ooh yeah so
594
00:12:33,850 --> 00:12:33,860
forgetting yep let's do that ooh yeah so
595
00:12:33,860 --> 00:12:39,160
forgetting yep let's do that ooh yeah so
we have at least the basics well it's
596
00:12:39,160 --> 00:12:39,170
we have at least the basics well it's
597
00:12:39,170 --> 00:12:42,700
we have at least the basics well it's
actually open this folder in Visual
598
00:12:42,700 --> 00:12:42,710
actually open this folder in Visual
599
00:12:42,710 --> 00:12:45,190
actually open this folder in Visual
Studio code maybe the first thing we
600
00:12:45,190 --> 00:12:45,200
Studio code maybe the first thing we
601
00:12:45,200 --> 00:12:47,250
Studio code maybe the first thing we
should actually add is a readme file
602
00:12:47,250 --> 00:12:47,260
should actually add is a readme file
603
00:12:47,260 --> 00:12:52,060
should actually add is a readme file
just so we know what's going on this
604
00:12:52,060 --> 00:12:52,070
just so we know what's going on this
605
00:12:52,070 --> 00:12:57,490
just so we know what's going on this
repo is a compiler maybe we should also
606
00:12:57,490 --> 00:12:57,500
repo is a compiler maybe we should also
607
00:12:57,500 --> 00:13:04,540
repo is a compiler maybe we should also
add have you considered Minsk Worf
608
00:13:04,540 --> 00:13:04,550
add have you considered Minsk Worf
609
00:13:04,550 --> 00:13:12,250
add have you considered Minsk Worf
naming things more details follow up so
610
00:13:12,250 --> 00:13:12,260
naming things more details follow up so
611
00:13:12,260 --> 00:13:13,720
naming things more details follow up so
we at least know what this thing will
612
00:13:13,720 --> 00:13:13,730
we at least know what this thing will
613
00:13:13,730 --> 00:13:22,050
we at least know what this thing will
contain let's add this guy let's add
614
00:13:22,050 --> 00:13:22,060
615
00:13:22,060 --> 00:13:26,740
616
00:13:26,740 --> 00:13:26,750
let's do this alright so nobody at least
617
00:13:26,750 --> 00:13:28,390
let's do this alright so nobody at least
have something to work with so the first
618
00:13:28,390 --> 00:13:28,400
have something to work with so the first
619
00:13:28,400 --> 00:13:29,830
have something to work with so the first
thing I will do is I will create our
620
00:13:29,830 --> 00:13:29,840
thing I will do is I will create our
621
00:13:29,840 --> 00:13:33,370
thing I will do is I will create our
actual project as a set up I'll be using
622
00:13:33,370 --> 00:13:33,380
actual project as a set up I'll be using
623
00:13:33,380 --> 00:13:35,800
actual project as a set up I'll be using
donut core so anybody can follow along
624
00:13:35,800 --> 00:13:35,810
donut core so anybody can follow along
625
00:13:35,810 --> 00:13:38,950
donut core so anybody can follow along
on any operating system so let's say we
626
00:13:38,950 --> 00:13:38,960
on any operating system so let's say we
627
00:13:38,960 --> 00:13:43,330
on any operating system so let's say we
want to get a console app and we want to
628
00:13:43,330 --> 00:13:43,340
want to get a console app and we want to
629
00:13:43,340 --> 00:13:49,090
want to get a console app and we want to
call this MC for the Minsk compiler and
630
00:13:49,090 --> 00:13:49,100
call this MC for the Minsk compiler and
631
00:13:49,100 --> 00:13:51,100
call this MC for the Minsk compiler and
now let's actually open that guy again
632
00:13:51,100 --> 00:13:51,110
now let's actually open that guy again
633
00:13:51,110 --> 00:13:55,420
now let's actually open that guy again
in code alright so here we are
634
00:13:55,420 --> 00:13:55,430
in code alright so here we are
635
00:13:55,430 --> 00:13:59,080
in code alright so here we are
alright so now we have our or basic
636
00:13:59,080 --> 00:13:59,090
alright so now we have our or basic
637
00:13:59,090 --> 00:14:01,240
alright so now we have our or basic
compiler I think I should be able to run
638
00:14:01,240 --> 00:14:01,250
compiler I think I should be able to run
639
00:14:01,250 --> 00:14:06,640
compiler I think I should be able to run
this now maybe not yet yep I wanted on
640
00:14:06,640 --> 00:14:06,650
this now maybe not yet yep I wanted on
641
00:14:06,650 --> 00:14:10,710
this now maybe not yet yep I wanted on
the core environments
642
00:14:10,710 --> 00:14:10,720
643
00:14:10,720 --> 00:14:15,970
644
00:14:15,970 --> 00:14:15,980
yes please I do not want to use the
645
00:14:15,980 --> 00:14:17,650
yes please I do not want to use the
internal console because that never
646
00:14:17,650 --> 00:14:17,660
internal console because that never
647
00:14:17,660 --> 00:14:19,330
internal console because that never
worked well for me so I will use the
648
00:14:19,330 --> 00:14:19,340
worked well for me so I will use the
649
00:14:19,340 --> 00:14:22,180
worked well for me so I will use the
external terminal so for no controller 5
650
00:14:22,180 --> 00:14:22,190
external terminal so for no controller 5
651
00:14:22,190 --> 00:14:29,020
external terminal so for no controller 5
this that will hopefully launch this yep
652
00:14:29,020 --> 00:14:29,030
this that will hopefully launch this yep
653
00:14:29,030 --> 00:14:32,170
this that will hopefully launch this yep
it does that I mean Lee quits all right
654
00:14:32,170 --> 00:14:32,180
it does that I mean Lee quits all right
655
00:14:32,180 --> 00:14:34,210
it does that I mean Lee quits all right
so this is our thing so the first thing
656
00:14:34,210 --> 00:14:34,220
so this is our thing so the first thing
657
00:14:34,220 --> 00:14:35,560
so this is our thing so the first thing
I will do because it's a much easier for
658
00:14:35,560 --> 00:14:35,570
I will do because it's a much easier for
659
00:14:35,570 --> 00:14:36,940
I will do because it's a much easier for
us to work with it's not an actual
660
00:14:36,940 --> 00:14:36,950
us to work with it's not an actual
661
00:14:36,950 --> 00:14:39,250
us to work with it's not an actual
compiler but more like a wrapper right
662
00:14:39,250 --> 00:14:39,260
compiler but more like a wrapper right
663
00:14:39,260 --> 00:14:40,870
compiler but more like a wrapper right
where we enter some expression and then
664
00:14:40,870 --> 00:14:40,880
where we enter some expression and then
665
00:14:40,880 --> 00:14:42,940
where we enter some expression and then
you really get some feedback on that so
666
00:14:42,940 --> 00:14:42,950
you really get some feedback on that so
667
00:14:42,950 --> 00:14:45,220
you really get some feedback on that so
let's do this let's say while true then
668
00:14:45,220 --> 00:14:45,230
let's do this let's say while true then
669
00:14:45,230 --> 00:14:48,610
let's do this let's say while true then
let me say var align I may say just
670
00:14:48,610 --> 00:14:48,620
let me say var align I may say just
671
00:14:48,620 --> 00:14:53,890
let me say var align I may say just
console dot readline and let me say if
672
00:14:53,890 --> 00:14:53,900
console dot readline and let me say if
673
00:14:53,900 --> 00:15:00,910
console dot readline and let me say if
line if spring is null or empty I guess
674
00:15:00,910 --> 00:15:00,920
line if spring is null or empty I guess
675
00:15:00,920 --> 00:15:03,460
line if spring is null or empty I guess
not all white space is also fine line
676
00:15:03,460 --> 00:15:03,470
not all white space is also fine line
677
00:15:03,470 --> 00:15:10,780
not all white space is also fine line
then we just quit otherwise we say if
678
00:15:10,780 --> 00:15:10,790
then we just quit otherwise we say if
679
00:15:10,790 --> 00:15:16,690
then we just quit otherwise we say if
line equals 1 plus 2 times 3 then we say
680
00:15:16,690 --> 00:15:16,700
line equals 1 plus 2 times 3 then we say
681
00:15:16,700 --> 00:15:22,120
line equals 1 plus 2 times 3 then we say
console.writeline 7 actually let me add
682
00:15:22,120 --> 00:15:22,130
console.writeline 7 actually let me add
683
00:15:22,130 --> 00:15:29,580
console.writeline 7 actually let me add
a prompt here console right in this case
684
00:15:29,580 --> 00:15:29,590
685
00:15:29,590 --> 00:15:31,660
686
00:15:31,660 --> 00:15:31,670
so we have something that we can
687
00:15:31,670 --> 00:15:34,270
so we have something that we can
actually see them what the output was
688
00:15:34,270 --> 00:15:34,280
actually see them what the output was
689
00:15:34,280 --> 00:15:42,670
actually see them what the output was
and what the input was else console dot
690
00:15:42,670 --> 00:15:42,680
and what the input was else console dot
691
00:15:42,680 --> 00:15:48,410
and what the input was else console dot
write line invalid
692
00:15:48,410 --> 00:15:48,420
write line invalid
693
00:15:48,420 --> 00:15:51,930
write line invalid
expression
694
00:15:51,930 --> 00:15:51,940
695
00:15:51,940 --> 00:15:57,010
696
00:15:57,010 --> 00:15:57,020
697
00:15:57,020 --> 00:16:02,889
698
00:16:02,889 --> 00:16:02,899
one plus two times three seven Wow I say
699
00:16:02,899 --> 00:16:04,930
one plus two times three seven Wow I say
anything else anybody expression seems
700
00:16:04,930 --> 00:16:04,940
anything else anybody expression seems
701
00:16:04,940 --> 00:16:07,620
anything else anybody expression seems
I've already done it's that easy right
702
00:16:07,620 --> 00:16:07,630
I've already done it's that easy right
703
00:16:07,630 --> 00:16:08,860
I've already done it's that easy right
yeah
704
00:16:08,860 --> 00:16:08,870
yeah
705
00:16:08,870 --> 00:16:11,800
yeah
not quite so let's actually do a little
706
00:16:11,800 --> 00:16:11,810
not quite so let's actually do a little
707
00:16:11,810 --> 00:16:13,240
not quite so let's actually do a little
bit more so the first thing I want to do
708
00:16:13,240 --> 00:16:13,250
bit more so the first thing I want to do
709
00:16:13,250 --> 00:16:15,250
bit more so the first thing I want to do
is when we talk about a compiler right
710
00:16:15,250 --> 00:16:15,260
is when we talk about a compiler right
711
00:16:15,260 --> 00:16:17,889
is when we talk about a compiler right
the first thing that a compiler does if
712
00:16:17,889 --> 00:16:17,899
the first thing that a compiler does if
713
00:16:17,899 --> 00:16:19,840
the first thing that a compiler does if
you just look at this source snippet
714
00:16:19,840 --> 00:16:19,850
you just look at this source snippet
715
00:16:19,850 --> 00:16:22,660
you just look at this source snippet
here is it will break this thing from
716
00:16:22,660 --> 00:16:22,670
here is it will break this thing from
717
00:16:22,670 --> 00:16:25,180
here is it will break this thing from
characters into verts so if you think
718
00:16:25,180 --> 00:16:25,190
characters into verts so if you think
719
00:16:25,190 --> 00:16:26,800
characters into verts so if you think
about the parser the parts that doesn't
720
00:16:26,800 --> 00:16:26,810
about the parser the parts that doesn't
721
00:16:26,810 --> 00:16:29,350
about the parser the parts that doesn't
actually deal with individual characters
722
00:16:29,350 --> 00:16:29,360
actually deal with individual characters
723
00:16:29,360 --> 00:16:31,000
actually deal with individual characters
the parts that deals with verts right so
724
00:16:31,000 --> 00:16:31,010
the parts that deals with verts right so
725
00:16:31,010 --> 00:16:32,860
the parts that deals with verts right so
you can think of the first part of the
726
00:16:32,860 --> 00:16:32,870
you can think of the first part of the
727
00:16:32,870 --> 00:16:35,380
you can think of the first part of the
compiler is the lexer which creates
728
00:16:35,380 --> 00:16:35,390
compiler is the lexer which creates
729
00:16:35,390 --> 00:16:36,970
compiler is the lexer which creates
words and then there's the parser who
730
00:16:36,970 --> 00:16:36,980
words and then there's the parser who
731
00:16:36,980 --> 00:16:39,280
words and then there's the parser who
creates sentences and sentences are
732
00:16:39,280 --> 00:16:39,290
creates sentences and sentences are
733
00:16:39,290 --> 00:16:41,019
creates sentences and sentences are
usually entry form so the very first
734
00:16:41,019 --> 00:16:41,029
usually entry form so the very first
735
00:16:41,029 --> 00:16:43,269
usually entry form so the very first
thing I'm going to do is do that and so
736
00:16:43,269 --> 00:16:43,279
thing I'm going to do is do that and so
737
00:16:43,279 --> 00:16:46,269
thing I'm going to do is do that and so
in our case because we you know lets us
738
00:16:46,269 --> 00:16:46,279
in our case because we you know lets us
739
00:16:46,279 --> 00:16:50,410
in our case because we you know lets us
start with the class lexer which
740
00:16:50,410 --> 00:16:50,420
start with the class lexer which
741
00:16:50,420 --> 00:16:54,519
start with the class lexer which
basically will actually does this work
742
00:16:54,519 --> 00:16:54,529
basically will actually does this work
743
00:16:54,529 --> 00:17:01,329
basically will actually does this work
here sort of extra string text okay we
744
00:17:01,329 --> 00:17:01,339
here sort of extra string text okay we
745
00:17:01,339 --> 00:17:07,540
here sort of extra string text okay we
need a field oh god no once that naming
746
00:17:07,540 --> 00:17:07,550
need a field oh god no once that naming
747
00:17:07,550 --> 00:17:10,260
need a field oh god no once that naming
convention underscores for the win I
748
00:17:10,260 --> 00:17:10,270
convention underscores for the win I
749
00:17:10,270 --> 00:17:14,650
convention underscores for the win I
cannot stand this so the first thing we
750
00:17:14,650 --> 00:17:14,660
cannot stand this so the first thing we
751
00:17:14,660 --> 00:17:16,809
cannot stand this so the first thing we
need probably a position right so let's
752
00:17:16,809 --> 00:17:16,819
need probably a position right so let's
753
00:17:16,819 --> 00:17:21,750
need probably a position right so let's
say private in position and then we have
754
00:17:21,750 --> 00:17:21,760
say private in position and then we have
755
00:17:21,760 --> 00:17:27,819
say private in position and then we have
say syntax token next token let's say
756
00:17:27,819 --> 00:17:27,829
say syntax token next token let's say
757
00:17:27,829 --> 00:17:30,610
say syntax token next token let's say
right so now the question is what's the
758
00:17:30,610 --> 00:17:30,620
right so now the question is what's the
759
00:17:30,620 --> 00:17:31,570
right so now the question is what's the
syntax token
760
00:17:31,570 --> 00:17:31,580
syntax token
761
00:17:31,580 --> 00:17:33,910
syntax token
that it's basically what represents a
762
00:17:33,910 --> 00:17:33,920
that it's basically what represents a
763
00:17:33,920 --> 00:17:35,890
that it's basically what represents a
vert in our language right so in our
764
00:17:35,890 --> 00:17:35,900
vert in our language right so in our
765
00:17:35,900 --> 00:17:39,340
vert in our language right so in our
case it would say that starts simple and
766
00:17:39,340 --> 00:17:39,350
case it would say that starts simple and
767
00:17:39,350 --> 00:17:44,350
case it would say that starts simple and
say we have what do we need what would
768
00:17:44,350 --> 00:17:44,360
say we have what do we need what would
769
00:17:44,360 --> 00:17:46,060
say we have what do we need what would
be useful I guess what we sold is the
770
00:17:46,060 --> 00:17:46,070
be useful I guess what we sold is the
771
00:17:46,070 --> 00:17:50,200
be useful I guess what we sold is the
position in the input file and maybe the
772
00:17:50,200 --> 00:17:50,210
position in the input file and maybe the
773
00:17:50,210 --> 00:17:55,360
position in the input file and maybe the
text and maybe the kind like is it a
774
00:17:55,360 --> 00:17:55,370
text and maybe the kind like is it a
775
00:17:55,370 --> 00:17:57,549
text and maybe the kind like is it a
number or is it an operator right like
776
00:17:57,549 --> 00:17:57,559
number or is it an operator right like
777
00:17:57,559 --> 00:18:01,120
number or is it an operator right like
that sort of thing syntax kind kind and
778
00:18:01,120 --> 00:18:01,130
that sort of thing syntax kind kind and
779
00:18:01,130 --> 00:18:04,180
that sort of thing syntax kind kind and
let me just say our syntax kind is just
780
00:18:04,180 --> 00:18:04,190
let me just say our syntax kind is just
781
00:18:04,190 --> 00:18:05,590
let me just say our syntax kind is just
an enum for now
782
00:18:05,590 --> 00:18:05,600
an enum for now
783
00:18:05,600 --> 00:18:08,700
an enum for now
we have nothing in it and then it's just
784
00:18:08,700 --> 00:18:08,710
we have nothing in it and then it's just
785
00:18:08,710 --> 00:18:11,499
we have nothing in it and then it's just
initialize properties for those guys so
786
00:18:11,499 --> 00:18:11,509
initialize properties for those guys so
787
00:18:11,509 --> 00:18:17,889
initialize properties for those guys so
we can actually store them alright this
788
00:18:17,889 --> 00:18:17,899
we can actually store them alright this
789
00:18:17,899 --> 00:18:23,799
we can actually store them alright this
should get us going so so the idea here
790
00:18:23,799 --> 00:18:23,809
should get us going so so the idea here
791
00:18:23,809 --> 00:18:25,960
should get us going so so the idea here
is that this guy like every time you
792
00:18:25,960 --> 00:18:25,970
is that this guy like every time you
793
00:18:25,970 --> 00:18:28,419
is that this guy like every time you
call next token we basically yep you
794
00:18:28,419 --> 00:18:28,429
call next token we basically yep you
795
00:18:28,429 --> 00:18:29,739
call next token we basically yep you
know at the current position in the file
796
00:18:29,739 --> 00:18:29,749
know at the current position in the file
797
00:18:29,749 --> 00:18:32,200
know at the current position in the file
and if you find the next word take that
798
00:18:32,200 --> 00:18:32,210
and if you find the next word take that
799
00:18:32,210 --> 00:18:33,580
and if you find the next word take that
return that and keep going
800
00:18:33,580 --> 00:18:33,590
return that and keep going
801
00:18:33,590 --> 00:18:36,310
return that and keep going
so in our case so what we'll be looking
802
00:18:36,310 --> 00:18:36,320
so in our case so what we'll be looking
803
00:18:36,320 --> 00:18:38,259
so in our case so what we'll be looking
for so what we were looking for a fun
804
00:18:38,259 --> 00:18:38,269
for so what we were looking for a fun
805
00:18:38,269 --> 00:18:41,580
for so what we were looking for a fun
expression evaluator our numbers right I
806
00:18:41,580 --> 00:18:41,590
expression evaluator our numbers right I
807
00:18:41,590 --> 00:18:47,229
expression evaluator our numbers right I
guess plus minus times divided and of
808
00:18:47,229 --> 00:18:47,239
guess plus minus times divided and of
809
00:18:47,239 --> 00:18:49,589
guess plus minus times divided and of
course you know white space right space
810
00:18:49,589 --> 00:18:49,599
course you know white space right space
811
00:18:49,599 --> 00:18:51,849
course you know white space right space
let's just call this white space right
812
00:18:51,849 --> 00:18:51,859
let's just call this white space right
813
00:18:51,859 --> 00:18:54,629
let's just call this white space right
these are the three kinds of words that
814
00:18:54,629 --> 00:18:54,639
these are the three kinds of words that
815
00:18:54,639 --> 00:18:58,419
these are the three kinds of words that
maybe parentheses would also be great of
816
00:18:58,419 --> 00:18:58,429
maybe parentheses would also be great of
817
00:18:58,429 --> 00:19:02,649
maybe parentheses would also be great of
what we can detect for now so how about
818
00:19:02,649 --> 00:19:02,659
what we can detect for now so how about
819
00:19:02,659 --> 00:19:07,799
what we can detect for now so how about
we start with numbers so we say if char
820
00:19:07,799 --> 00:19:07,809
821
00:19:07,809 --> 00:19:10,149
822
00:19:10,149 --> 00:19:10,159
actually before we do that maybe what we
823
00:19:10,159 --> 00:19:14,099
actually before we do that maybe what we
should do is public you know private
824
00:19:14,099 --> 00:19:14,109
should do is public you know private
825
00:19:14,109 --> 00:19:19,450
should do is public you know private
char current which basically says the
826
00:19:19,450 --> 00:19:19,460
char current which basically says the
827
00:19:19,460 --> 00:19:22,899
char current which basically says the
current character let's start with
828
00:19:22,899 --> 00:19:22,909
current character let's start with
829
00:19:22,909 --> 00:19:32,129
current character let's start with
something like so if the position is
830
00:19:32,129 --> 00:19:32,139
831
00:19:32,139 --> 00:19:34,869
832
00:19:34,869 --> 00:19:34,879
basically outside the bounds of the text
833
00:19:34,879 --> 00:19:38,379
basically outside the bounds of the text
then we return this guy here which is
834
00:19:38,379 --> 00:19:38,389
then we return this guy here which is
835
00:19:38,389 --> 00:19:41,379
then we return this guy here which is
basically the zero Terminator second
836
00:19:41,379 --> 00:19:41,389
basically the zero Terminator second
837
00:19:41,389 --> 00:19:44,349
basically the zero Terminator second
tensional I guess for most systems to
838
00:19:44,349 --> 00:19:44,359
tensional I guess for most systems to
839
00:19:44,359 --> 00:19:46,690
tensional I guess for most systems to
say if it's invalid you return that guy
840
00:19:46,690 --> 00:19:46,700
say if it's invalid you return that guy
841
00:19:46,700 --> 00:19:51,009
say if it's invalid you return that guy
otherwise you return text position so
842
00:19:51,009 --> 00:19:51,019
otherwise you return text position so
843
00:19:51,019 --> 00:19:53,940
otherwise you return text position so
this gives us the current character and
844
00:19:53,940 --> 00:19:53,950
this gives us the current character and
845
00:19:53,950 --> 00:19:58,269
this gives us the current character and
then we probably want another method
846
00:19:58,269 --> 00:19:58,279
then we probably want another method
847
00:19:58,279 --> 00:20:03,669
then we probably want another method
avoid next which basically just does
848
00:20:03,669 --> 00:20:03,679
avoid next which basically just does
849
00:20:03,679 --> 00:20:07,659
avoid next which basically just does
this like we just increment the position
850
00:20:07,659 --> 00:20:07,669
this like we just increment the position
851
00:20:07,669 --> 00:20:10,659
this like we just increment the position
so no we can say if char is letter or
852
00:20:10,659 --> 00:20:10,669
so no we can say if char is letter or
853
00:20:10,669 --> 00:20:18,399
so no we can say if char is letter or
digit no sorry it's digit current then
854
00:20:18,399 --> 00:20:18,409
digit no sorry it's digit current then
855
00:20:18,409 --> 00:20:21,719
digit no sorry it's digit current then
what we will do is we will remember
856
00:20:21,719 --> 00:20:21,729
what we will do is we will remember
857
00:20:21,729 --> 00:20:23,259
what we will do is we will remember
where we are
858
00:20:23,259 --> 00:20:23,269
where we are
859
00:20:23,269 --> 00:20:27,820
where we are
tomorr start is position we say wild
860
00:20:27,820 --> 00:20:27,830
tomorr start is position we say wild
861
00:20:27,830 --> 00:20:39,129
tomorr start is position we say wild
char is digit current next and then we
862
00:20:39,129 --> 00:20:39,139
char is digit current next and then we
863
00:20:39,139 --> 00:20:42,369
char is digit current next and then we
say okay a lengthy I guess it's not
864
00:20:42,369 --> 00:20:42,379
say okay a lengthy I guess it's not
865
00:20:42,379 --> 00:20:44,169
say okay a lengthy I guess it's not
really nice that we have this leaky
866
00:20:44,169 --> 00:20:44,179
really nice that we have this leaky
867
00:20:44,179 --> 00:20:45,369
really nice that we have this leaky
abstraction here and we have a position
868
00:20:45,369 --> 00:20:45,379
abstraction here and we have a position
869
00:20:45,379 --> 00:20:47,589
abstraction here and we have a position
on them kind of to know what's going on
870
00:20:47,589 --> 00:20:47,599
on them kind of to know what's going on
871
00:20:47,599 --> 00:20:49,570
on them kind of to know what's going on
but let's deal with that for now so we
872
00:20:49,570 --> 00:20:49,580
but let's deal with that for now so we
873
00:20:49,580 --> 00:20:53,109
but let's deal with that for now so we
say in length would be position minus
874
00:20:53,109 --> 00:20:53,119
say in length would be position minus
875
00:20:53,119 --> 00:20:56,969
say in length would be position minus
start and then we can save our text is
876
00:20:56,969 --> 00:20:56,979
start and then we can save our text is
877
00:20:56,979 --> 00:21:05,259
start and then we can save our text is
text substring for start and length so
878
00:21:05,259 --> 00:21:05,269
text substring for start and length so
879
00:21:05,269 --> 00:21:06,820
text substring for start and length so
basically the idea here is that we will
880
00:21:06,820 --> 00:21:06,830
basically the idea here is that we will
881
00:21:06,830 --> 00:21:10,570
basically the idea here is that we will
keep reading numbers and then at the end
882
00:21:10,570 --> 00:21:10,580
keep reading numbers and then at the end
883
00:21:10,580 --> 00:21:12,219
keep reading numbers and then at the end
we just create the word that represents
884
00:21:12,219 --> 00:21:12,229
we just create the word that represents
885
00:21:12,229 --> 00:21:15,369
we just create the word that represents
the number so we would say var so I
886
00:21:15,369 --> 00:21:15,379
the number so we would say var so I
887
00:21:15,379 --> 00:21:21,820
the number so we would say var so I
returned news and text token no not like
888
00:21:21,820 --> 00:21:21,830
returned news and text token no not like
889
00:21:21,830 --> 00:21:26,289
returned news and text token no not like
that so I cannot type this morning
890
00:21:26,289 --> 00:21:26,299
that so I cannot type this morning
891
00:21:26,299 --> 00:21:29,589
that so I cannot type this morning
what's going on here ah I see what's
892
00:21:29,589 --> 00:21:29,599
what's going on here ah I see what's
893
00:21:29,599 --> 00:21:30,459
what's going on here ah I see what's
going on all right
894
00:21:30,459 --> 00:21:30,469
going on all right
895
00:21:30,469 --> 00:21:32,440
going on all right
look at a new subjects token we say the
896
00:21:32,440 --> 00:21:32,450
look at a new subjects token we say the
897
00:21:32,450 --> 00:21:35,139
look at a new subjects token we say the
syntax kind would be it's called as
898
00:21:35,139 --> 00:21:35,149
syntax kind would be it's called as
899
00:21:35,149 --> 00:21:37,599
syntax kind would be it's called as
number token for now and let me say the
900
00:21:37,599 --> 00:21:37,609
number token for now and let me say the
901
00:21:37,609 --> 00:21:40,450
number token for now and let me say the
position is starred and then the text is
902
00:21:40,450 --> 00:21:40,460
position is starred and then the text is
903
00:21:40,460 --> 00:21:48,459
position is starred and then the text is
text let's generate the enum member all
904
00:21:48,459 --> 00:21:48,469
text let's generate the enum member all
905
00:21:48,469 --> 00:21:50,950
text let's generate the enum member all
right so now we have the number as text
906
00:21:50,950 --> 00:21:50,960
right so now we have the number as text
907
00:21:50,960 --> 00:21:52,810
right so now we have the number as text
which is probably for later faces not
908
00:21:52,810 --> 00:21:52,820
which is probably for later faces not
909
00:21:52,820 --> 00:21:54,729
which is probably for later faces not
super useful so normally what you do for
910
00:21:54,729 --> 00:21:54,739
super useful so normally what you do for
911
00:21:54,739 --> 00:21:56,739
super useful so normally what you do for
tokens as well as you would say the
912
00:21:56,739 --> 00:21:56,749
tokens as well as you would say the
913
00:21:56,749 --> 00:21:58,539
tokens as well as you would say the
lecture is the party that is responsible
914
00:21:58,539 --> 00:21:58,549
lecture is the party that is responsible
915
00:21:58,549 --> 00:22:00,879
lecture is the party that is responsible
for actually you know reading it into
916
00:22:00,879 --> 00:22:00,889
for actually you know reading it into
917
00:22:00,889 --> 00:22:03,459
for actually you know reading it into
the actual value so let's do this let's
918
00:22:03,459 --> 00:22:03,469
the actual value so let's do this let's
919
00:22:03,469 --> 00:22:05,829
the actual value so let's do this let's
just say in tryparse
920
00:22:05,829 --> 00:22:05,839
just say in tryparse
921
00:22:05,839 --> 00:22:08,799
just say in tryparse
on the text
922
00:22:08,799 --> 00:22:08,809
on the text
923
00:22:08,809 --> 00:22:12,729
on the text
and let me say out of our value and we
924
00:22:12,729 --> 00:22:12,739
and let me say out of our value and we
925
00:22:12,739 --> 00:22:14,320
and let me say out of our value and we
don't really I don't really care right
926
00:22:14,320 --> 00:22:14,330
don't really I don't really care right
927
00:22:14,330 --> 00:22:15,849
don't really I don't really care right
now whether it succeeds or not of course
928
00:22:15,849 --> 00:22:15,859
now whether it succeeds or not of course
929
00:22:15,859 --> 00:22:19,779
now whether it succeeds or not of course
we need to add error handling boy we'll
930
00:22:19,779 --> 00:22:19,789
we need to add error handling boy we'll
931
00:22:19,789 --> 00:22:22,599
we need to add error handling boy we'll
do this later so let me actually go here
932
00:22:22,599 --> 00:22:22,609
do this later so let me actually go here
933
00:22:22,609 --> 00:22:25,089
do this later so let me actually go here
and that's actually object value let's
934
00:22:25,089 --> 00:22:25,099
and that's actually object value let's
935
00:22:25,099 --> 00:22:28,299
and that's actually object value let's
accept this guy as well so we had the
936
00:22:28,299 --> 00:22:28,309
accept this guy as well so we had the
937
00:22:28,309 --> 00:22:30,609
accept this guy as well so we had the
actual representation I'd use object for
938
00:22:30,609 --> 00:22:30,619
actual representation I'd use object for
939
00:22:30,619 --> 00:22:31,749
actual representation I'd use object for
now because we probably have other
940
00:22:31,749 --> 00:22:31,759
now because we probably have other
941
00:22:31,759 --> 00:22:33,219
now because we probably have other
shapes later that we want to have like
942
00:22:33,219 --> 00:22:33,229
shapes later that we want to have like
943
00:22:33,229 --> 00:22:35,919
shapes later that we want to have like
strings or floats so type in this is in
944
00:22:35,919 --> 00:22:35,929
strings or floats so type in this is in
945
00:22:35,929 --> 00:22:37,299
strings or floats so type in this is in
this probably not going to be a winning
946
00:22:37,299 --> 00:22:37,309
this probably not going to be a winning
947
00:22:37,309 --> 00:22:41,969
this probably not going to be a winning
proposition all right then we can say
948
00:22:41,969 --> 00:22:41,979
proposition all right then we can say
949
00:22:41,979 --> 00:22:45,599
proposition all right then we can say
okay bar is white space let's say
950
00:22:45,599 --> 00:22:45,609
okay bar is white space let's say
951
00:22:45,609 --> 00:22:49,810
okay bar is white space let's say
current and then this guy basically
952
00:22:49,810 --> 00:22:49,820
current and then this guy basically
953
00:22:49,820 --> 00:22:53,079
current and then this guy basically
repeats we do something like that again
954
00:22:53,079 --> 00:22:53,089
repeats we do something like that again
955
00:22:53,089 --> 00:22:56,349
repeats we do something like that again
say as long as this guy's white space
956
00:22:56,349 --> 00:22:56,359
say as long as this guy's white space
957
00:22:56,359 --> 00:22:59,829
say as long as this guy's white space
keep reading and then we say white space
958
00:22:59,829 --> 00:22:59,839
keep reading and then we say white space
959
00:22:59,839 --> 00:23:06,459
keep reading and then we say white space
token for now and I think I just lost
960
00:23:06,459 --> 00:23:06,469
token for now and I think I just lost
961
00:23:06,469 --> 00:23:10,269
token for now and I think I just lost
the light yeah I may have run out of
962
00:23:10,269 --> 00:23:10,279
the light yeah I may have run out of
963
00:23:10,279 --> 00:23:12,549
the light yeah I may have run out of
battery so if later on it might get
964
00:23:12,549 --> 00:23:12,559
battery so if later on it might get
965
00:23:12,559 --> 00:23:14,680
battery so if later on it might get
darker a lot my face that might not be
966
00:23:14,680 --> 00:23:14,690
darker a lot my face that might not be
967
00:23:14,690 --> 00:23:17,349
darker a lot my face that might not be
my mood or depending on how the last you
968
00:23:17,349 --> 00:23:17,359
my mood or depending on how the last you
969
00:23:17,359 --> 00:23:20,469
my mood or depending on how the last you
because it might be my mood we'll see
970
00:23:20,469 --> 00:23:20,479
because it might be my mood we'll see
971
00:23:20,479 --> 00:23:22,629
because it might be my mood we'll see
all right so now we have the white
972
00:23:22,629 --> 00:23:22,639
all right so now we have the white
973
00:23:22,639 --> 00:23:25,269
all right so now we have the white
spaces covered which gives us most of
974
00:23:25,269 --> 00:23:25,279
spaces covered which gives us most of
975
00:23:25,279 --> 00:23:27,219
spaces covered which gives us most of
them we need and then I think you only
976
00:23:27,219 --> 00:23:27,229
them we need and then I think you only
977
00:23:27,229 --> 00:23:30,989
them we need and then I think you only
have the special cases now if current
978
00:23:30,989 --> 00:23:30,999
have the special cases now if current
979
00:23:30,999 --> 00:23:34,930
have the special cases now if current
equals let's say plus then we do
980
00:23:34,930 --> 00:23:34,940
equals let's say plus then we do
981
00:23:34,940 --> 00:23:44,579
equals let's say plus then we do
something much much simpler we would say
982
00:23:44,579 --> 00:23:44,589
983
00:23:44,589 --> 00:23:47,979
984
00:23:47,979 --> 00:23:47,989
position let's just cheat here c-sharp
985
00:23:47,989 --> 00:23:54,149
position let's just cheat here c-sharp
for the win position plus plus text is
986
00:23:54,149 --> 00:23:54,159
for the win position plus plus text is
987
00:23:54,159 --> 00:23:57,639
for the win position plus plus text is
this guy and we don't have any value and
988
00:23:57,639 --> 00:23:57,649
this guy and we don't have any value and
989
00:23:57,649 --> 00:24:05,600
this guy and we don't have any value and
we call this the plus token
990
00:24:05,600 --> 00:24:05,610
991
00:24:05,610 --> 00:24:12,510
992
00:24:12,510 --> 00:24:12,520
and then it's handled - as well while we
993
00:24:12,520 --> 00:24:19,830
and then it's handled - as well while we
edit and then let's do actually let's do
994
00:24:19,830 --> 00:24:19,840
edit and then let's do actually let's do
995
00:24:19,840 --> 00:24:25,760
edit and then let's do actually let's do
them all while we edit / open paren
996
00:24:25,760 --> 00:24:25,770
them all while we edit / open paren
997
00:24:25,770 --> 00:24:28,890
them all while we edit / open paren
close paren and then we call this guy
998
00:24:28,890 --> 00:24:28,900
close paren and then we call this guy
999
00:24:28,900 --> 00:24:32,660
close paren and then we call this guy
the - token
1000
00:24:32,660 --> 00:24:32,670
the - token
1001
00:24:32,670 --> 00:24:39,780
the - token
it's called this star token this guy
1002
00:24:39,780 --> 00:24:39,790
it's called this star token this guy
1003
00:24:39,790 --> 00:24:44,610
it's called this star token this guy
would be the slash token this guy would
1004
00:24:44,610 --> 00:24:44,620
would be the slash token this guy would
1005
00:24:44,620 --> 00:24:50,490
would be the slash token this guy would
be the open / and this is token if I get
1006
00:24:50,490 --> 00:24:50,500
be the open / and this is token if I get
1007
00:24:50,500 --> 00:24:53,010
be the open / and this is token if I get
this ever ride I suck at typing that's
1008
00:24:53,010 --> 00:24:53,020
this ever ride I suck at typing that's
1009
00:24:53,020 --> 00:24:55,620
this ever ride I suck at typing that's
why intelligence is such an important
1010
00:24:55,620 --> 00:24:55,630
why intelligence is such an important
1011
00:24:55,630 --> 00:24:56,670
why intelligence is such an important
thing for me I just wish I had
1012
00:24:56,670 --> 00:24:56,680
thing for me I just wish I had
1013
00:24:56,680 --> 00:25:01,080
thing for me I just wish I had
intelligence for English all right so
1014
00:25:01,080 --> 00:25:01,090
intelligence for English all right so
1015
00:25:01,090 --> 00:25:04,080
intelligence for English all right so
now we have most of these guys I think
1016
00:25:04,080 --> 00:25:04,090
now we have most of these guys I think
1017
00:25:04,090 --> 00:25:05,880
now we have most of these guys I think
and of course we screwed up the text
1018
00:25:05,880 --> 00:25:05,890
and of course we screwed up the text
1019
00:25:05,890 --> 00:25:09,690
and of course we screwed up the text
yeah of course I could use the original
1020
00:25:09,690 --> 00:25:09,700
yeah of course I could use the original
1021
00:25:09,700 --> 00:25:11,880
yeah of course I could use the original
text on the input but you know what for
1022
00:25:11,880 --> 00:25:11,890
text on the input but you know what for
1023
00:25:11,890 --> 00:25:13,410
text on the input but you know what for
these kind of tokens it feels wasteful
1024
00:25:13,410 --> 00:25:13,420
these kind of tokens it feels wasteful
1025
00:25:13,420 --> 00:25:15,380
these kind of tokens it feels wasteful
to do the substring operations because
1026
00:25:15,380 --> 00:25:15,390
to do the substring operations because
1027
00:25:15,390 --> 00:25:19,560
to do the substring operations because
they are you know fixed and the nice
1028
00:25:19,560 --> 00:25:19,570
they are you know fixed and the nice
1029
00:25:19,570 --> 00:25:20,700
they are you know fixed and the nice
thing with literals is that they're all
1030
00:25:20,700 --> 00:25:20,710
thing with literals is that they're all
1031
00:25:20,710 --> 00:25:22,770
thing with literals is that they're all
in turn so you don't actually allocating
1032
00:25:22,770 --> 00:25:22,780
in turn so you don't actually allocating
1033
00:25:22,780 --> 00:25:26,460
in turn so you don't actually allocating
your string objects for that quite handy
1034
00:25:26,460 --> 00:25:26,470
your string objects for that quite handy
1035
00:25:26,470 --> 00:25:27,840
your string objects for that quite handy
all right so now the questions if you
1036
00:25:27,840 --> 00:25:27,850
all right so now the questions if you
1037
00:25:27,850 --> 00:25:29,760
all right so now the questions if you
get to this point then we probably found
1038
00:25:29,760 --> 00:25:29,770
get to this point then we probably found
1039
00:25:29,770 --> 00:25:31,470
get to this point then we probably found
something that we don't know what we
1040
00:25:31,470 --> 00:25:31,480
something that we don't know what we
1041
00:25:31,480 --> 00:25:33,120
something that we don't know what we
should do with that and so one thing
1042
00:25:33,120 --> 00:25:33,130
should do with that and so one thing
1043
00:25:33,130 --> 00:25:35,790
should do with that and so one thing
that you can do is you can just say new
1044
00:25:35,790 --> 00:25:35,800
that you can do is you can just say new
1045
00:25:35,800 --> 00:25:38,970
that you can do is you can just say new
syntax token syntax
1046
00:25:38,970 --> 00:25:38,980
syntax token syntax
1047
00:25:38,980 --> 00:25:45,540
syntax token syntax
kind it's called this bat token and yeah
1048
00:25:45,540 --> 00:25:45,550
kind it's called this bat token and yeah
1049
00:25:45,550 --> 00:25:47,550
kind it's called this bat token and yeah
I guess at this point we should have I
1050
00:25:47,550 --> 00:25:47,560
I guess at this point we should have I
1051
00:25:47,560 --> 00:25:54,170
I guess at this point we should have I
guess yeah I guess we can achieve again
1052
00:25:54,170 --> 00:25:54,180
guess yeah I guess we can achieve again
1053
00:25:54,180 --> 00:25:56,610
guess yeah I guess we can achieve again
bad language semantics for the win so we
1054
00:25:56,610 --> 00:25:56,620
bad language semantics for the win so we
1055
00:25:56,620 --> 00:26:01,070
bad language semantics for the win so we
can say this would be text position
1056
00:26:01,070 --> 00:26:01,080
can say this would be text position
1057
00:26:01,080 --> 00:26:03,270
can say this would be text position
minus one because this guy has already
1058
00:26:03,270 --> 00:26:03,280
minus one because this guy has already
1059
00:26:03,280 --> 00:26:06,720
minus one because this guy has already
been incremented so we go back yeah I
1060
00:26:06,720 --> 00:26:06,730
been incremented so we go back yeah I
1061
00:26:06,730 --> 00:26:08,460
been incremented so we go back yeah I
guess we didn't need to do a substring
1062
00:26:08,460 --> 00:26:08,470
guess we didn't need to do a substring
1063
00:26:08,470 --> 00:26:09,389
guess we didn't need to do a substring
here
1064
00:26:09,389 --> 00:26:09,399
here
1065
00:26:09,399 --> 00:26:11,820
here
sub-string for the previous position
1066
00:26:11,820 --> 00:26:11,830
sub-string for the previous position
1067
00:26:11,830 --> 00:26:15,519
sub-string for the previous position
only one character and then we have no
1068
00:26:15,519 --> 00:26:15,529
only one character and then we have no
1069
00:26:15,529 --> 00:26:19,450
only one character and then we have no
value I guess this is a comma not a
1070
00:26:19,450 --> 00:26:19,460
value I guess this is a comma not a
1071
00:26:19,460 --> 00:26:22,619
value I guess this is a comma not a
semicolon
1072
00:26:22,619 --> 00:26:22,629
1073
00:26:22,629 --> 00:26:24,850
1074
00:26:24,850 --> 00:26:24,860
all right they're talking we add to our
1075
00:26:24,860 --> 00:26:28,930
all right they're talking we add to our
list all right now we have our lecture
1076
00:26:28,930 --> 00:26:28,940
list all right now we have our lecture
1077
00:26:28,940 --> 00:26:31,739
list all right now we have our lecture
that can recognize numbers + - / +
1078
00:26:31,739 --> 00:26:31,749
that can recognize numbers + - / +
1079
00:26:31,749 --> 00:26:34,180
that can recognize numbers + - / +
whitespace so before we go ahead let's
1080
00:26:34,180 --> 00:26:34,190
whitespace so before we go ahead let's
1081
00:26:34,190 --> 00:26:35,769
whitespace so before we go ahead let's
actually make our repple just print it
1082
00:26:35,769 --> 00:26:35,779
actually make our repple just print it
1083
00:26:35,779 --> 00:26:38,619
actually make our repple just print it
back to us so we actually know what's
1084
00:26:38,619 --> 00:26:38,629
back to us so we actually know what's
1085
00:26:38,629 --> 00:26:39,190
back to us so we actually know what's
going on
1086
00:26:39,190 --> 00:26:39,200
going on
1087
00:26:39,200 --> 00:26:41,169
going on
so let's actually allocate a lecturer no
1088
00:26:41,169 --> 00:26:41,179
so let's actually allocate a lecturer no
1089
00:26:41,179 --> 00:26:47,249
so let's actually allocate a lecturer no
lecturer for the line and then we say
1090
00:26:47,249 --> 00:26:47,259
lecturer for the line and then we say
1091
00:26:47,259 --> 00:26:53,919
lecturer for the line and then we say
while tool bar a token enclosed excerpt
1092
00:26:53,919 --> 00:26:53,929
while tool bar a token enclosed excerpt
1093
00:26:53,929 --> 00:27:00,639
while tool bar a token enclosed excerpt
reads good how do we call it next okay
1094
00:27:00,639 --> 00:27:00,649
reads good how do we call it next okay
1095
00:27:00,649 --> 00:27:06,849
reads good how do we call it next okay
all right next token oh yeah one thing
1096
00:27:06,849 --> 00:27:06,859
all right next token oh yeah one thing
1097
00:27:06,859 --> 00:27:08,139
all right next token oh yeah one thing
we should probably do that's also
1098
00:27:08,139 --> 00:27:08,149
we should probably do that's also
1099
00:27:08,149 --> 00:27:10,180
we should probably do that's also
conventional is that there's this magic
1100
00:27:10,180 --> 00:27:10,190
conventional is that there's this magic
1101
00:27:10,190 --> 00:27:12,879
conventional is that there's this magic
token called end of file so at the very
1102
00:27:12,879 --> 00:27:12,889
token called end of file so at the very
1103
00:27:12,889 --> 00:27:15,190
token called end of file so at the very
beginning we should probably say if the
1104
00:27:15,190 --> 00:27:15,200
beginning we should probably say if the
1105
00:27:15,200 --> 00:27:21,999
beginning we should probably say if the
position is text length or larger than
1106
00:27:21,999 --> 00:27:22,009
position is text length or larger than
1107
00:27:22,009 --> 00:27:25,450
position is text length or larger than
that then we just return the magic new
1108
00:27:25,450 --> 00:27:25,460
that then we just return the magic new
1109
00:27:25,460 --> 00:27:29,649
that then we just return the magic new
syntax token and we call this in kind
1110
00:27:29,649 --> 00:27:29,659
syntax token and we call this in kind
1111
00:27:29,659 --> 00:27:36,909
syntax token and we call this in kind
and of file token the position is the
1112
00:27:36,909 --> 00:27:36,919
and of file token the position is the
1113
00:27:36,919 --> 00:27:42,430
and of file token the position is the
end of file it has no text well I guess
1114
00:27:42,430 --> 00:27:42,440
end of file it has no text well I guess
1115
00:27:42,440 --> 00:27:44,349
end of file it has no text well I guess
we could cheat and say this is the magic
1116
00:27:44,349 --> 00:27:44,359
we could cheat and say this is the magic
1117
00:27:44,359 --> 00:27:47,919
we could cheat and say this is the magic
thing here and let me say has no value
1118
00:27:47,919 --> 00:27:47,929
thing here and let me say has no value
1119
00:27:47,929 --> 00:27:51,639
thing here and let me say has no value
so this is effectively done by pretty
1120
00:27:51,639 --> 00:27:51,649
so this is effectively done by pretty
1121
00:27:51,649 --> 00:27:53,109
so this is effectively done by pretty
much any parser in the universe because
1122
00:27:53,109 --> 00:27:53,119
much any parser in the universe because
1123
00:27:53,119 --> 00:27:55,060
much any parser in the universe because
it allows the reader to know when
1124
00:27:55,060 --> 00:27:55,070
it allows the reader to know when
1125
00:27:55,070 --> 00:27:57,399
it allows the reader to know when
there's no more stuff coming so this is
1126
00:27:57,399 --> 00:27:57,409
there's no more stuff coming so this is
1127
00:27:57,409 --> 00:27:59,080
there's no more stuff coming so this is
basically a virtual token it doesn't
1128
00:27:59,080 --> 00:27:59,090
basically a virtual token it doesn't
1129
00:27:59,090 --> 00:28:01,629
basically a virtual token it doesn't
actually exist in the input file unless
1130
00:28:01,629 --> 00:28:01,639
actually exist in the input file unless
1131
00:28:01,639 --> 00:28:02,950
actually exist in the input file unless
you think and see and you think the
1132
00:28:02,950 --> 00:28:02,960
you think and see and you think the
1133
00:28:02,960 --> 00:28:05,080
you think and see and you think the
string is always 0 terminated in which
1134
00:28:05,080 --> 00:28:05,090
string is always 0 terminated in which
1135
00:28:05,090 --> 00:28:06,399
string is always 0 terminated in which
case you can think of it as the 0
1136
00:28:06,399 --> 00:28:06,409
case you can think of it as the 0
1137
00:28:06,409 --> 00:28:08,979
case you can think of it as the 0
terminator alright so now we have the
1138
00:28:08,979 --> 00:28:08,989
terminator alright so now we have the
1139
00:28:08,989 --> 00:28:11,859
terminator alright so now we have the
token now let's put this guy so let's
1140
00:28:11,859 --> 00:28:11,869
token now let's put this guy so let's
1141
00:28:11,869 --> 00:28:15,099
token now let's put this guy so let's
say console.writeline so i guess we
1142
00:28:15,099 --> 00:28:15,109
say console.writeline so i guess we
1143
00:28:15,109 --> 00:28:17,060
say console.writeline so i guess we
could say if token
1144
00:28:17,060 --> 00:28:17,070
could say if token
1145
00:28:17,070 --> 00:28:22,100
could say if token
kind equals syntax kind and a file token
1146
00:28:22,100 --> 00:28:22,110
kind equals syntax kind and a file token
1147
00:28:22,110 --> 00:28:24,970
kind equals syntax kind and a file token
and we can just say stop it
1148
00:28:24,970 --> 00:28:24,980
and we can just say stop it
1149
00:28:24,980 --> 00:28:33,680
and we can just say stop it
otherwise obscene otherwise we write the
1150
00:28:33,680 --> 00:28:33,690
otherwise obscene otherwise we write the
1151
00:28:33,690 --> 00:28:40,520
otherwise obscene otherwise we write the
token kind and yeah let's print the text
1152
00:28:40,520 --> 00:28:40,530
token kind and yeah let's print the text
1153
00:28:40,530 --> 00:28:48,400
token kind and yeah let's print the text
as well talking text
1154
00:28:48,400 --> 00:28:48,410
1155
00:28:48,410 --> 00:28:52,570
1156
00:28:52,570 --> 00:28:52,580
in fact let's also say if token value is
1157
00:28:52,580 --> 00:29:02,620
in fact let's also say if token value is
not now then console right
1158
00:29:02,620 --> 00:29:02,630
1159
00:29:02,630 --> 00:29:04,270
1160
00:29:04,270 --> 00:29:04,280
yeah let's do it into a belated string
1161
00:29:04,280 --> 00:29:06,700
yeah let's do it into a belated string
here as well let's say what is that
1162
00:29:06,700 --> 00:29:06,710
here as well let's say what is that
1163
00:29:06,710 --> 00:29:11,490
here as well let's say what is that
token dot radio and then we can say
1164
00:29:11,490 --> 00:29:11,500
token dot radio and then we can say
1165
00:29:11,500 --> 00:29:15,490
token dot radio and then we can say
console dot write line so if you're
1166
00:29:15,490 --> 00:29:15,500
console dot write line so if you're
1167
00:29:15,500 --> 00:29:16,720
console dot write line so if you're
thinking to yourself I know this all
1168
00:29:16,720 --> 00:29:16,730
thinking to yourself I know this all
1169
00:29:16,730 --> 00:29:19,150
thinking to yourself I know this all
looks horribly inefficient that is kind
1170
00:29:19,150 --> 00:29:19,160
looks horribly inefficient that is kind
1171
00:29:19,160 --> 00:29:21,820
looks horribly inefficient that is kind
of okay because we still write our
1172
00:29:21,820 --> 00:29:21,830
of okay because we still write our
1173
00:29:21,830 --> 00:29:23,890
of okay because we still write our
compiler right so we want to not waste
1174
00:29:23,890 --> 00:29:23,900
compiler right so we want to not waste
1175
00:29:23,900 --> 00:29:26,680
compiler right so we want to not waste
too much time doing stuff we don't care
1176
00:29:26,680 --> 00:29:26,690
too much time doing stuff we don't care
1177
00:29:26,690 --> 00:29:30,220
too much time doing stuff we don't care
about yet all right so now let's see how
1178
00:29:30,220 --> 00:29:30,230
about yet all right so now let's see how
1179
00:29:30,230 --> 00:29:33,580
about yet all right so now let's see how
bad I did the moment of truth so let's
1180
00:29:33,580 --> 00:29:33,590
bad I did the moment of truth so let's
1181
00:29:33,590 --> 00:29:38,980
bad I did the moment of truth so let's
say one plus two times three that's not
1182
00:29:38,980 --> 00:29:38,990
say one plus two times three that's not
1183
00:29:38,990 --> 00:29:41,470
say one plus two times three that's not
bad so far so we have a number token one
1184
00:29:41,470 --> 00:29:41,480
bad so far so we have a number token one
1185
00:29:41,480 --> 00:29:44,710
bad so far so we have a number token one
we have a whitespace token we have a
1186
00:29:44,710 --> 00:29:44,720
we have a whitespace token we have a
1187
00:29:44,720 --> 00:29:46,500
we have a whitespace token we have a
plus token we have a whitespace token
1188
00:29:46,500 --> 00:29:46,510
plus token we have a whitespace token
1189
00:29:46,510 --> 00:29:50,039
plus token we have a whitespace token
find out the whitespace tokens all have
1190
00:29:50,039 --> 00:29:50,049
find out the whitespace tokens all have
1191
00:29:50,049 --> 00:29:55,570
find out the whitespace tokens all have
values it seems how did that happen
1192
00:29:55,570 --> 00:29:55,580
values it seems how did that happen
1193
00:29:55,580 --> 00:30:00,880
values it seems how did that happen
oh because I'm needed because there's
1194
00:30:00,880 --> 00:30:00,890
oh because I'm needed because there's
1195
00:30:00,890 --> 00:30:10,990
oh because I'm needed because there's
really no reason to parse those guys
1196
00:30:10,990 --> 00:30:11,000
1197
00:30:11,000 --> 00:30:12,789
1198
00:30:12,789 --> 00:30:12,799
so now we're going to say let's say
1199
00:30:12,799 --> 00:30:15,039
so now we're going to say let's say
something similar like 123
1200
00:30:15,039 --> 00:30:15,049
something similar like 123
1201
00:30:15,049 --> 00:30:20,169
something similar like 123
- 456 so now we have one token that is 1
1202
00:30:20,169 --> 00:30:20,179
- 456 so now we have one token that is 1
1203
00:30:20,179 --> 00:30:20,860
- 456 so now we have one token that is 1
2 3
1204
00:30:20,860 --> 00:30:20,870
2 3
1205
00:30:20,870 --> 00:30:23,140
2 3
we have whitespace talk we have a -
1206
00:30:23,140 --> 00:30:23,150
we have whitespace talk we have a -
1207
00:30:23,150 --> 00:30:25,570
we have whitespace talk we have a -
token another whitespace token number
1208
00:30:25,570 --> 00:30:25,580
token another whitespace token number
1209
00:30:25,580 --> 00:30:27,820
token another whitespace token number
number token and that's the end so
1210
00:30:27,820 --> 00:30:27,830
number token and that's the end so
1211
00:30:27,830 --> 00:30:29,080
number token and that's the end so
that's pretty good so now we at least
1212
00:30:29,080 --> 00:30:29,090
that's pretty good so now we at least
1213
00:30:29,090 --> 00:30:31,899
that's pretty good so now we at least
know the detective actual Virts if you
1214
00:30:31,899 --> 00:30:31,909
know the detective actual Virts if you
1215
00:30:31,909 --> 00:30:36,850
know the detective actual Virts if you
will in the in the input so that's
1216
00:30:36,850 --> 00:30:36,860
will in the in the input so that's
1217
00:30:36,860 --> 00:30:40,149
will in the in the input so that's
pretty decent but this is obviously not
1218
00:30:40,149 --> 00:30:40,159
pretty decent but this is obviously not
1219
00:30:40,159 --> 00:30:42,520
pretty decent but this is obviously not
a parser yet so let's check the next
1220
00:30:42,520 --> 00:30:42,530
a parser yet so let's check the next
1221
00:30:42,530 --> 00:30:47,500
a parser yet so let's check the next
step here so know we had a lecture now
1222
00:30:47,500 --> 00:30:47,510
step here so know we had a lecture now
1223
00:30:47,510 --> 00:30:50,860
step here so know we had a lecture now
let's do a parser so the lexer produces
1224
00:30:50,860 --> 00:30:50,870
let's do a parser so the lexer produces
1225
00:30:50,870 --> 00:30:53,289
let's do a parser so the lexer produces
tokens which you can think of the leaves
1226
00:30:53,289 --> 00:30:53,299
tokens which you can think of the leaves
1227
00:30:53,299 --> 00:30:55,840
tokens which you can think of the leaves
in your tree and then the parser
1228
00:30:55,840 --> 00:30:55,850
in your tree and then the parser
1229
00:30:55,850 --> 00:30:59,049
in your tree and then the parser
produces the the actual sentences which
1230
00:30:59,049 --> 00:30:59,059
produces the the actual sentences which
1231
00:30:59,059 --> 00:31:02,140
produces the the actual sentences which
are trees and they're basically syntax
1232
00:31:02,140 --> 00:31:02,150
are trees and they're basically syntax
1233
00:31:02,150 --> 00:31:02,590
are trees and they're basically syntax
notes
1234
00:31:02,590 --> 00:31:02,600
notes
1235
00:31:02,600 --> 00:31:06,700
notes
so let's I'm fighting way too much of
1236
00:31:06,700 --> 00:31:06,710
so let's I'm fighting way too much of
1237
00:31:06,710 --> 00:31:08,890
so let's I'm fighting way too much of
this I don't know why the code folding
1238
00:31:08,890 --> 00:31:08,900
this I don't know why the code folding
1239
00:31:08,900 --> 00:31:11,560
this I don't know why the code folding
doesn't work the way I want alright
1240
00:31:11,560 --> 00:31:11,570
doesn't work the way I want alright
1241
00:31:11,570 --> 00:31:16,240
doesn't work the way I want alright
let's do a parser so there's multiple
1242
00:31:16,240 --> 00:31:16,250
let's do a parser so there's multiple
1243
00:31:16,250 --> 00:31:17,919
let's do a parser so there's multiple
ways you can do parser like if you read
1244
00:31:17,919 --> 00:31:17,929
ways you can do parser like if you read
1245
00:31:17,929 --> 00:31:21,520
ways you can do parser like if you read
the most of the compiler books from the
1246
00:31:21,520 --> 00:31:21,530
the most of the compiler books from the
1247
00:31:21,530 --> 00:31:24,880
the most of the compiler books from the
70s or 80s I'd say they actually really
1248
00:31:24,880 --> 00:31:24,890
70s or 80s I'd say they actually really
1249
00:31:24,890 --> 00:31:26,740
70s or 80s I'd say they actually really
highly optimized for streaming so they
1250
00:31:26,740 --> 00:31:26,750
highly optimized for streaming so they
1251
00:31:26,750 --> 00:31:30,430
highly optimized for streaming so they
try to not Lex the entire input they
1252
00:31:30,430 --> 00:31:30,440
try to not Lex the entire input they
1253
00:31:30,440 --> 00:31:32,200
try to not Lex the entire input they
will usually like consume one token at a
1254
00:31:32,200 --> 00:31:32,210
will usually like consume one token at a
1255
00:31:32,210 --> 00:31:33,880
will usually like consume one token at a
time and then maybe ever look ahead or
1256
00:31:33,880 --> 00:31:33,890
time and then maybe ever look ahead or
1257
00:31:33,890 --> 00:31:36,310
time and then maybe ever look ahead or
whatever but one of computers are really
1258
00:31:36,310 --> 00:31:36,320
whatever but one of computers are really
1259
00:31:36,320 --> 00:31:38,860
whatever but one of computers are really
good and so what I just will do is I
1260
00:31:38,860 --> 00:31:38,870
good and so what I just will do is I
1261
00:31:38,870 --> 00:31:41,909
good and so what I just will do is I
will just say screw this I would just
1262
00:31:41,909 --> 00:31:41,919
will just say screw this I would just
1263
00:31:41,919 --> 00:31:44,529
will just say screw this I would just
actually in it it's a parser I would
1264
00:31:44,529 --> 00:31:44,539
actually in it it's a parser I would
1265
00:31:44,539 --> 00:31:46,810
actually in it it's a parser I would
take the text here as well
1266
00:31:46,810 --> 00:31:46,820
take the text here as well
1267
00:31:46,820 --> 00:31:49,029
take the text here as well
and then what I will do is the first
1268
00:31:49,029 --> 00:31:49,039
and then what I will do is the first
1269
00:31:49,039 --> 00:31:51,130
and then what I will do is the first
step is I will literally just run the
1270
00:31:51,130 --> 00:31:51,140
step is I will literally just run the
1271
00:31:51,140 --> 00:31:53,260
step is I will literally just run the
lecture on the entire input so I will
1272
00:31:53,260 --> 00:31:53,270
lecture on the entire input so I will
1273
00:31:53,270 --> 00:31:57,700
lecture on the entire input so I will
create a lecture here new extra but that
1274
00:31:57,700 --> 00:31:57,710
create a lecture here new extra but that
1275
00:31:57,710 --> 00:32:02,380
create a lecture here new extra but that
will give the text this is one of those
1276
00:32:02,380 --> 00:32:02,390
will give the text this is one of those
1277
00:32:02,390 --> 00:32:05,680
will give the text this is one of those
moments where I think I wonder why you a
1278
00:32:05,680 --> 00:32:05,690
moments where I think I wonder why you a
1279
00:32:05,690 --> 00:32:07,390
moments where I think I wonder why you a
do loop I will probably regret this
1280
00:32:07,390 --> 00:32:07,400
do loop I will probably regret this
1281
00:32:07,400 --> 00:32:09,669
do loop I will probably regret this
choice because every single time I did
1282
00:32:09,669 --> 00:32:09,679
choice because every single time I did
1283
00:32:09,679 --> 00:32:12,460
choice because every single time I did
that I later on we voted into a while
1284
00:32:12,460 --> 00:32:12,470
that I later on we voted into a while
1285
00:32:12,470 --> 00:32:17,500
that I later on we voted into a while
true loop token equals lecture
1286
00:32:17,500 --> 00:32:17,510
true loop token equals lecture
1287
00:32:17,510 --> 00:32:20,409
true loop token equals lecture
good next next okay I'm bad at naming
1288
00:32:20,409 --> 00:32:20,419
good next next okay I'm bad at naming
1289
00:32:20,419 --> 00:32:23,560
good next next okay I'm bad at naming
did I mention that yeah next okay and
1290
00:32:23,560 --> 00:32:23,570
did I mention that yeah next okay and
1291
00:32:23,570 --> 00:32:28,780
did I mention that yeah next okay and
let me say if token let's say is syntax
1292
00:32:28,780 --> 00:32:28,790
let me say if token let's say is syntax
1293
00:32:28,790 --> 00:32:31,500
let me say if token let's say is syntax
actually no that's the well part right
1294
00:32:31,500 --> 00:32:31,510
actually no that's the well part right
1295
00:32:31,510 --> 00:32:36,010
actually no that's the well part right
while token kind is not syntax kind and
1296
00:32:36,010 --> 00:32:36,020
while token kind is not syntax kind and
1297
00:32:36,020 --> 00:32:39,340
while token kind is not syntax kind and
all file we keep doing this now what we
1298
00:32:39,340 --> 00:32:39,350
all file we keep doing this now what we
1299
00:32:39,350 --> 00:32:42,430
all file we keep doing this now what we
need here is we need a list of tokens so
1300
00:32:42,430 --> 00:32:42,440
need here is we need a list of tokens so
1301
00:32:42,440 --> 00:32:48,630
need here is we need a list of tokens so
let's say of our tokens equals new list
1302
00:32:48,630 --> 00:32:48,640
let's say of our tokens equals new list
1303
00:32:48,640 --> 00:32:54,370
let's say of our tokens equals new list
syntax token and then we will just say
1304
00:32:54,370 --> 00:32:54,380
syntax token and then we will just say
1305
00:32:54,380 --> 00:33:00,130
syntax token and then we will just say
if token kind is not syntax kind
1306
00:33:00,130 --> 00:33:00,140
if token kind is not syntax kind
1307
00:33:00,140 --> 00:33:01,360
if token kind is not syntax kind
whitespace because really don't care
1308
00:33:01,360 --> 00:33:01,370
whitespace because really don't care
1309
00:33:01,370 --> 00:33:02,970
whitespace because really don't care
about whitespace for the most part right
1310
00:33:02,970 --> 00:33:02,980
about whitespace for the most part right
1311
00:33:02,980 --> 00:33:11,290
about whitespace for the most part right
and if it's not a bad token token kind
1312
00:33:11,290 --> 00:33:11,300
1313
00:33:11,300 --> 00:33:19,490
1314
00:33:19,490 --> 00:33:19,500
bad token then we say tokens dot at
1315
00:33:19,500 --> 00:33:25,160
bad token then we say tokens dot at
token I'm probably be using for that guy
1316
00:33:25,160 --> 00:33:25,170
token I'm probably be using for that guy
1317
00:33:25,170 --> 00:33:30,400
token I'm probably be using for that guy
yep all right now let's say tokens
1318
00:33:30,400 --> 00:33:30,410
1319
00:33:30,410 --> 00:33:37,070
1320
00:33:37,070 --> 00:33:37,080
equals tokens to array because why not
1321
00:33:37,080 --> 00:33:41,450
equals tokens to array because why not
and then we say create me if we'd only
1322
00:33:41,450 --> 00:33:41,460
and then we say create me if we'd only
1323
00:33:41,460 --> 00:33:45,650
and then we say create me if we'd only
filled tokens sweet I'll so much the
1324
00:33:45,650 --> 00:33:45,660
filled tokens sweet I'll so much the
1325
00:33:45,660 --> 00:33:48,590
filled tokens sweet I'll so much the
other one we need a position which is
1326
00:33:48,590 --> 00:33:48,600
other one we need a position which is
1327
00:33:48,600 --> 00:33:59,390
other one we need a position which is
basically our current token yeah
1328
00:33:59,390 --> 00:33:59,400
basically our current token yeah
1329
00:33:59,400 --> 00:34:00,830
basically our current token yeah
what's important is if you read this
1330
00:34:00,830 --> 00:34:00,840
what's important is if you read this
1331
00:34:00,840 --> 00:34:03,860
what's important is if you read this
correctly end of file is part of the
1332
00:34:03,860 --> 00:34:03,870
correctly end of file is part of the
1333
00:34:03,870 --> 00:34:05,420
correctly end of file is part of the
token list all right so that means I
1334
00:34:05,420 --> 00:34:05,430
token list all right so that means I
1335
00:34:05,430 --> 00:34:07,460
token list all right so that means I
always know even on an empty input I
1336
00:34:07,460 --> 00:34:07,470
always know even on an empty input I
1337
00:34:07,470 --> 00:34:09,350
always know even on an empty input I
will always have one token which is end
1338
00:34:09,350 --> 00:34:09,360
will always have one token which is end
1339
00:34:09,360 --> 00:34:14,060
will always have one token which is end
of file so what we can do is we can say
1340
00:34:14,060 --> 00:34:14,070
of file so what we can do is we can say
1341
00:34:14,070 --> 00:34:17,659
of file so what we can do is we can say
we have a pub no private private syntax
1342
00:34:17,659 --> 00:34:17,669
we have a pub no private private syntax
1343
00:34:17,669 --> 00:34:22,700
we have a pub no private private syntax
token let's call this peak end offset
1344
00:34:22,700 --> 00:34:22,710
token let's call this peak end offset
1345
00:34:22,710 --> 00:34:25,850
token let's call this peak end offset
and I will later on tell you why I think
1346
00:34:25,850 --> 00:34:25,860
and I will later on tell you why I think
1347
00:34:25,860 --> 00:34:29,500
and I will later on tell you why I think
this is useful so we say index equals
1348
00:34:29,500 --> 00:34:29,510
this is useful so we say index equals
1349
00:34:29,510 --> 00:34:39,139
this is useful so we say index equals
position plus offset if index is outside
1350
00:34:39,139 --> 00:34:39,149
position plus offset if index is outside
1351
00:34:39,149 --> 00:34:43,899
position plus offset if index is outside
the bounds we will just return tokens
1352
00:34:43,899 --> 00:34:43,909
the bounds we will just return tokens
1353
00:34:43,909 --> 00:34:47,810
the bounds we will just return tokens
tokens length minus 1 we just returned
1354
00:34:47,810 --> 00:34:47,820
tokens length minus 1 we just returned
1355
00:34:47,820 --> 00:34:53,570
tokens length minus 1 we just returned
the last one otherwise we return tokens
1356
00:34:53,570 --> 00:34:53,580
the last one otherwise we return tokens
1357
00:34:53,580 --> 00:34:57,080
the last one otherwise we return tokens
index so this means I don't have to
1358
00:34:57,080 --> 00:34:57,090
index so this means I don't have to
1359
00:34:57,090 --> 00:34:59,240
index so this means I don't have to
think too hard when I want to peek ahead
1360
00:34:59,240 --> 00:34:59,250
think too hard when I want to peek ahead
1361
00:34:59,250 --> 00:35:02,210
think too hard when I want to peek ahead
if you will and then we can say we have
1362
00:35:02,210 --> 00:35:02,220
if you will and then we can say we have
1363
00:35:02,220 --> 00:35:07,670
if you will and then we can say we have
a private syntax token current which
1364
00:35:07,670 --> 00:35:07,680
a private syntax token current which
1365
00:35:07,680 --> 00:35:11,570
a private syntax token current which
basically just is peek 0 basically give
1366
00:35:11,570 --> 00:35:11,580
basically just is peek 0 basically give
1367
00:35:11,580 --> 00:35:15,620
basically just is peek 0 basically give
me the give me what's at position and
1368
00:35:15,620 --> 00:35:15,630
me the give me what's at position and
1369
00:35:15,630 --> 00:35:18,260
me the give me what's at position and
everything else is just slightly ahead
1370
00:35:18,260 --> 00:35:18,270
everything else is just slightly ahead
1371
00:35:18,270 --> 00:35:19,880
everything else is just slightly ahead
of that so this is the nice thing and
1372
00:35:19,880 --> 00:35:19,890
of that so this is the nice thing and
1373
00:35:19,890 --> 00:35:21,680
of that so this is the nice thing and
you legs everything at once because it
1374
00:35:21,680 --> 00:35:21,690
you legs everything at once because it
1375
00:35:21,690 --> 00:35:23,750
you legs everything at once because it
means you can look ahead at the next
1376
00:35:23,750 --> 00:35:23,760
means you can look ahead at the next
1377
00:35:23,760 --> 00:35:24,670
means you can look ahead at the next
token to make this
1378
00:35:24,670 --> 00:35:24,680
token to make this
1379
00:35:24,680 --> 00:35:28,210
token to make this
how you want to parse it the entire
1380
00:35:28,210 --> 00:35:28,220
how you want to parse it the entire
1381
00:35:28,220 --> 00:35:30,430
how you want to parse it the entire
input file which tends to work pretty
1382
00:35:30,430 --> 00:35:30,440
input file which tends to work pretty
1383
00:35:30,440 --> 00:35:35,260
input file which tends to work pretty
well all right now so we have a class
1384
00:35:35,260 --> 00:35:35,270
well all right now so we have a class
1385
00:35:35,270 --> 00:35:39,849
well all right now so we have a class
syntax token yep what we also need is a
1386
00:35:39,849 --> 00:35:39,859
syntax token yep what we also need is a
1387
00:35:39,859 --> 00:35:43,089
syntax token yep what we also need is a
syntax note right so let's do this so
1388
00:35:43,089 --> 00:35:43,099
syntax note right so let's do this so
1389
00:35:43,099 --> 00:35:46,859
syntax note right so let's do this so
let's say we have a class syntax note
1390
00:35:46,859 --> 00:35:46,869
let's say we have a class syntax note
1391
00:35:46,869 --> 00:35:52,890
let's say we have a class syntax note
syntax note and again this guy needs and
1392
00:35:52,890 --> 00:35:52,900
syntax note and again this guy needs and
1393
00:35:52,900 --> 00:35:58,839
syntax note and again this guy needs and
public abstract syntax kind kind you
1394
00:35:58,839 --> 00:35:58,849
public abstract syntax kind kind you
1395
00:35:58,849 --> 00:36:01,720
public abstract syntax kind kind you
will need this later to decide what kind
1396
00:36:01,720 --> 00:36:01,730
will need this later to decide what kind
1397
00:36:01,730 --> 00:36:03,609
will need this later to decide what kind
is this this guy will be abstract
1398
00:36:03,609 --> 00:36:03,619
is this this guy will be abstract
1399
00:36:03,619 --> 00:36:06,370
is this this guy will be abstract
because it's basically just the base
1400
00:36:06,370 --> 00:36:06,380
because it's basically just the base
1401
00:36:06,380 --> 00:36:11,470
because it's basically just the base
type for all my syntax notes and all
1402
00:36:11,470 --> 00:36:11,480
type for all my syntax notes and all
1403
00:36:11,480 --> 00:36:12,309
type for all my syntax notes and all
let's think about how you want to
1404
00:36:12,309 --> 00:36:12,319
let's think about how you want to
1405
00:36:12,319 --> 00:36:14,049
let's think about how you want to
represent the input so this is some of
1406
00:36:14,049 --> 00:36:14,059
represent the input so this is some of
1407
00:36:14,059 --> 00:36:15,760
represent the input so this is some of
these areas where maybe a picture would
1408
00:36:15,760 --> 00:36:15,770
these areas where maybe a picture would
1409
00:36:15,770 --> 00:36:18,250
these areas where maybe a picture would
be more useful so if you have an
1410
00:36:18,250 --> 00:36:18,260
be more useful so if you have an
1411
00:36:18,260 --> 00:36:21,789
be more useful so if you have an
expression like this right if you say 1
1412
00:36:21,789 --> 00:36:21,799
expression like this right if you say 1
1413
00:36:21,799 --> 00:36:26,950
expression like this right if you say 1
plus 2 times 3 what you really want is a
1414
00:36:26,950 --> 00:36:26,960
plus 2 times 3 what you really want is a
1415
00:36:26,960 --> 00:36:29,230
plus 2 times 3 what you really want is a
tree representation which roughly looks
1416
00:36:29,230 --> 00:36:29,240
tree representation which roughly looks
1417
00:36:29,240 --> 00:36:31,539
tree representation which roughly looks
like this so you have one here you have
1418
00:36:31,539 --> 00:36:31,549
like this so you have one here you have
1419
00:36:31,549 --> 00:36:35,890
like this so you have one here you have
the plus here and then you based on
1420
00:36:35,890 --> 00:36:35,900
the plus here and then you based on
1421
00:36:35,900 --> 00:36:38,349
the plus here and then you based on
operator pressure precedences the tree
1422
00:36:38,349 --> 00:36:38,359
operator pressure precedences the tree
1423
00:36:38,359 --> 00:36:42,010
operator pressure precedences the tree
will look like this right so in other
1424
00:36:42,010 --> 00:36:42,020
will look like this right so in other
1425
00:36:42,020 --> 00:36:44,109
will look like this right so in other
words you do if you look at this from a
1426
00:36:44,109 --> 00:36:44,119
words you do if you look at this from a
1427
00:36:44,119 --> 00:36:46,510
words you do if you look at this from a
tree strong I'm actually really bad at
1428
00:36:46,510 --> 00:36:46,520
tree strong I'm actually really bad at
1429
00:36:46,520 --> 00:36:55,579
tree strong I'm actually really bad at
drawing trees yeah that's not horrible
1430
00:36:55,579 --> 00:36:55,589
1431
00:36:55,589 --> 00:36:59,059
1432
00:36:59,059 --> 00:36:59,069
and then this is two this is three so
1433
00:36:59,069 --> 00:37:00,380
and then this is two this is three so
what you see here is basically a tree
1434
00:37:00,380 --> 00:37:00,390
what you see here is basically a tree
1435
00:37:00,390 --> 00:37:04,309
what you see here is basically a tree
where the leaf node is effectively the
1436
00:37:04,309 --> 00:37:04,319
where the leaf node is effectively the
1437
00:37:04,319 --> 00:37:06,769
where the leaf node is effectively the
tokens in the input file and then you
1438
00:37:06,769 --> 00:37:06,779
tokens in the input file and then you
1439
00:37:06,779 --> 00:37:09,349
tokens in the input file and then you
have a binary operator plus in this case
1440
00:37:09,349 --> 00:37:09,359
have a binary operator plus in this case
1441
00:37:09,359 --> 00:37:12,109
have a binary operator plus in this case
and then so if you want to evaluate this
1442
00:37:12,109 --> 00:37:12,119
and then so if you want to evaluate this
1443
00:37:12,119 --> 00:37:13,700
and then so if you want to evaluate this
thing you just basically say well plus
1444
00:37:13,700 --> 00:37:13,710
thing you just basically say well plus
1445
00:37:13,710 --> 00:37:15,920
thing you just basically say well plus
will give me the left value one give me
1446
00:37:15,920 --> 00:37:15,930
will give me the left value one give me
1447
00:37:15,930 --> 00:37:17,420
will give me the left value one give me
the right value okay that's another
1448
00:37:17,420 --> 00:37:17,430
the right value okay that's another
1449
00:37:17,430 --> 00:37:20,989
the right value okay that's another
expression 2 times 3 and then you add
1450
00:37:20,989 --> 00:37:20,999
expression 2 times 3 and then you add
1451
00:37:20,999 --> 00:37:23,569
expression 2 times 3 and then you add
the result right so basically in our
1452
00:37:23,569 --> 00:37:23,579
the result right so basically in our
1453
00:37:23,579 --> 00:37:25,759
the result right so basically in our
case this would be a node probably
1454
00:37:25,759 --> 00:37:25,769
case this would be a node probably
1455
00:37:25,769 --> 00:37:27,589
case this would be a node probably
number a number node this would be a
1456
00:37:27,589 --> 00:37:27,599
number a number node this would be a
1457
00:37:27,599 --> 00:37:29,299
number a number node this would be a
binary operator a node because it has
1458
00:37:29,299 --> 00:37:29,309
binary operator a node because it has
1459
00:37:29,309 --> 00:37:32,509
binary operator a node because it has
two inputs and everything else is just
1460
00:37:32,509 --> 00:37:32,519
two inputs and everything else is just
1461
00:37:32,519 --> 00:37:34,599
two inputs and everything else is just
chained together right so if you do
1462
00:37:34,599 --> 00:37:34,609
chained together right so if you do
1463
00:37:34,609 --> 00:37:37,670
chained together right so if you do
stuff like this it will look even
1464
00:37:37,670 --> 00:37:37,680
stuff like this it will look even
1465
00:37:37,680 --> 00:37:40,249
stuff like this it will look even
simpler it would look like this right
1466
00:37:40,249 --> 00:37:40,259
simpler it would look like this right
1467
00:37:40,259 --> 00:37:52,880
simpler it would look like this right
you would have to
1468
00:37:52,880 --> 00:37:52,890
1469
00:37:52,890 --> 00:37:55,039
1470
00:37:55,039 --> 00:37:55,049
I'd so like this is what would happen if
1471
00:37:55,049 --> 00:37:56,569
I'd so like this is what would happen if
you just parse this input here so this
1472
00:37:56,569 --> 00:37:56,579
you just parse this input here so this
1473
00:37:56,579 --> 00:37:57,950
you just parse this input here so this
is the kind of tree you want to produce
1474
00:37:57,950 --> 00:37:57,960
is the kind of tree you want to produce
1475
00:37:57,960 --> 00:38:01,759
is the kind of tree you want to produce
it will show later how this wool how
1476
00:38:01,759 --> 00:38:01,769
it will show later how this wool how
1477
00:38:01,769 --> 00:38:03,289
it will show later how this wool how
this will work so for now we need
1478
00:38:03,289 --> 00:38:03,299
this will work so for now we need
1479
00:38:03,299 --> 00:38:06,349
this will work so for now we need
basically a number a number node which
1480
00:38:06,349 --> 00:38:06,359
basically a number a number node which
1481
00:38:06,359 --> 00:38:08,690
basically a number a number node which
represents our leaves and then our
1482
00:38:08,690 --> 00:38:08,700
represents our leaves and then our
1483
00:38:08,700 --> 00:38:12,940
represents our leaves and then our
binary operators which are our interior
1484
00:38:12,940 --> 00:38:12,950
1485
00:38:12,950 --> 00:38:19,029
1486
00:38:19,029 --> 00:38:19,039
nodes for that so let's start with the
1487
00:38:19,039 --> 00:38:24,079
nodes for that so let's start with the
fact that given that we will have
1488
00:38:24,079 --> 00:38:24,089
fact that given that we will have
1489
00:38:24,089 --> 00:38:25,670
fact that given that we will have
expressions and statements later let's
1490
00:38:25,670 --> 00:38:25,680
expressions and statements later let's
1491
00:38:25,680 --> 00:38:27,079
expressions and statements later let's
just start with an of an expression
1492
00:38:27,079 --> 00:38:27,089
just start with an of an expression
1493
00:38:27,089 --> 00:38:31,970
just start with an of an expression
syntax which will for now just derive
1494
00:38:31,970 --> 00:38:31,980
syntax which will for now just derive
1495
00:38:31,980 --> 00:38:33,650
syntax which will for now just derive
from syntax node and does nothing
1496
00:38:33,650 --> 00:38:33,660
from syntax node and does nothing
1497
00:38:33,660 --> 00:38:38,690
from syntax node and does nothing
special but it does simplify our design
1498
00:38:38,690 --> 00:38:38,700
special but it does simplify our design
1499
00:38:38,700 --> 00:38:42,130
special but it does simplify our design
a little bit I think and then we have
1500
00:38:42,130 --> 00:38:42,140
a little bit I think and then we have
1501
00:38:42,140 --> 00:38:44,839
a little bit I think and then we have
actual instances so let's say we have
1502
00:38:44,839 --> 00:38:44,849
actual instances so let's say we have
1503
00:38:44,849 --> 00:38:48,620
actual instances so let's say we have
the number syntax which is of type
1504
00:38:48,620 --> 00:38:48,630
the number syntax which is of type
1505
00:38:48,630 --> 00:38:51,710
the number syntax which is of type
expression syntax and now we can say
1506
00:38:51,710 --> 00:38:51,720
expression syntax and now we can say
1507
00:38:51,720 --> 00:38:55,279
expression syntax and now we can say
let's have a constructor it's called as
1508
00:38:55,279 --> 00:38:55,289
let's have a constructor it's called as
1509
00:38:55,289 --> 00:38:58,489
let's have a constructor it's called as
number syntax so what does this guy need
1510
00:38:58,489 --> 00:38:58,499
number syntax so what does this guy need
1511
00:38:58,499 --> 00:39:00,529
number syntax so what does this guy need
well it only needs the syntax token
1512
00:39:00,529 --> 00:39:00,539
well it only needs the syntax token
1513
00:39:00,539 --> 00:39:02,599
well it only needs the syntax token
which represents the number so that's
1514
00:39:02,599 --> 00:39:02,609
which represents the number so that's
1515
00:39:02,609 --> 00:39:06,279
which represents the number so that's
the number token that be there we got
1516
00:39:06,279 --> 00:39:06,289
the number token that be there we got
1517
00:39:06,289 --> 00:39:08,359
the number token that be there we got
all right now let's implement the
1518
00:39:08,359 --> 00:39:08,369
all right now let's implement the
1519
00:39:08,369 --> 00:39:10,220
all right now let's implement the
abstract class in our case we say this
1520
00:39:10,220 --> 00:39:10,230
abstract class in our case we say this
1521
00:39:10,230 --> 00:39:15,519
abstract class in our case we say this
would be syntax kind number expression
1522
00:39:15,519 --> 00:39:15,529
would be syntax kind number expression
1523
00:39:15,529 --> 00:39:17,930
would be syntax kind number expression
again this doesn't exist right now so we
1524
00:39:17,930 --> 00:39:17,940
again this doesn't exist right now so we
1525
00:39:17,940 --> 00:39:21,430
again this doesn't exist right now so we
edit and then we just store this guy as
1526
00:39:21,430 --> 00:39:21,440
edit and then we just store this guy as
1527
00:39:21,440 --> 00:39:25,130
edit and then we just store this guy as
monitors the fields let's make this a
1528
00:39:25,130 --> 00:39:25,140
monitors the fields let's make this a
1529
00:39:25,140 --> 00:39:27,620
monitors the fields let's make this a
property
1530
00:39:27,620 --> 00:39:27,630
property
1531
00:39:27,630 --> 00:39:30,150
property
[Music]
1532
00:39:30,150 --> 00:39:30,160
[Music]
1533
00:39:30,160 --> 00:39:34,830
[Music]
okay now let's do a sealed class binary
1534
00:39:34,830 --> 00:39:34,840
okay now let's do a sealed class binary
1535
00:39:34,840 --> 00:39:39,310
okay now let's do a sealed class binary
expression syntax in fact let's call
1536
00:39:39,310 --> 00:39:39,320
expression syntax in fact let's call
1537
00:39:39,320 --> 00:39:42,520
expression syntax in fact let's call
this number expression syntax just for
1538
00:39:42,520 --> 00:39:42,530
this number expression syntax just for
1539
00:39:42,530 --> 00:39:46,060
this number expression syntax just for
consistency reasons and then let's fix
1540
00:39:46,060 --> 00:39:46,070
consistency reasons and then let's fix
1541
00:39:46,070 --> 00:39:50,080
consistency reasons and then let's fix
the typo we have what did I say
1542
00:39:50,080 --> 00:39:50,090
the typo we have what did I say
1543
00:39:50,090 --> 00:39:52,900
the typo we have what did I say
expression syntax right so what would
1544
00:39:52,900 --> 00:39:52,910
expression syntax right so what would
1545
00:39:52,910 --> 00:39:58,510
expression syntax right so what would
this guy need well it would get the left
1546
00:39:58,510 --> 00:39:58,520
this guy need well it would get the left
1547
00:39:58,520 --> 00:39:59,680
this guy need well it would get the left
expression right so we have an
1548
00:39:59,680 --> 00:39:59,690
expression right so we have an
1549
00:39:59,690 --> 00:40:01,720
expression right so we have an
expression syntax that represents the
1550
00:40:01,720 --> 00:40:01,730
expression syntax that represents the
1551
00:40:01,730 --> 00:40:07,090
expression syntax that represents the
left side we have a syntax token that
1552
00:40:07,090 --> 00:40:07,100
left side we have a syntax token that
1553
00:40:07,100 --> 00:40:11,080
left side we have a syntax token that
represents the OP rate or token and then
1554
00:40:11,080 --> 00:40:11,090
represents the OP rate or token and then
1555
00:40:11,090 --> 00:40:15,820
represents the OP rate or token and then
we have an expression syntax right and
1556
00:40:15,820 --> 00:40:15,830
we have an expression syntax right and
1557
00:40:15,830 --> 00:40:20,940
we have an expression syntax right and
again I suck at typing let me fix this
1558
00:40:20,940 --> 00:40:20,950
again I suck at typing let me fix this
1559
00:40:20,950 --> 00:40:24,120
again I suck at typing let me fix this
so let's store these guys property
1560
00:40:24,120 --> 00:40:24,130
so let's store these guys property
1561
00:40:24,130 --> 00:40:30,220
so let's store these guys property
property and property oh yeah property
1562
00:40:30,220 --> 00:40:30,230
property and property oh yeah property
1563
00:40:30,230 --> 00:40:33,730
property and property oh yeah property
explosion alright let's do this as well
1564
00:40:33,730 --> 00:40:33,740
explosion alright let's do this as well
1565
00:40:33,740 --> 00:40:37,270
explosion alright let's do this as well
and let's say this is syntax kind binary
1566
00:40:37,270 --> 00:40:37,280
and let's say this is syntax kind binary
1567
00:40:37,280 --> 00:40:40,810
and let's say this is syntax kind binary
expression so the only reason we have
1568
00:40:40,810 --> 00:40:40,820
expression so the only reason we have
1569
00:40:40,820 --> 00:40:43,030
expression so the only reason we have
these kinds by the way is just so that
1570
00:40:43,030 --> 00:40:43,040
these kinds by the way is just so that
1571
00:40:43,040 --> 00:40:46,290
these kinds by the way is just so that
we can just switch over them which is
1572
00:40:46,290 --> 00:40:46,300
we can just switch over them which is
1573
00:40:46,300 --> 00:40:48,340
we can just switch over them which is
slightly more efficient than doing an
1574
00:40:48,340 --> 00:40:48,350
slightly more efficient than doing an
1575
00:40:48,350 --> 00:40:49,870
slightly more efficient than doing an
ask us all the time
1576
00:40:49,870 --> 00:40:49,880
ask us all the time
1577
00:40:49,880 --> 00:40:51,730
ask us all the time
and have to check for the actual
1578
00:40:51,730 --> 00:40:51,740
and have to check for the actual
1579
00:40:51,740 --> 00:40:55,990
and have to check for the actual
instance it's basically if you do
1580
00:40:55,990 --> 00:40:56,000
instance it's basically if you do
1581
00:40:56,000 --> 00:40:56,530
instance it's basically if you do
f-sharp
1582
00:40:56,530 --> 00:40:56,540
f-sharp
1583
00:40:56,540 --> 00:40:58,600
f-sharp
you probably think less of me right now
1584
00:40:58,600 --> 00:40:58,610
you probably think less of me right now
1585
00:40:58,610 --> 00:40:59,710
you probably think less of me right now
because it's much easier an f-sharp
1586
00:40:59,710 --> 00:40:59,720
because it's much easier an f-sharp
1587
00:40:59,720 --> 00:41:02,770
because it's much easier an f-sharp
because they have Union types and
1588
00:41:02,770 --> 00:41:02,780
because they have Union types and
1589
00:41:02,780 --> 00:41:05,500
because they have Union types and
c-sharp you have to do this by hand all
1590
00:41:05,500 --> 00:41:05,510
c-sharp you have to do this by hand all
1591
00:41:05,510 --> 00:41:07,630
c-sharp you have to do this by hand all
right so we have left right so that
1592
00:41:07,630 --> 00:41:07,640
right so we have left right so that
1593
00:41:07,640 --> 00:41:09,100
right so we have left right so that
seems like we have our data structures
1594
00:41:09,100 --> 00:41:09,110
seems like we have our data structures
1595
00:41:09,110 --> 00:41:15,550
seems like we have our data structures
at least somewhat in order for now and
1596
00:41:15,550 --> 00:41:15,560
at least somewhat in order for now and
1597
00:41:15,560 --> 00:41:16,810
at least somewhat in order for now and
all the part everybody has waited for
1598
00:41:16,810 --> 00:41:16,820
all the part everybody has waited for
1599
00:41:16,820 --> 00:41:19,810
all the part everybody has waited for
and how do you parse this stuff so let's
1600
00:41:19,810 --> 00:41:19,820
and how do you parse this stuff so let's
1601
00:41:19,820 --> 00:41:21,700
and how do you parse this stuff so let's
start with a public method public and
1602
00:41:21,700 --> 00:41:21,710
start with a public method public and
1603
00:41:21,710 --> 00:41:24,460
start with a public method public and
say we call this expression but it's
1604
00:41:24,460 --> 00:41:24,470
say we call this expression but it's
1605
00:41:24,470 --> 00:41:29,110
say we call this expression but it's
called this parse so how do we do this
1606
00:41:29,110 --> 00:41:29,120
called this parse so how do we do this
1607
00:41:29,120 --> 00:41:32,470
called this parse so how do we do this
so logically let's first think about how
1608
00:41:32,470 --> 00:41:32,480
so logically let's first think about how
1609
00:41:32,480 --> 00:41:34,540
so logically let's first think about how
the tree structures work right so at the
1610
00:41:34,540 --> 00:41:34,550
the tree structures work right so at the
1611
00:41:34,550 --> 00:41:36,460
the tree structures work right so at the
very bottom we have numbers so the first
1612
00:41:36,460 --> 00:41:36,470
very bottom we have numbers so the first
1613
00:41:36,470 --> 00:41:39,530
very bottom we have numbers so the first
thing you want to parse logically is
1614
00:41:39,530 --> 00:41:39,540
thing you want to parse logically is
1615
00:41:39,540 --> 00:41:42,500
thing you want to parse logically is
the leaves and then you build the other
1616
00:41:42,500 --> 00:41:42,510
the leaves and then you build the other
1617
00:41:42,510 --> 00:41:44,410
the leaves and then you build the other
structures on top of that and then you
1618
00:41:44,410 --> 00:41:44,420
structures on top of that and then you
1619
00:41:44,420 --> 00:41:46,760
structures on top of that and then you
know think of the method structure
1620
00:41:46,760 --> 00:41:46,770
know think of the method structure
1621
00:41:46,770 --> 00:41:48,140
know think of the method structure
basically as mirroring the source
1622
00:41:48,140 --> 00:41:48,150
basically as mirroring the source
1623
00:41:48,150 --> 00:41:52,790
basically as mirroring the source
structure at the tree structure so what
1624
00:41:52,790 --> 00:41:52,800
structure at the tree structure so what
1625
00:41:52,800 --> 00:41:54,320
structure at the tree structure so what
do I mean by this okay let's say that
1626
00:41:54,320 --> 00:41:54,330
do I mean by this okay let's say that
1627
00:41:54,330 --> 00:41:59,000
do I mean by this okay let's say that
started with the with the with the idea
1628
00:41:59,000 --> 00:41:59,010
started with the with the with the idea
1629
00:41:59,010 --> 00:42:00,890
started with the with the with the idea
that first you parse a primary
1630
00:42:00,890 --> 00:42:00,900
that first you parse a primary
1631
00:42:00,900 --> 00:42:01,990
that first you parse a primary
expression
1632
00:42:01,990 --> 00:42:02,000
expression
1633
00:42:02,000 --> 00:42:04,099
expression
maybe T's ever just write it out the
1634
00:42:04,099 --> 00:42:04,109
maybe T's ever just write it out the
1635
00:42:04,109 --> 00:42:13,250
maybe T's ever just write it out the
primary expression then we can say while
1636
00:42:13,250 --> 00:42:13,260
primary expression then we can say while
1637
00:42:13,260 --> 00:42:17,720
primary expression then we can say while
the current is syntax kind let's call
1638
00:42:17,720 --> 00:42:17,730
the current is syntax kind let's call
1639
00:42:17,730 --> 00:42:25,170
the current is syntax kind let's call
this plus token
1640
00:42:25,170 --> 00:42:25,180
1641
00:42:25,180 --> 00:42:32,730
1642
00:42:32,730 --> 00:42:32,740
1643
00:42:32,740 --> 00:42:34,530
1644
00:42:34,530 --> 00:42:34,540
oh yeah there's one method that we
1645
00:42:34,540 --> 00:42:36,349
oh yeah there's one method that we
really want a half which is private
1646
00:42:36,349 --> 00:42:36,359
really want a half which is private
1647
00:42:36,359 --> 00:42:43,020
really want a half which is private
syntax token next token which basically
1648
00:42:43,020 --> 00:42:43,030
syntax token next token which basically
1649
00:42:43,030 --> 00:42:46,770
syntax token next token which basically
says if our current is current and then
1650
00:42:46,770 --> 00:42:46,780
says if our current is current and then
1651
00:42:46,780 --> 00:42:50,609
says if our current is current and then
you say position plus plus and then you
1652
00:42:50,609 --> 00:42:50,619
you say position plus plus and then you
1653
00:42:50,619 --> 00:42:55,200
you say position plus plus and then you
return current so then we can save our
1654
00:42:55,200 --> 00:42:55,210
return current so then we can save our
1655
00:42:55,210 --> 00:43:01,609
return current so then we can save our
operator token equals next token and
1656
00:43:01,609 --> 00:43:01,619
operator token equals next token and
1657
00:43:01,619 --> 00:43:09,900
operator token equals next token and
then we can save our let's call this
1658
00:43:09,900 --> 00:43:09,910
then we can save our let's call this
1659
00:43:09,910 --> 00:43:18,540
then we can save our let's call this
right parse time ring let's call this
1660
00:43:18,540 --> 00:43:18,550
right parse time ring let's call this
1661
00:43:18,550 --> 00:43:23,130
right parse time ring let's call this
parse for now actually is there any way
1662
00:43:23,130 --> 00:43:23,140
parse for now actually is there any way
1663
00:43:23,140 --> 00:43:26,690
parse for now actually is there any way
to do the snow cross for me nevermind
1664
00:43:26,690 --> 00:43:26,700
to do the snow cross for me nevermind
1665
00:43:26,700 --> 00:43:31,410
to do the snow cross for me nevermind
that's primary expression
1666
00:43:31,410 --> 00:43:31,420
1667
00:43:31,420 --> 00:43:36,460
1668
00:43:36,460 --> 00:43:36,470
and then we can say primary is no new
1669
00:43:36,470 --> 00:43:39,250
and then we can say primary is no new
binary operator expression on binary
1670
00:43:39,250 --> 00:43:39,260
binary operator expression on binary
1671
00:43:39,260 --> 00:43:45,310
binary operator expression on binary
expression I guess we've let's call this
1672
00:43:45,310 --> 00:43:45,320
expression I guess we've let's call this
1673
00:43:45,320 --> 00:43:48,880
expression I guess we've let's call this
left left
1674
00:43:48,880 --> 00:43:48,890
left left
1675
00:43:48,890 --> 00:43:52,840
left left
operator token right and then we say
1676
00:43:52,840 --> 00:43:52,850
operator token right and then we say
1677
00:43:52,850 --> 00:43:55,690
operator token right and then we say
return left
1678
00:43:55,690 --> 00:43:55,700
1679
00:43:55,700 --> 00:44:02,770
1680
00:44:02,770 --> 00:44:02,780
yes and this needs to be kind and then
1681
00:44:02,780 --> 00:44:05,290
yes and this needs to be kind and then
primary expression in our kids right now
1682
00:44:05,290 --> 00:44:05,300
primary expression in our kids right now
1683
00:44:05,300 --> 00:44:07,600
primary expression in our kids right now
is literally just we expected in number
1684
00:44:07,600 --> 00:44:07,610
is literally just we expected in number
1685
00:44:07,610 --> 00:44:12,010
is literally just we expected in number
so let's do this for now and let's add
1686
00:44:12,010 --> 00:44:12,020
so let's do this for now and let's add
1687
00:44:12,020 --> 00:44:18,360
so let's do this for now and let's add
another method called match subjects
1688
00:44:18,360 --> 00:44:18,370
another method called match subjects
1689
00:44:18,370 --> 00:44:24,390
another method called match subjects
some kind kind so the idea is now if
1690
00:44:24,390 --> 00:44:24,400
some kind kind so the idea is now if
1691
00:44:24,400 --> 00:44:31,770
some kind kind so the idea is now if
current kind is kind then return next
1692
00:44:31,770 --> 00:44:31,780
current kind is kind then return next
1693
00:44:31,780 --> 00:44:33,200
current kind is kind then return next
token
1694
00:44:33,200 --> 00:44:33,210
token
1695
00:44:33,210 --> 00:44:36,100
token
[Music]
1696
00:44:36,100 --> 00:44:36,110
[Music]
1697
00:44:36,110 --> 00:44:39,760
[Music]
otherwise let's fabricate one so I will
1698
00:44:39,760 --> 00:44:39,770
otherwise let's fabricate one so I will
1699
00:44:39,770 --> 00:44:40,900
otherwise let's fabricate one so I will
explain later whether this is super
1700
00:44:40,900 --> 00:44:40,910
explain later whether this is super
1701
00:44:40,910 --> 00:44:42,390
explain later whether this is super
useful in the parser I mean you
1702
00:44:42,390 --> 00:44:42,400
useful in the parser I mean you
1703
00:44:42,400 --> 00:44:46,270
useful in the parser I mean you
basically create tokens but let's now
1704
00:44:46,270 --> 00:44:46,280
basically create tokens but let's now
1705
00:44:46,280 --> 00:44:49,900
basically create tokens but let's now
say we manufacture syntax Koken of the
1706
00:44:49,900 --> 00:44:49,910
say we manufacture syntax Koken of the
1707
00:44:49,910 --> 00:44:55,860
say we manufacture syntax Koken of the
kind that was asked at current position
1708
00:44:55,860 --> 00:44:55,870
kind that was asked at current position
1709
00:44:55,870 --> 00:44:59,260
kind that was asked at current position
it has no text because it's manufactured
1710
00:44:59,260 --> 00:44:59,270
it has no text because it's manufactured
1711
00:44:59,270 --> 00:45:04,560
it has no text because it's manufactured
and it has no value
1712
00:45:04,560 --> 00:45:04,570
1713
00:45:04,570 --> 00:45:08,170
1714
00:45:08,170 --> 00:45:08,180
all right what's going on here why does
1715
00:45:08,180 --> 00:45:12,340
all right what's going on here why does
that not work oh because type expression
1716
00:45:12,340 --> 00:45:12,350
that not work oh because type expression
1717
00:45:12,350 --> 00:45:17,620
that not work oh because type expression
syntax here we go so we say var number
1718
00:45:17,620 --> 00:45:17,630
syntax here we go so we say var number
1719
00:45:17,630 --> 00:45:23,740
syntax here we go so we say var number
token equals match syntax kind number
1720
00:45:23,740 --> 00:45:23,750
token equals match syntax kind number
1721
00:45:23,750 --> 00:45:28,510
token equals match syntax kind number
token and let me say return new number
1722
00:45:28,510 --> 00:45:28,520
token and let me say return new number
1723
00:45:28,520 --> 00:45:35,920
token and let me say return new number
expression for the number tokens all
1724
00:45:35,920 --> 00:45:35,930
expression for the number tokens all
1725
00:45:35,930 --> 00:45:39,940
expression for the number tokens all
right this should be happening here come
1726
00:45:39,940 --> 00:45:39,950
right this should be happening here come
1727
00:45:39,950 --> 00:45:43,680
right this should be happening here come
over from syntax token to syntax note
1728
00:45:43,680 --> 00:45:43,690
over from syntax token to syntax note
1729
00:45:43,690 --> 00:45:45,640
over from syntax token to syntax note
interesting did I mess it up
1730
00:45:45,640 --> 00:45:45,650
interesting did I mess it up
1731
00:45:45,650 --> 00:45:47,950
interesting did I mess it up
yep and didn't mess it up that is it
1732
00:45:47,950 --> 00:45:47,960
yep and didn't mess it up that is it
1733
00:45:47,960 --> 00:45:56,200
yep and didn't mess it up that is it
token not not a note all right so so far
1734
00:45:56,200 --> 00:45:56,210
token not not a note all right so so far
1735
00:45:56,210 --> 00:45:57,040
token not not a note all right so so far
so good
1736
00:45:57,040 --> 00:45:57,050
so good
1737
00:45:57,050 --> 00:45:59,920
so good
now the very first thing you will
1738
00:45:59,920 --> 00:45:59,930
now the very first thing you will
1739
00:45:59,930 --> 00:46:02,260
now the very first thing you will
probably find when you are parsing is
1740
00:46:02,260 --> 00:46:02,270
probably find when you are parsing is
1741
00:46:02,270 --> 00:46:03,610
probably find when you are parsing is
you really want to see the parse tree
1742
00:46:03,610 --> 00:46:03,620
you really want to see the parse tree
1743
00:46:03,620 --> 00:46:05,860
you really want to see the parse tree
because if you messed that one up that
1744
00:46:05,860 --> 00:46:05,870
because if you messed that one up that
1745
00:46:05,870 --> 00:46:09,490
because if you messed that one up that
is usually very annoying so I suggest we
1746
00:46:09,490 --> 00:46:09,500
is usually very annoying so I suggest we
1747
00:46:09,500 --> 00:46:11,920
is usually very annoying so I suggest we
go to the subjects node and we add the
1748
00:46:11,920 --> 00:46:11,930
go to the subjects node and we add the
1749
00:46:11,930 --> 00:46:14,260
go to the subjects node and we add the
notion of children because once we have
1750
00:46:14,260 --> 00:46:14,270
notion of children because once we have
1751
00:46:14,270 --> 00:46:16,090
notion of children because once we have
that we can actually walk the tree in a
1752
00:46:16,090 --> 00:46:16,100
that we can actually walk the tree in a
1753
00:46:16,100 --> 00:46:18,310
that we can actually walk the tree in a
generic way so let's say we have an
1754
00:46:18,310 --> 00:46:18,320
generic way so let's say we have an
1755
00:46:18,320 --> 00:46:24,190
generic way so let's say we have an
ienumerable of syntax node and we call
1756
00:46:24,190 --> 00:46:24,200
ienumerable of syntax node and we call
1757
00:46:24,200 --> 00:46:28,660
ienumerable of syntax node and we call
this get children
1758
00:46:28,660 --> 00:46:28,670
1759
00:46:28,670 --> 00:46:36,160
1760
00:46:36,160 --> 00:46:36,170
and let's make this guy abstract what
1761
00:46:36,170 --> 00:46:38,230
and let's make this guy abstract what
helps right now again this is probably
1762
00:46:38,230 --> 00:46:38,240
helps right now again this is probably
1763
00:46:38,240 --> 00:46:39,789
helps right now again this is probably
not what the production compiler would
1764
00:46:39,789 --> 00:46:39,799
not what the production compiler would
1765
00:46:39,799 --> 00:46:41,380
not what the production compiler would
look like but for now let's just say
1766
00:46:41,380 --> 00:46:41,390
look like but for now let's just say
1767
00:46:41,390 --> 00:46:45,910
look like but for now let's just say
syntax tokens I just notes because if we
1768
00:46:45,910 --> 00:46:45,920
syntax tokens I just notes because if we
1769
00:46:45,920 --> 00:46:48,910
syntax tokens I just notes because if we
do that then we can basically pretend
1770
00:46:48,910 --> 00:46:48,920
do that then we can basically pretend
1771
00:46:48,920 --> 00:46:50,589
do that then we can basically pretend
that some text tokens are actually the
1772
00:46:50,589 --> 00:46:50,599
that some text tokens are actually the
1773
00:46:50,599 --> 00:46:57,640
that some text tokens are actually the
leaves in our in our tree so this means
1774
00:46:57,640 --> 00:46:57,650
leaves in our in our tree so this means
1775
00:46:57,650 --> 00:47:00,940
leaves in our in our tree so this means
this guy does nothing so we say return
1776
00:47:00,940 --> 00:47:00,950
this guy does nothing so we say return
1777
00:47:00,950 --> 00:47:07,299
this guy does nothing so we say return
in your mobile thought empty or syntax
1778
00:47:07,299 --> 00:47:07,309
in your mobile thought empty or syntax
1779
00:47:07,309 --> 00:47:12,230
in your mobile thought empty or syntax
note
1780
00:47:12,230 --> 00:47:12,240
1781
00:47:12,240 --> 00:47:16,310
1782
00:47:16,310 --> 00:47:16,320
yes I need that all right no we can say
1783
00:47:16,320 --> 00:47:23,079
yes I need that all right no we can say
our number expression syntax just
1784
00:47:23,079 --> 00:47:23,089
our number expression syntax just
1785
00:47:23,089 --> 00:47:31,280
our number expression syntax just
returns our number token Jesus I'm
1786
00:47:31,280 --> 00:47:31,290
returns our number token Jesus I'm
1787
00:47:31,290 --> 00:47:33,620
returns our number token Jesus I'm
really bad at typing today usually not
1788
00:47:33,620 --> 00:47:33,630
really bad at typing today usually not
1789
00:47:33,630 --> 00:47:36,490
really bad at typing today usually not
that bad
1790
00:47:36,490 --> 00:47:36,500
1791
00:47:36,500 --> 00:47:43,030
1792
00:47:43,030 --> 00:47:43,040
then a binary expression will first
1793
00:47:43,040 --> 00:47:47,260
then a binary expression will first
yield return our left
1794
00:47:47,260 --> 00:47:47,270
yield return our left
1795
00:47:47,270 --> 00:47:53,210
yield return our left
then I'll operate a token and then we
1796
00:47:53,210 --> 00:47:53,220
then I'll operate a token and then we
1797
00:47:53,220 --> 00:47:56,720
then I'll operate a token and then we
say we want to return our right so you
1798
00:47:56,720 --> 00:47:56,730
say we want to return our right so you
1799
00:47:56,730 --> 00:47:58,760
say we want to return our right so you
have never used yield it's a very
1800
00:47:58,760 --> 00:47:58,770
have never used yield it's a very
1801
00:47:58,770 --> 00:48:00,710
have never used yield it's a very
convenient way to write stateful
1802
00:48:00,710 --> 00:48:00,720
convenient way to write stateful
1803
00:48:00,720 --> 00:48:03,320
convenient way to write stateful
iterators where effectively this
1804
00:48:03,320 --> 00:48:03,330
iterators where effectively this
1805
00:48:03,330 --> 00:48:05,960
iterators where effectively this
produces an enumerable where the first
1806
00:48:05,960 --> 00:48:05,970
produces an enumerable where the first
1807
00:48:05,970 --> 00:48:07,790
produces an enumerable where the first
item is left I could also just literally
1808
00:48:07,790 --> 00:48:07,800
item is left I could also just literally
1809
00:48:07,800 --> 00:48:09,109
item is left I could also just literally
create an array here that would probably
1810
00:48:09,109 --> 00:48:09,119
create an array here that would probably
1811
00:48:09,119 --> 00:48:11,810
create an array here that would probably
work as well but I don't know I find
1812
00:48:11,810 --> 00:48:11,820
work as well but I don't know I find
1813
00:48:11,820 --> 00:48:12,920
work as well but I don't know I find
these a little bit easier because they
1814
00:48:12,920 --> 00:48:12,930
these a little bit easier because they
1815
00:48:12,930 --> 00:48:15,190
these a little bit easier because they
can shuffle them around and again
1816
00:48:15,190 --> 00:48:15,200
can shuffle them around and again
1817
00:48:15,200 --> 00:48:16,940
can shuffle them around and again
efficiency right now it's not all
1818
00:48:16,940 --> 00:48:16,950
efficiency right now it's not all
1819
00:48:16,950 --> 00:48:19,579
efficiency right now it's not all
primary goal all right now we can
1820
00:48:19,579 --> 00:48:19,589
primary goal all right now we can
1821
00:48:19,589 --> 00:48:25,240
primary goal all right now we can
traverse the tree so now let's actually
1822
00:48:25,240 --> 00:48:25,250
1823
00:48:25,250 --> 00:48:30,950
1824
00:48:30,950 --> 00:48:30,960
change our main method here let's add a
1825
00:48:30,960 --> 00:48:38,150
change our main method here let's add a
new method static void pretty print and
1826
00:48:38,150 --> 00:48:38,160
new method static void pretty print and
1827
00:48:38,160 --> 00:48:42,680
new method static void pretty print and
it takes let's say a syntax note note we
1828
00:48:42,680 --> 00:48:42,690
it takes let's say a syntax note note we
1829
00:48:42,690 --> 00:48:44,780
it takes let's say a syntax note note we
probably want the indent what we have
1830
00:48:44,780 --> 00:48:44,790
probably want the indent what we have
1831
00:48:44,790 --> 00:48:50,359
probably want the indent what we have
written so far actually if we want this
1832
00:48:50,359 --> 00:48:50,369
written so far actually if we want this
1833
00:48:50,369 --> 00:48:55,070
written so far actually if we want this
why everyone wants a indent and then
1834
00:48:55,070 --> 00:48:55,080
why everyone wants a indent and then
1835
00:48:55,080 --> 00:48:59,480
why everyone wants a indent and then
starts with an empty string and then we
1836
00:48:59,480 --> 00:48:59,490
starts with an empty string and then we
1837
00:48:59,490 --> 00:49:05,870
starts with an empty string and then we
can literally just say console dot right
1838
00:49:05,870 --> 00:49:05,880
can literally just say console dot right
1839
00:49:05,880 --> 00:49:12,170
can literally just say console dot right
let's say no dot kind
1840
00:49:12,170 --> 00:49:12,180
1841
00:49:12,180 --> 00:49:16,039
1842
00:49:16,039 --> 00:49:16,049
and let's say this if note is syntax
1843
00:49:16,049 --> 00:49:24,330
and let's say this if note is syntax
token T let's say console right
1844
00:49:24,330 --> 00:49:24,340
token T let's say console right
1845
00:49:24,340 --> 00:49:31,630
token T let's say console right
[Music]
1846
00:49:31,630 --> 00:49:31,640
1847
00:49:31,640 --> 00:49:34,019
1848
00:49:34,019 --> 00:49:34,029
now actually let's just do this and T
1849
00:49:34,029 --> 00:49:40,620
now actually let's just do this and T
values not know in which case we add the
1850
00:49:40,620 --> 00:49:40,630
values not know in which case we add the
1851
00:49:40,630 --> 00:49:46,319
values not know in which case we add the
token value here and then we just say
1852
00:49:46,319 --> 00:49:46,329
token value here and then we just say
1853
00:49:46,329 --> 00:49:52,630
token value here and then we just say
indent plus equals what do we want for
1854
00:49:52,630 --> 00:49:52,640
indent plus equals what do we want for
1855
00:49:52,640 --> 00:49:56,019
indent plus equals what do we want for
spaces 1 2 3 4 I guess that works and
1856
00:49:56,019 --> 00:49:56,029
spaces 1 2 3 4 I guess that works and
1857
00:49:56,029 --> 00:50:02,410
spaces 1 2 3 4 I guess that works and
then we can say for h-bar child in know
1858
00:50:02,410 --> 00:50:02,420
then we can say for h-bar child in know
1859
00:50:02,420 --> 00:50:08,729
then we can say for h-bar child in know
to get children we can say pretty print
1860
00:50:08,729 --> 00:50:08,739
to get children we can say pretty print
1861
00:50:08,739 --> 00:50:17,199
to get children we can say pretty print
the child with the end and I should do
1862
00:50:17,199 --> 00:50:17,209
the child with the end and I should do
1863
00:50:17,209 --> 00:50:20,199
the child with the end and I should do
it for now all right now let's go back
1864
00:50:20,199 --> 00:50:20,209
it for now all right now let's go back
1865
00:50:20,209 --> 00:50:22,900
it for now all right now let's go back
here so instead of doing this we save
1866
00:50:22,900 --> 00:50:22,910
here so instead of doing this we save
1867
00:50:22,910 --> 00:50:30,870
here so instead of doing this we save
our parse our new parser for the line
1868
00:50:30,870 --> 00:50:30,880
1869
00:50:30,880 --> 00:50:35,920
1870
00:50:35,920 --> 00:50:35,930
let me say expression equals parser dot
1871
00:50:35,930 --> 00:50:43,900
let me say expression equals parser dot
parse and then let me just say our color
1872
00:50:43,900 --> 00:50:43,910
parse and then let me just say our color
1873
00:50:43,910 --> 00:50:47,079
parse and then let me just say our color
equals console foreground let's say and
1874
00:50:47,079 --> 00:50:47,089
equals console foreground let's say and
1875
00:50:47,089 --> 00:50:51,390
equals console foreground let's say and
let me say console dot foreground
1876
00:50:51,390 --> 00:50:51,400
let me say console dot foreground
1877
00:50:51,400 --> 00:50:54,699
let me say console dot foreground
console what is the console color dark
1878
00:50:54,699 --> 00:50:54,709
console what is the console color dark
1879
00:50:54,709 --> 00:51:00,430
console what is the console color dark
grey I don't know I know why I did this
1880
00:51:00,430 --> 00:51:00,440
grey I don't know I know why I did this
1881
00:51:00,440 --> 00:51:03,670
grey I don't know I know why I did this
but it seems cool and then we can just
1882
00:51:03,670 --> 00:51:03,680
but it seems cool and then we can just
1883
00:51:03,680 --> 00:51:08,529
but it seems cool and then we can just
restore the color here I guess
1884
00:51:08,529 --> 00:51:08,539
1885
00:51:08,539 --> 00:51:12,049
1886
00:51:12,049 --> 00:51:12,059
little swap damn I didn't type
1887
00:51:12,059 --> 00:51:15,349
little swap damn I didn't type
everything here and there is just a
1888
00:51:15,349 --> 00:51:15,359
everything here and there is just a
1889
00:51:15,359 --> 00:51:19,689
everything here and there is just a
pretty print for our what is that
1890
00:51:19,689 --> 00:51:19,699
pretty print for our what is that
1891
00:51:19,699 --> 00:51:24,949
pretty print for our what is that
expression let me just let me just
1892
00:51:24,949 --> 00:51:24,959
expression let me just let me just
1893
00:51:24,959 --> 00:51:26,269
expression let me just let me just
create it
1894
00:51:26,269 --> 00:51:26,279
create it
1895
00:51:26,279 --> 00:51:35,720
create it
alright so we have that part
1896
00:51:35,720 --> 00:51:35,730
1897
00:51:35,730 --> 00:51:38,910
1898
00:51:38,910 --> 00:51:38,920
alright I'm inclined to run it now and
1899
00:51:38,920 --> 00:51:42,990
alright I'm inclined to run it now and
see how bad I did all right let's do one
1900
00:51:42,990 --> 00:51:43,000
see how bad I did all right let's do one
1901
00:51:43,000 --> 00:51:47,460
see how bad I did all right let's do one
plus two plus three for now oh yeah we
1902
00:51:47,460 --> 00:51:47,470
plus two plus three for now oh yeah we
1903
00:51:47,470 --> 00:51:50,600
plus two plus three for now oh yeah we
did really well I guess you forgot or
1904
00:51:50,600 --> 00:51:50,610
did really well I guess you forgot or
1905
00:51:50,610 --> 00:51:53,460
did really well I guess you forgot or
yes you should have done this console
1906
00:51:53,460 --> 00:51:53,470
yes you should have done this console
1907
00:51:53,470 --> 00:52:00,330
yes you should have done this console
dot write line I guess it makes it
1908
00:52:00,330 --> 00:52:00,340
dot write line I guess it makes it
1909
00:52:00,340 --> 00:52:10,560
dot write line I guess it makes it
slightly more
1910
00:52:10,560 --> 00:52:10,570
1911
00:52:10,570 --> 00:52:15,840
1912
00:52:15,840 --> 00:52:15,850
that is interesting oh yeah yeah console
1913
00:52:15,850 --> 00:52:19,470
that is interesting oh yeah yeah console
dot right indent it's cool when you
1914
00:52:19,470 --> 00:52:19,480
dot right indent it's cool when you
1915
00:52:19,480 --> 00:52:21,960
dot right indent it's cool when you
construct in and but you also need to
1916
00:52:21,960 --> 00:52:21,970
construct in and but you also need to
1917
00:52:21,970 --> 00:52:24,120
construct in and but you also need to
write it to the console otherwise it
1918
00:52:24,120 --> 00:52:24,130
write it to the console otherwise it
1919
00:52:24,130 --> 00:52:28,160
write it to the console otherwise it
doesn't do much one plus two plus three
1920
00:52:28,160 --> 00:52:28,170
doesn't do much one plus two plus three
1921
00:52:28,170 --> 00:52:33,200
doesn't do much one plus two plus three
there you go so the binary expression
1922
00:52:33,200 --> 00:52:33,210
there you go so the binary expression
1923
00:52:33,210 --> 00:52:35,520
there you go so the binary expression
that is a binary expression that has a
1924
00:52:35,520 --> 00:52:35,530
that is a binary expression that has a
1925
00:52:35,530 --> 00:52:37,230
that is a binary expression that has a
number expression with the number token
1926
00:52:37,230 --> 00:52:37,240
number expression with the number token
1927
00:52:37,240 --> 00:52:38,460
number expression with the number token
and a plus two Oakland and number
1928
00:52:38,460 --> 00:52:38,470
and a plus two Oakland and number
1929
00:52:38,470 --> 00:52:40,560
and a plus two Oakland and number
expression so that's effectively the
1930
00:52:40,560 --> 00:52:40,570
expression so that's effectively the
1931
00:52:40,570 --> 00:52:45,630
expression so that's effectively the
tree that I drew earlier I the only
1932
00:52:45,630 --> 00:52:45,640
tree that I drew earlier I the only
1933
00:52:45,640 --> 00:52:48,390
tree that I drew earlier I the only
thing that annoys me slightly is what
1934
00:52:48,390 --> 00:52:48,400
thing that annoys me slightly is what
1935
00:52:48,400 --> 00:52:56,910
thing that annoys me slightly is what
does that called tree it would be nicer
1936
00:52:56,910 --> 00:52:56,920
does that called tree it would be nicer
1937
00:52:56,920 --> 00:52:59,190
does that called tree it would be nicer
if you would get and I'll put that looks
1938
00:52:59,190 --> 00:52:59,200
if you would get and I'll put that looks
1939
00:52:59,200 --> 00:53:00,560
if you would get and I'll put that looks
more like this
1940
00:53:00,560 --> 00:53:00,570
more like this
1941
00:53:00,570 --> 00:53:07,180
more like this
so let's actually get these
1942
00:53:07,180 --> 00:53:07,190
1943
00:53:07,190 --> 00:53:08,950
1944
00:53:08,950 --> 00:53:08,960
because he'll be looking at those guys a
1945
00:53:08,960 --> 00:53:11,950
because he'll be looking at those guys a
lot so he might as well make it actually
1946
00:53:11,950 --> 00:53:11,960
lot so he might as well make it actually
1947
00:53:11,960 --> 00:53:18,130
lot so he might as well make it actually
pretty um so many desk guy and there's
1948
00:53:18,130 --> 00:53:18,140
pretty um so many desk guy and there's
1949
00:53:18,140 --> 00:53:20,860
pretty um so many desk guy and there's
one more right there's the the center
1950
00:53:20,860 --> 00:53:20,870
one more right there's the the center
1951
00:53:20,870 --> 00:53:27,430
one more right there's the the center
guy that we need yeah something like
1952
00:53:27,430 --> 00:53:27,440
guy that we need yeah something like
1953
00:53:27,440 --> 00:53:27,910
guy that we need yeah something like
that
1954
00:53:27,910 --> 00:53:27,920
that
1955
00:53:27,920 --> 00:53:29,260
that
no we have to think about how we
1956
00:53:29,260 --> 00:53:29,270
no we have to think about how we
1957
00:53:29,270 --> 00:53:36,280
no we have to think about how we
construct these guys how did that work
1958
00:53:36,280 --> 00:53:36,290
construct these guys how did that work
1959
00:53:36,290 --> 00:53:38,620
construct these guys how did that work
again I think I need something like is
1960
00:53:38,620 --> 00:53:38,630
again I think I need something like is
1961
00:53:38,630 --> 00:53:45,190
again I think I need something like is
last I think the default is false
1962
00:53:45,190 --> 00:53:45,200
last I think the default is false
1963
00:53:45,200 --> 00:53:47,910
last I think the default is false
[Music]
1964
00:53:47,910 --> 00:53:47,920
[Music]
1965
00:53:47,920 --> 00:53:56,480
[Music]
so
1966
00:53:56,480 --> 00:53:56,490
1967
00:53:56,490 --> 00:54:00,810
1968
00:54:00,810 --> 00:54:00,820
1969
00:54:00,820 --> 00:54:09,290
1970
00:54:09,290 --> 00:54:09,300
so how do we indent you basically say if
1971
00:54:09,300 --> 00:54:23,600
so how do we indent you basically say if
is lost then we say indent is Plus this
1972
00:54:23,600 --> 00:54:23,610
1973
00:54:23,610 --> 00:54:27,450
1974
00:54:27,450 --> 00:54:27,460
to do this right it is this and it's
1975
00:54:27,460 --> 00:54:34,430
to do this right it is this and it's
that otherwise if it is not the last one
1976
00:54:34,430 --> 00:54:34,440
1977
00:54:34,440 --> 00:54:53,890
1978
00:54:53,890 --> 00:54:53,900
1979
00:54:53,900 --> 00:54:57,580
1980
00:54:57,580 --> 00:54:57,590
and then how do we know something is to
1981
00:54:57,590 --> 00:55:02,520
and then how do we know something is to
laugh you save lost is no get children
1982
00:55:02,520 --> 00:55:02,530
laugh you save lost is no get children
1983
00:55:02,530 --> 00:55:05,320
laugh you save lost is no get children
thought lost that's just cheat here and
1984
00:55:05,320 --> 00:55:05,330
thought lost that's just cheat here and
1985
00:55:05,330 --> 00:55:11,200
thought lost that's just cheat here and
then we just say you are it's called
1986
00:55:11,200 --> 00:55:11,210
then we just say you are it's called
1987
00:55:11,210 --> 00:55:16,780
then we just say you are it's called
this last child lost child something
1988
00:55:16,780 --> 00:55:16,790
this last child lost child something
1989
00:55:16,790 --> 00:55:22,210
this last child lost child something
like that and then I think I only need
1990
00:55:22,210 --> 00:55:22,220
like that and then I think I only need
1991
00:55:22,220 --> 00:55:24,310
like that and then I think I only need
to
1992
00:55:24,310 --> 00:55:24,320
to
1993
00:55:24,320 --> 00:55:28,010
to
[Music]
1994
00:55:28,010 --> 00:55:28,020
1995
00:55:28,020 --> 00:55:30,580
1996
00:55:30,580 --> 00:55:30,590
and as this guy come from
1997
00:55:30,590 --> 00:55:43,530
and as this guy come from
that
1998
00:55:43,530 --> 00:55:43,540
1999
00:55:43,540 --> 00:55:46,440
2000
00:55:46,440 --> 00:55:46,450
mmm let me quickly ones I'm not entirely
2001
00:55:46,450 --> 00:55:53,790
mmm let me quickly ones I'm not entirely
sure I might have missed up the what
2002
00:55:53,790 --> 00:55:53,800
sure I might have missed up the what
2003
00:55:53,800 --> 00:56:14,550
sure I might have missed up the what
happened why did this disappear so fast
2004
00:56:14,550 --> 00:56:14,560
2005
00:56:14,560 --> 00:56:19,800
2006
00:56:19,800 --> 00:56:19,810
2007
00:56:19,810 --> 00:56:25,890
2008
00:56:25,890 --> 00:56:25,900
one plus two plus three and that seems
2009
00:56:25,900 --> 00:56:27,240
one plus two plus three and that seems
reasonable
2010
00:56:27,240 --> 00:56:27,250
reasonable
2011
00:56:27,250 --> 00:56:35,850
reasonable
oh we crashed that is true last are the
2012
00:56:35,850 --> 00:56:35,860
oh we crashed that is true last are the
2013
00:56:35,860 --> 00:56:40,530
oh we crashed that is true last are the
falls to the rescue alright so this
2014
00:56:40,530 --> 00:56:40,540
falls to the rescue alright so this
2015
00:56:40,540 --> 00:56:55,980
falls to the rescue alright so this
looks pretty ugly so I think
2016
00:56:55,980 --> 00:56:55,990
2017
00:56:55,990 --> 00:56:59,900
2018
00:56:59,900 --> 00:56:59,910
so what is happening here is I believe
2019
00:56:59,910 --> 00:57:13,920
so what is happening here is I believe
that it
2020
00:57:13,920 --> 00:57:13,930
2021
00:57:13,930 --> 00:57:16,770
2022
00:57:16,770 --> 00:57:16,780
I think we create the England too
2023
00:57:16,780 --> 00:57:25,080
I think we create the England too
quickly right so
2024
00:57:25,080 --> 00:57:25,090
2025
00:57:25,090 --> 00:57:30,510
2026
00:57:30,510 --> 00:57:30,520
2027
00:57:30,520 --> 00:57:34,950
2028
00:57:34,950 --> 00:57:34,960
I think it's like this right so let's
2029
00:57:34,960 --> 00:57:39,630
I think it's like this right so let's
call this bar marker so we need to write
2030
00:57:39,630 --> 00:57:39,640
call this bar marker so we need to write
2031
00:57:39,640 --> 00:57:47,940
call this bar marker so we need to write
the indent and then we say write our
2032
00:57:47,940 --> 00:57:47,950
the indent and then we say write our
2033
00:57:47,950 --> 00:57:54,740
the indent and then we say write our
marker something like that right and
2034
00:57:54,740 --> 00:57:54,750
marker something like that right and
2035
00:57:54,750 --> 00:58:10,130
marker something like that right and
then we say by the way this is indent
2036
00:58:10,130 --> 00:58:10,140
2037
00:58:10,140 --> 00:58:17,270
2038
00:58:17,270 --> 00:58:17,280
2039
00:58:17,280 --> 00:58:25,810
2040
00:58:25,810 --> 00:58:25,820
2041
00:58:25,820 --> 00:58:43,440
2042
00:58:43,440 --> 00:58:43,450
2043
00:58:43,450 --> 00:58:45,480
2044
00:58:45,480 --> 00:58:45,490
[Music]
2045
00:58:45,490 --> 00:58:48,670
[Music]
yep and it actually helps if you're--if
2046
00:58:48,670 --> 00:58:48,680
yep and it actually helps if you're--if
2047
00:58:48,680 --> 00:58:50,800
yep and it actually helps if you're--if
check is not screwed up of course he has
2048
00:58:50,800 --> 00:58:50,810
check is not screwed up of course he has
2049
00:58:50,810 --> 00:58:55,000
check is not screwed up of course he has
to change this guy no I think we have
2050
00:58:55,000 --> 00:58:55,010
to change this guy no I think we have
2051
00:58:55,010 --> 00:58:57,300
to change this guy no I think we have
something that is actually borderline
2052
00:58:57,300 --> 00:58:57,310
something that is actually borderline
2053
00:58:57,310 --> 00:59:04,030
something that is actually borderline
readable except it's not the the the why
2054
00:59:04,030 --> 00:59:04,040
readable except it's not the the the why
2055
00:59:04,040 --> 00:59:14,290
readable except it's not the the the why
is that again
2056
00:59:14,290 --> 00:59:14,300
2057
00:59:14,300 --> 00:59:23,540
2058
00:59:23,540 --> 00:59:23,550
2059
00:59:23,550 --> 00:59:27,350
2060
00:59:27,350 --> 00:59:27,360
I guess it's like this right it's it's
2061
00:59:27,360 --> 00:59:32,080
I guess it's like this right it's it's
lost then it is 1 2 3 4
2062
00:59:32,080 --> 00:59:32,090
2063
00:59:32,090 --> 00:59:39,320
2064
00:59:39,320 --> 00:59:39,330
2065
00:59:39,330 --> 00:59:40,880
2066
00:59:40,880 --> 00:59:40,890
man this is like trial and error
2067
00:59:40,890 --> 00:59:48,740
man this is like trial and error
programming right here close-ish except
2068
00:59:48,740 --> 00:59:48,750
programming right here close-ish except
2069
00:59:48,750 --> 00:59:53,120
programming right here close-ish except
for the first one yeah which I think the
2070
00:59:53,120 --> 00:59:53,130
for the first one yeah which I think the
2071
00:59:53,130 --> 00:59:54,950
for the first one yeah which I think the
default is messed up the default should
2072
00:59:54,950 --> 00:59:54,960
default is messed up the default should
2073
00:59:54,960 --> 01:00:00,140
default is messed up the default should
be true and then I think I have it man
2074
01:00:00,140 --> 01:00:00,150
be true and then I think I have it man
2075
01:00:00,150 --> 01:00:02,180
be true and then I think I have it man
pretty printing trees the hardest
2076
01:00:02,180 --> 01:00:02,190
pretty printing trees the hardest
2077
01:00:02,190 --> 01:00:02,960
pretty printing trees the hardest
problem of compiler construction
2078
01:00:02,960 --> 01:00:02,970
problem of compiler construction
2079
01:00:02,970 --> 01:00:07,460
problem of compiler construction
apparently alright so now we can
2080
01:00:07,460 --> 01:00:07,470
apparently alright so now we can
2081
01:00:07,470 --> 01:00:08,960
apparently alright so now we can
actually read this thing
2082
01:00:08,960 --> 01:00:08,970
actually read this thing
2083
01:00:08,970 --> 01:00:15,650
actually read this thing
not too shabby I'd say alright so now in
2084
01:00:15,650 --> 01:00:15,660
not too shabby I'd say alright so now in
2085
01:00:15,660 --> 01:00:17,240
not too shabby I'd say alright so now in
order for us to actually make something
2086
01:00:17,240 --> 01:00:17,250
order for us to actually make something
2087
01:00:17,250 --> 01:00:22,160
order for us to actually make something
useful out of this yeah it's a bit of a
2088
01:00:22,160 --> 01:00:22,170
useful out of this yeah it's a bit of a
2089
01:00:22,170 --> 01:00:25,670
useful out of this yeah it's a bit of a
comment on my horrible string
2090
01:00:25,670 --> 01:00:25,680
comment on my horrible string
2091
01:00:25,680 --> 01:00:30,740
comment on my horrible string
concatenation but that's just the way it
2092
01:00:30,740 --> 01:00:30,750
concatenation but that's just the way it
2093
01:00:30,750 --> 01:00:33,140
concatenation but that's just the way it
is for now so now we have these guys
2094
01:00:33,140 --> 01:00:33,150
is for now so now we have these guys
2095
01:00:33,150 --> 01:00:35,090
is for now so now we have these guys
here now I think we're the first thing I
2096
01:00:35,090 --> 01:00:35,100
here now I think we're the first thing I
2097
01:00:35,100 --> 01:00:38,120
here now I think we're the first thing I
would like to do is deal with arrows
2098
01:00:38,120 --> 01:00:38,130
would like to do is deal with arrows
2099
01:00:38,130 --> 01:00:39,950
would like to do is deal with arrows
because right now so far we have ignored
2100
01:00:39,950 --> 01:00:39,960
because right now so far we have ignored
2101
01:00:39,960 --> 01:00:42,200
because right now so far we have ignored
any arrows we don't print anything we
2102
01:00:42,200 --> 01:00:42,210
any arrows we don't print anything we
2103
01:00:42,210 --> 01:00:46,340
any arrows we don't print anything we
just silently ignore them and again if
2104
01:00:46,340 --> 01:00:46,350
just silently ignore them and again if
2105
01:00:46,350 --> 01:00:47,540
just silently ignore them and again if
you want to build a compiler that's
2106
01:00:47,540 --> 01:00:47,550
you want to build a compiler that's
2107
01:00:47,550 --> 01:00:49,970
you want to build a compiler that's
probably the first thing you want to pay
2108
01:00:49,970 --> 01:00:49,980
probably the first thing you want to pay
2109
01:00:49,980 --> 01:00:51,920
probably the first thing you want to pay
attention to because otherwise it will
2110
01:00:51,920 --> 01:00:51,930
attention to because otherwise it will
2111
01:00:51,930 --> 01:00:54,410
attention to because otherwise it will
be lost forever in why stuff doesn't
2112
01:00:54,410 --> 01:00:54,420
be lost forever in why stuff doesn't
2113
01:00:54,420 --> 01:00:55,820
be lost forever in why stuff doesn't
work the way you wanted to when it turns
2114
01:00:55,820 --> 01:00:55,830
work the way you wanted to when it turns
2115
01:00:55,830 --> 01:00:58,010
work the way you wanted to when it turns
out that your parts are just did it a
2116
01:00:58,010 --> 01:00:58,020
out that your parts are just did it a
2117
01:00:58,020 --> 01:01:00,500
out that your parts are just did it a
little heart attack in the middle and
2118
01:01:00,500 --> 01:01:00,510
little heart attack in the middle and
2119
01:01:00,510 --> 01:01:02,630
little heart attack in the middle and
you never knew about it so the first
2120
01:01:02,630 --> 01:01:02,640
you never knew about it so the first
2121
01:01:02,640 --> 01:01:04,610
you never knew about it so the first
thing I want to do is I want to
2122
01:01:04,610 --> 01:01:04,620
thing I want to do is I want to
2123
01:01:04,620 --> 01:01:07,550
thing I want to do is I want to
introduce the notion of arrows and I'm
2124
01:01:07,550 --> 01:01:07,560
introduce the notion of arrows and I'm
2125
01:01:07,560 --> 01:01:10,630
introduce the notion of arrows and I'm
lazy right now so I will just call them
2126
01:01:10,630 --> 01:01:10,640
lazy right now so I will just call them
2127
01:01:10,640 --> 01:01:13,040
lazy right now so I will just call them
literally just a bunch of strings so
2128
01:01:13,040 --> 01:01:13,050
literally just a bunch of strings so
2129
01:01:13,050 --> 01:01:15,830
literally just a bunch of strings so
let's do this and let's say we have a
2130
01:01:15,830 --> 01:01:15,840
let's do this and let's say we have a
2131
01:01:15,840 --> 01:01:20,050
let's do this and let's say we have a
list of string which we call Diagnostics
2132
01:01:20,050 --> 01:01:20,060
list of string which we call Diagnostics
2133
01:01:20,060 --> 01:01:26,690
list of string which we call Diagnostics
new list of string and we will expose
2134
01:01:26,690 --> 01:01:26,700
new list of string and we will expose
2135
01:01:26,700 --> 01:01:29,930
new list of string and we will expose
this to the public by saying public I
2136
01:01:29,930 --> 01:01:29,940
this to the public by saying public I
2137
01:01:29,940 --> 01:01:35,720
this to the public by saying public I
know mobile string Diagnostics
2138
01:01:35,720 --> 01:01:35,730
know mobile string Diagnostics
2139
01:01:35,730 --> 01:01:40,000
know mobile string Diagnostics
they just returned our Diagnostics right
2140
01:01:40,000 --> 01:01:40,010
they just returned our Diagnostics right
2141
01:01:40,010 --> 01:01:42,560
they just returned our Diagnostics right
so now whatever we find something that
2142
01:01:42,560 --> 01:01:42,570
so now whatever we find something that
2143
01:01:42,570 --> 01:01:46,480
so now whatever we find something that
is bad like for example this we can say
2144
01:01:46,480 --> 01:01:46,490
is bad like for example this we can say
2145
01:01:46,490 --> 01:01:54,440
is bad like for example this we can say
Diagnostics ad and we can say error bad
2146
01:01:54,440 --> 01:01:54,450
Diagnostics ad and we can say error bad
2147
01:01:54,450 --> 01:02:08,089
Diagnostics ad and we can say error bad
token a bad character in input which in
2148
01:02:08,089 --> 01:02:08,099
token a bad character in input which in
2149
01:02:08,099 --> 01:02:13,250
token a bad character in input which in
our case we can probably say it's too
2150
01:02:13,250 --> 01:02:13,260
our case we can probably say it's too
2151
01:02:13,260 --> 01:02:19,910
our case we can probably say it's too
current here good enough so this way we
2152
01:02:19,910 --> 01:02:19,920
current here good enough so this way we
2153
01:02:19,920 --> 01:02:23,810
current here good enough so this way we
at least know what's going on of course
2154
01:02:23,810 --> 01:02:23,820
at least know what's going on of course
2155
01:02:23,820 --> 01:02:25,760
at least know what's going on of course
not everyone would record the position
2156
01:02:25,760 --> 01:02:25,770
not everyone would record the position
2157
01:02:25,770 --> 01:02:29,859
not everyone would record the position
but let's leave this for a later state
2158
01:02:29,859 --> 01:02:29,869
but let's leave this for a later state
2159
01:02:29,869 --> 01:02:32,089
but let's leave this for a later state
now let's do the same thing at the
2160
01:02:32,089 --> 01:02:32,099
now let's do the same thing at the
2161
01:02:32,099 --> 01:02:36,680
now let's do the same thing at the
parser so the parser where is it should
2162
01:02:36,680 --> 01:02:36,690
parser so the parser where is it should
2163
01:02:36,690 --> 01:02:42,220
parser so the parser where is it should
have that as well so private list string
2164
01:02:42,220 --> 01:02:42,230
have that as well so private list string
2165
01:02:42,230 --> 01:02:53,700
have that as well so private list string
Diagnostics new pistol string
2166
01:02:53,700 --> 01:02:53,710
2167
01:02:53,710 --> 01:02:57,300
2168
01:02:57,300 --> 01:02:57,310
so of course at the beginning we should
2169
01:02:57,310 --> 01:03:01,320
so of course at the beginning we should
say Diagnostics range lecture
2170
01:03:01,320 --> 01:03:01,330
say Diagnostics range lecture
2171
01:03:01,330 --> 01:03:03,330
say Diagnostics range lecture
Diagnostics so we don't forget what the
2172
01:03:03,330 --> 01:03:03,340
Diagnostics so we don't forget what the
2173
01:03:03,340 --> 01:03:05,580
Diagnostics so we don't forget what the
legs are reported and then everything
2174
01:03:05,580 --> 01:03:05,590
legs are reported and then everything
2175
01:03:05,590 --> 01:03:07,200
legs are reported and then everything
the time you see something bad here like
2176
01:03:07,200 --> 01:03:07,210
the time you see something bad here like
2177
01:03:07,210 --> 01:03:11,220
the time you see something bad here like
for example here we can say Diagnostics
2178
01:03:11,220 --> 01:03:11,230
for example here we can say Diagnostics
2179
01:03:11,230 --> 01:03:25,740
for example here we can say Diagnostics
add arrow unexpected so can let's do
2180
01:03:25,740 --> 01:03:25,750
add arrow unexpected so can let's do
2181
01:03:25,750 --> 01:03:31,490
add arrow unexpected so can let's do
this and let's call this what is that
2182
01:03:31,490 --> 01:03:31,500
this and let's call this what is that
2183
01:03:31,500 --> 01:03:42,950
this and let's call this what is that
current current expected
2184
01:03:42,950 --> 01:03:42,960
2185
01:03:42,960 --> 01:03:52,559
2186
01:03:52,559 --> 01:03:52,569
2187
01:03:52,569 --> 01:03:56,249
2188
01:03:56,249 --> 01:03:56,259
all right that's pretty decent no that's
2189
01:03:56,259 --> 01:04:00,539
all right that's pretty decent no that's
actually if we find any arrows let's
2190
01:04:00,539 --> 01:04:00,549
actually if we find any arrows let's
2191
01:04:00,549 --> 01:04:07,439
actually if we find any arrows let's
report them so we can say if parser I
2192
01:04:07,439 --> 01:04:07,449
report them so we can say if parser I
2193
01:04:07,449 --> 01:04:08,519
report them so we can say if parser I
think we have an exposed to in the
2194
01:04:08,519 --> 01:04:08,529
think we have an exposed to in the
2195
01:04:08,529 --> 01:04:14,699
think we have an exposed to in the
process okay did it uh no we have not
2196
01:04:14,699 --> 01:04:14,709
process okay did it uh no we have not
2197
01:04:14,709 --> 01:04:24,150
process okay did it uh no we have not
so let's say there's a public what is
2198
01:04:24,150 --> 01:04:24,160
so let's say there's a public what is
2199
01:04:24,160 --> 01:04:31,080
so let's say there's a public what is
happening with my tab here
2200
01:04:31,080 --> 01:04:31,090
2201
01:04:31,090 --> 01:04:33,810
2202
01:04:33,810 --> 01:04:33,820
what is happening I never had that
2203
01:04:33,820 --> 01:04:39,660
what is happening I never had that
public public ienumerable off string
2204
01:04:39,660 --> 01:04:39,670
public public ienumerable off string
2205
01:04:39,670 --> 01:04:43,000
public public ienumerable off string
Diagnostics let me say this is you guys
2206
01:04:43,000 --> 01:04:43,010
Diagnostics let me say this is you guys
2207
01:04:43,010 --> 01:04:47,710
Diagnostics let me say this is you guys
all right Tipton will focus no what's
2208
01:04:47,710 --> 01:04:47,720
all right Tipton will focus no what's
2209
01:04:47,720 --> 01:04:53,350
all right Tipton will focus no what's
that I would ever do that alright so if
2210
01:04:53,350 --> 01:04:53,360
that I would ever do that alright so if
2211
01:04:53,360 --> 01:04:55,560
that I would ever do that alright so if
the person has any Diagnostics parser
2212
01:04:55,560 --> 01:04:55,570
the person has any Diagnostics parser
2213
01:04:55,570 --> 01:05:03,510
the person has any Diagnostics parser
Diagnostics any then we say you know
2214
01:05:03,510 --> 01:05:03,520
Diagnostics any then we say you know
2215
01:05:03,520 --> 01:05:06,060
Diagnostics any then we say you know
let's change this color to something
2216
01:05:06,060 --> 01:05:06,070
let's change this color to something
2217
01:05:06,070 --> 01:05:10,800
let's change this color to something
dark red maybe I might regret dark red
2218
01:05:10,800 --> 01:05:10,810
dark red maybe I might regret dark red
2219
01:05:10,810 --> 01:05:14,260
dark red maybe I might regret dark red
it's probably unreadable well we'll find
2220
01:05:14,260 --> 01:05:14,270
it's probably unreadable well we'll find
2221
01:05:14,270 --> 01:05:23,370
it's probably unreadable well we'll find
out for each of our diagnostic in
2222
01:05:23,370 --> 01:05:23,380
out for each of our diagnostic in
2223
01:05:23,380 --> 01:05:31,590
out for each of our diagnostic in
presser Diagnostics console.writeline
2224
01:05:31,590 --> 01:05:31,600
presser Diagnostics console.writeline
2225
01:05:31,600 --> 01:05:37,280
presser Diagnostics console.writeline
diagnostic
2226
01:05:37,280 --> 01:05:37,290
2227
01:05:37,290 --> 01:05:41,920
2228
01:05:41,920 --> 01:05:41,930
all right let's check that out
2229
01:05:41,930 --> 01:05:48,710
all right let's check that out
so if we say let's do a bunch of garbage
2230
01:05:48,710 --> 01:05:48,720
so if we say let's do a bunch of garbage
2231
01:05:48,720 --> 01:05:50,630
so if we say let's do a bunch of garbage
so we get better parse tree which I
2232
01:05:50,630 --> 01:05:50,640
so we get better parse tree which I
2233
01:05:50,640 --> 01:05:51,680
so we get better parse tree which I
would like to highlight so we get a
2234
01:05:51,680 --> 01:05:51,690
would like to highlight so we get a
2235
01:05:51,690 --> 01:05:53,570
would like to highlight so we get a
valid parse tree back it's just because
2236
01:05:53,570 --> 01:05:53,580
valid parse tree back it's just because
2237
01:05:53,580 --> 01:05:55,880
valid parse tree back it's just because
we expected a number expression right so
2238
01:05:55,880 --> 01:05:55,890
we expected a number expression right so
2239
01:05:55,890 --> 01:05:57,950
we expected a number expression right so
we got that one and we have a bunch of
2240
01:05:57,950 --> 01:05:57,960
we got that one and we have a bunch of
2241
01:05:57,960 --> 01:06:04,430
we got that one and we have a bunch of
arrows and then we get parse errors as
2242
01:06:04,430 --> 01:06:04,440
arrows and then we get parse errors as
2243
01:06:04,440 --> 01:06:08,180
arrows and then we get parse errors as
well so now if we say 1 plus we get an
2244
01:06:08,180 --> 01:06:08,190
well so now if we say 1 plus we get an
2245
01:06:08,190 --> 01:06:09,830
well so now if we say 1 plus we get an
arrow that says unexpected token and a
2246
01:06:09,830 --> 01:06:09,840
arrow that says unexpected token and a
2247
01:06:09,840 --> 01:06:11,540
arrow that says unexpected token and a
file and expected a number token all
2248
01:06:11,540 --> 01:06:11,550
file and expected a number token all
2249
01:06:11,550 --> 01:06:15,580
file and expected a number token all
right because it was after the plus
2250
01:06:15,580 --> 01:06:15,590
2251
01:06:15,590 --> 01:06:17,240
2252
01:06:17,240 --> 01:06:17,250
unfortunately we also have this
2253
01:06:17,250 --> 01:06:19,970
unfortunately we also have this
situation where right now we are not
2254
01:06:19,970 --> 01:06:19,980
situation where right now we are not
2255
01:06:19,980 --> 01:06:23,000
situation where right now we are not
reporting an error because what happened
2256
01:06:23,000 --> 01:06:23,010
reporting an error because what happened
2257
01:06:23,010 --> 01:06:25,130
reporting an error because what happened
is we parsed an expression and then we
2258
01:06:25,130 --> 01:06:25,140
is we parsed an expression and then we
2259
01:06:25,140 --> 01:06:28,070
is we parsed an expression and then we
didn't assert that when parsing was done
2260
01:06:28,070 --> 01:06:28,080
didn't assert that when parsing was done
2261
01:06:28,080 --> 01:06:31,580
didn't assert that when parsing was done
we're actually having end-of-file which
2262
01:06:31,580 --> 01:06:31,590
we're actually having end-of-file which
2263
01:06:31,590 --> 01:06:32,930
we're actually having end-of-file which
is a problem because now you can have
2264
01:06:32,930 --> 01:06:32,940
is a problem because now you can have
2265
01:06:32,940 --> 01:06:35,300
is a problem because now you can have
basically trading garbage can you
2266
01:06:35,300 --> 01:06:35,310
basically trading garbage can you
2267
01:06:35,310 --> 01:06:37,250
basically trading garbage can you
consider that legal which is not what
2268
01:06:37,250 --> 01:06:37,260
consider that legal which is not what
2269
01:06:37,260 --> 01:06:40,400
consider that legal which is not what
you want so in order to address that the
2270
01:06:40,400 --> 01:06:40,410
you want so in order to address that the
2271
01:06:40,410 --> 01:06:43,130
you want so in order to address that the
cleanest way I think is for us to use a
2272
01:06:43,130 --> 01:06:43,140
cleanest way I think is for us to use a
2273
01:06:43,140 --> 01:06:47,540
cleanest way I think is for us to use a
new type which represents the entire
2274
01:06:47,540 --> 01:06:47,550
new type which represents the entire
2275
01:06:47,550 --> 01:06:53,780
new type which represents the entire
input and we call this guy the syntax
2276
01:06:53,780 --> 01:06:53,790
input and we call this guy the syntax
2277
01:06:53,790 --> 01:07:02,150
input and we call this guy the syntax
tree and so the syntax tree will
2278
01:07:02,150 --> 01:07:02,160
tree and so the syntax tree will
2279
01:07:02,160 --> 01:07:04,370
tree and so the syntax tree will
basically hold on to our expression
2280
01:07:04,370 --> 01:07:04,380
basically hold on to our expression
2281
01:07:04,380 --> 01:07:07,820
basically hold on to our expression
syntax we call this root and let's say
2282
01:07:07,820 --> 01:07:07,830
syntax we call this root and let's say
2283
01:07:07,830 --> 01:07:15,800
syntax we call this root and let's say
syntax token and a file token why would
2284
01:07:15,800 --> 01:07:15,810
syntax token and a file token why would
2285
01:07:15,810 --> 01:07:19,810
syntax token and a file token why would
I want to do that make this a property
2286
01:07:19,810 --> 01:07:19,820
I want to do that make this a property
2287
01:07:19,820 --> 01:07:25,010
I want to do that make this a property
make this guy a property and then we can
2288
01:07:25,010 --> 01:07:25,020
make this guy a property and then we can
2289
01:07:25,020 --> 01:07:29,359
make this guy a property and then we can
say also what we expect here
2290
01:07:29,359 --> 01:07:29,369
say also what we expect here
2291
01:07:29,369 --> 01:07:34,969
say also what we expect here
is and I enumerable of string and we
2292
01:07:34,969 --> 01:07:34,979
is and I enumerable of string and we
2293
01:07:34,979 --> 01:07:36,829
is and I enumerable of string and we
call this Diagnostics that's also the
2294
01:07:36,829 --> 01:07:36,839
call this Diagnostics that's also the
2295
01:07:36,839 --> 01:07:41,239
call this Diagnostics that's also the
thing let me return and yeah for the
2296
01:07:41,239 --> 01:07:41,249
thing let me return and yeah for the
2297
01:07:41,249 --> 01:07:42,709
thing let me return and yeah for the
time being let's just do that even
2298
01:07:42,709 --> 01:07:42,719
time being let's just do that even
2299
01:07:42,719 --> 01:07:45,349
time being let's just do that even
though that is also bad but good enough
2300
01:07:45,349 --> 01:07:45,359
though that is also bad but good enough
2301
01:07:45,359 --> 01:07:49,219
though that is also bad but good enough
you just store the annual as is you know
2302
01:07:49,219 --> 01:07:49,229
you just store the annual as is you know
2303
01:07:49,229 --> 01:07:50,390
you just store the annual as is you know
what not worth it
2304
01:07:50,390 --> 01:07:50,400
what not worth it
2305
01:07:50,400 --> 01:07:52,160
what not worth it
let's do the right way let's say we
2306
01:07:52,160 --> 01:07:52,170
let's do the right way let's say we
2307
01:07:52,170 --> 01:07:55,670
let's do the right way let's say we
store this as and I read only list for
2308
01:07:55,670 --> 01:07:55,680
store this as and I read only list for
2309
01:07:55,680 --> 01:08:01,400
store this as and I read only list for
now and so we just say to array so we
2310
01:08:01,400 --> 01:08:01,410
now and so we just say to array so we
2311
01:08:01,410 --> 01:08:03,890
now and so we just say to array so we
don't have to worry about any craziness
2312
01:08:03,890 --> 01:08:03,900
don't have to worry about any craziness
2313
01:08:03,900 --> 01:08:07,819
don't have to worry about any craziness
here then we will do we let our parser
2314
01:08:07,819 --> 01:08:07,829
here then we will do we let our parser
2315
01:08:07,829 --> 01:08:10,430
here then we will do we let our parser
instead of returning an expression for
2316
01:08:10,430 --> 01:08:10,440
instead of returning an expression for
2317
01:08:10,440 --> 01:08:15,259
instead of returning an expression for
the root they return a syntax tree let's
2318
01:08:15,259 --> 01:08:15,269
the root they return a syntax tree let's
2319
01:08:15,269 --> 01:08:16,879
the root they return a syntax tree let's
move this whole thing into another
2320
01:08:16,879 --> 01:08:16,889
move this whole thing into another
2321
01:08:16,889 --> 01:08:22,570
move this whole thing into another
method let's call this method Paris
2322
01:08:22,570 --> 01:08:22,580
method let's call this method Paris
2323
01:08:22,580 --> 01:08:26,300
method let's call this method Paris
expression yeah obviously I should
2324
01:08:26,300 --> 01:08:26,310
expression yeah obviously I should
2325
01:08:26,310 --> 01:08:28,849
expression yeah obviously I should
return an expression subject still then
2326
01:08:28,849 --> 01:08:28,859
return an expression subject still then
2327
01:08:28,859 --> 01:08:34,249
return an expression subject still then
we can save our expression equals parse
2328
01:08:34,249 --> 01:08:34,259
we can save our expression equals parse
2329
01:08:34,259 --> 01:08:37,640
we can save our expression equals parse
expression then we can say match syntax
2330
01:08:37,640 --> 01:08:37,650
expression then we can say match syntax
2331
01:08:37,650 --> 01:08:42,890
expression then we can say match syntax
kind and afar token because that's what
2332
01:08:42,890 --> 01:08:42,900
kind and afar token because that's what
2333
01:08:42,900 --> 01:08:48,740
kind and afar token because that's what
we really expect the law and of it's
2334
01:08:48,740 --> 01:08:48,750
we really expect the law and of it's
2335
01:08:48,750 --> 01:08:49,189
we really expect the law and of it's
okay
2336
01:08:49,189 --> 01:08:49,199
okay
2337
01:08:49,199 --> 01:08:54,349
okay
and then I can say return new syntax
2338
01:08:54,349 --> 01:08:54,359
and then I can say return new syntax
2339
01:08:54,359 --> 01:08:59,720
and then I can say return new syntax
tree basically our Diagnostics the
2340
01:08:59,720 --> 01:08:59,730
tree basically our Diagnostics the
2341
01:08:59,730 --> 01:09:06,269
tree basically our Diagnostics the
expression and our end of our token
2342
01:09:06,269 --> 01:09:06,279
2343
01:09:06,279 --> 01:09:09,010
2344
01:09:09,010 --> 01:09:09,020
now this is slightly cleaner so instead
2345
01:09:09,020 --> 01:09:13,410
now this is slightly cleaner so instead
of saying expression we say syntax tree
2346
01:09:13,410 --> 01:09:13,420
of saying expression we say syntax tree
2347
01:09:13,420 --> 01:09:20,410
of saying expression we say syntax tree
then we can say syntax tree root and
2348
01:09:20,410 --> 01:09:20,420
then we can say syntax tree root and
2349
01:09:20,420 --> 01:09:23,189
then we can say syntax tree root and
then we can say it's syntax tree
2350
01:09:23,189 --> 01:09:23,199
then we can say it's syntax tree
2351
01:09:23,199 --> 01:09:32,700
then we can say it's syntax tree
Diagnostics you walk over these guys
2352
01:09:32,700 --> 01:09:32,710
2353
01:09:32,710 --> 01:09:34,450
2354
01:09:34,450 --> 01:09:34,460
sweet all right
2355
01:09:34,460 --> 01:09:40,269
sweet all right
so far so good no let's run this guy now
2356
01:09:40,269 --> 01:09:40,279
so far so good no let's run this guy now
2357
01:09:40,279 --> 01:09:43,870
so far so good no let's run this guy now
we say 1 1 we get unexpected token
2358
01:09:43,870 --> 01:09:43,880
we say 1 1 we get unexpected token
2359
01:09:43,880 --> 01:09:45,760
we say 1 1 we get unexpected token
number token expected end of our token
2360
01:09:45,760 --> 01:09:45,770
number token expected end of our token
2361
01:09:45,770 --> 01:09:48,970
number token expected end of our token
so those things seem to work quite
2362
01:09:48,970 --> 01:09:48,980
so those things seem to work quite
2363
01:09:48,980 --> 01:09:53,729
so those things seem to work quite
nicely actually
2364
01:09:53,729 --> 01:09:53,739
2365
01:09:53,739 --> 01:09:56,830
2366
01:09:56,830 --> 01:09:56,840
nice all right now let's think about
2367
01:09:56,840 --> 01:09:59,050
nice all right now let's think about
priorities for a second so if you do
2368
01:09:59,050 --> 01:09:59,060
priorities for a second so if you do
2369
01:09:59,060 --> 01:10:03,070
priorities for a second so if you do
this that is ok actually know before we
2370
01:10:03,070 --> 01:10:03,080
this that is ok actually know before we
2371
01:10:03,080 --> 01:10:07,630
this that is ok actually know before we
do that let's actually evaluate let's do
2372
01:10:07,630 --> 01:10:07,640
do that let's actually evaluate let's do
2373
01:10:07,640 --> 01:10:09,760
do that let's actually evaluate let's do
that first so how will be how about we
2374
01:10:09,760 --> 01:10:09,770
that first so how will be how about we
2375
01:10:09,770 --> 01:10:11,620
that first so how will be how about we
use this output now to actually compute
2376
01:10:11,620 --> 01:10:11,630
use this output now to actually compute
2377
01:10:11,630 --> 01:10:14,950
use this output now to actually compute
a number right that's probably the maybe
2378
01:10:14,950 --> 01:10:14,960
a number right that's probably the maybe
2379
01:10:14,960 --> 01:10:16,240
a number right that's probably the maybe
not doing this just for the for the
2380
01:10:16,240 --> 01:10:16,250
not doing this just for the for the
2381
01:10:16,250 --> 01:10:17,470
not doing this just for the for the
giggles here you actually want to do
2382
01:10:17,470 --> 01:10:17,480
giggles here you actually want to do
2383
01:10:17,480 --> 01:10:19,090
giggles here you actually want to do
something with the end result so let's
2384
01:10:19,090 --> 01:10:19,100
something with the end result so let's
2385
01:10:19,100 --> 01:10:23,800
something with the end result so let's
call this an evaluate or let's say and
2386
01:10:23,800 --> 01:10:23,810
call this an evaluate or let's say and
2387
01:10:23,810 --> 01:10:29,190
call this an evaluate or let's say and
let's say we give this guy
2388
01:10:29,190 --> 01:10:29,200
2389
01:10:29,200 --> 01:10:33,330
2390
01:10:33,330 --> 01:10:33,340
2391
01:10:33,340 --> 01:10:37,479
2392
01:10:37,479 --> 01:10:37,489
Jesus Christ we give this let's say the
2393
01:10:37,489 --> 01:10:42,910
Jesus Christ we give this let's say the
root object root and then we have public
2394
01:10:42,910 --> 01:10:42,920
root object root and then we have public
2395
01:10:42,920 --> 01:10:52,000
root object root and then we have public
and evaluate and then we just say this
2396
01:10:52,000 --> 01:10:52,010
and evaluate and then we just say this
2397
01:10:52,010 --> 01:11:03,540
and evaluate and then we just say this
is return evaluate expression with this
2398
01:11:03,540 --> 01:11:03,550
is return evaluate expression with this
2399
01:11:03,550 --> 01:11:08,390
is return evaluate expression with this
root
2400
01:11:08,390 --> 01:11:08,400
2401
01:11:08,400 --> 01:11:13,910
2402
01:11:13,910 --> 01:11:13,920
2403
01:11:13,920 --> 01:11:16,250
2404
01:11:16,250 --> 01:11:16,260
all right how does this work well we
2405
01:11:16,260 --> 01:11:18,320
all right how does this work well we
have basically what kind of expressions
2406
01:11:18,320 --> 01:11:18,330
have basically what kind of expressions
2407
01:11:18,330 --> 01:11:19,580
have basically what kind of expressions
do we have we have a binary expression
2408
01:11:19,580 --> 01:11:19,590
do we have we have a binary expression
2409
01:11:19,590 --> 01:11:22,700
do we have we have a binary expression
right now and we have a number
2410
01:11:22,700 --> 01:11:22,710
right now and we have a number
2411
01:11:22,710 --> 01:11:24,650
right now and we have a number
expression right now it's the only two
2412
01:11:24,650 --> 01:11:24,660
expression right now it's the only two
2413
01:11:24,660 --> 01:11:27,470
expression right now it's the only two
things we have so let's do this
2414
01:11:27,470 --> 01:11:27,480
things we have so let's do this
2415
01:11:27,480 --> 01:11:33,640
things we have so let's do this
let's say if root is number expression
2416
01:11:33,640 --> 01:11:33,650
let's say if root is number expression
2417
01:11:33,650 --> 01:11:39,710
let's say if root is number expression
and then the result is the number token
2418
01:11:39,710 --> 01:11:39,720
and then the result is the number token
2419
01:11:39,720 --> 01:11:47,060
and then the result is the number token
and the value so now that is the problem
2420
01:11:47,060 --> 01:11:47,070
and the value so now that is the problem
2421
01:11:47,070 --> 01:11:49,070
and the value so now that is the problem
because we said earlier and the parser
2422
01:11:49,070 --> 01:11:49,080
because we said earlier and the parser
2423
01:11:49,080 --> 01:11:50,600
because we said earlier and the parser
that we may not actually have a value
2424
01:11:50,600 --> 01:11:50,610
that we may not actually have a value
2425
01:11:50,610 --> 01:11:51,560
that we may not actually have a value
right because we didn't actually
2426
01:11:51,560 --> 01:11:51,570
right because we didn't actually
2427
01:11:51,570 --> 01:11:53,780
right because we didn't actually
validate that so let me actually go back
2428
01:11:53,780 --> 01:11:53,790
validate that so let me actually go back
2429
01:11:53,790 --> 01:11:56,510
validate that so let me actually go back
to the lexer really quick remember when
2430
01:11:56,510 --> 01:11:56,520
to the lexer really quick remember when
2431
01:11:56,520 --> 01:11:58,850
to the lexer really quick remember when
we parse this guy here and we said where
2432
01:11:58,850 --> 01:11:58,860
we parse this guy here and we said where
2433
01:11:58,860 --> 01:12:00,860
we parse this guy here and we said where
is it here we said oh we don't know
2434
01:12:00,860 --> 01:12:00,870
is it here we said oh we don't know
2435
01:12:00,870 --> 01:12:02,570
is it here we said oh we don't know
what's going on well this is the moment
2436
01:12:02,570 --> 01:12:02,580
what's going on well this is the moment
2437
01:12:02,580 --> 01:12:05,150
what's going on well this is the moment
where you want to make sure that you
2438
01:12:05,150 --> 01:12:05,160
where you want to make sure that you
2439
01:12:05,160 --> 01:12:08,260
where you want to make sure that you
report an error so you would say if not
2440
01:12:08,260 --> 01:12:08,270
report an error so you would say if not
2441
01:12:08,270 --> 01:12:11,510
report an error so you would say if not
then we would report an error here that
2442
01:12:11,510 --> 01:12:11,520
then we would report an error here that
2443
01:12:11,520 --> 01:12:28,010
then we would report an error here that
says Diagnostics and the number
2444
01:12:28,010 --> 01:12:28,020
2445
01:12:28,020 --> 01:12:36,470
2446
01:12:36,470 --> 01:12:36,480
cannot be represented by and in 32 all
2447
01:12:36,480 --> 01:12:38,000
cannot be represented by and in 32 all
right because we know it's only numbers
2448
01:12:38,000 --> 01:12:38,010
right because we know it's only numbers
2449
01:12:38,010 --> 01:12:45,740
right because we know it's only numbers
for now right I choose this day isn't
2450
01:12:45,740 --> 01:12:45,750
for now right I choose this day isn't
2451
01:12:45,750 --> 01:12:52,430
for now right I choose this day isn't
valid in 32 good enough because now we
2452
01:12:52,430 --> 01:12:52,440
valid in 32 good enough because now we
2453
01:12:52,440 --> 01:12:56,110
valid in 32 good enough because now we
can say you can only call evaluate if
2454
01:12:56,110 --> 01:12:56,120
can say you can only call evaluate if
2455
01:12:56,120 --> 01:12:58,670
can say you can only call evaluate if
you don't have any arrows otherwise it's
2456
01:12:58,670 --> 01:12:58,680
you don't have any arrows otherwise it's
2457
01:12:58,680 --> 01:13:00,710
you don't have any arrows otherwise it's
illegal to call this method which
2458
01:13:00,710 --> 01:13:00,720
illegal to call this method which
2459
01:13:00,720 --> 01:13:02,750
illegal to call this method which
simplifies your error handling quite a
2460
01:13:02,750 --> 01:13:02,760
simplifies your error handling quite a
2461
01:13:02,760 --> 01:13:07,550
simplifies your error handling quite a
bit all right now we can say if root is
2462
01:13:07,550 --> 01:13:07,560
bit all right now we can say if root is
2463
01:13:07,560 --> 01:13:12,920
bit all right now we can say if root is
binary expression syntax B well we can
2464
01:13:12,920 --> 01:13:12,930
binary expression syntax B well we can
2465
01:13:12,930 --> 01:13:18,020
binary expression syntax B well we can
say var left equals evaluate expression
2466
01:13:18,020 --> 01:13:18,030
say var left equals evaluate expression
2467
01:13:18,030 --> 01:13:21,680
say var left equals evaluate expression
for B dot left do the same thing for
2468
01:13:21,680 --> 01:13:21,690
for B dot left do the same thing for
2469
01:13:21,690 --> 01:13:27,320
for B dot left do the same thing for
right right
2470
01:13:27,320 --> 01:13:27,330
2471
01:13:27,330 --> 01:13:36,450
2472
01:13:36,450 --> 01:13:36,460
and then we say well if P dot operator
2473
01:13:36,460 --> 01:13:42,050
and then we say well if P dot operator
token kind equals syntax kind plus token
2474
01:13:42,050 --> 01:13:42,060
token kind equals syntax kind plus token
2475
01:13:42,060 --> 01:13:47,270
token kind equals syntax kind plus token
then we say return left + right
2476
01:13:47,270 --> 01:13:47,280
2477
01:13:47,280 --> 01:13:51,410
2478
01:13:51,410 --> 01:13:51,420
bum-bum-bum gonna say this is the elsif
2479
01:13:51,420 --> 01:14:00,440
bum-bum-bum gonna say this is the elsif
out of out serve else throw new
2480
01:14:00,440 --> 01:14:00,450
out of out serve else throw new
2481
01:14:00,450 --> 01:14:16,080
out of out serve else throw new
exception unexpected binary operator
2482
01:14:16,080 --> 01:14:16,090
2483
01:14:16,090 --> 01:14:19,350
2484
01:14:19,350 --> 01:14:19,360
that will be B operator token kind right
2485
01:14:19,360 --> 01:14:23,490
that will be B operator token kind right
because that shouldn't happen right so
2486
01:14:23,490 --> 01:14:23,500
because that shouldn't happen right so
2487
01:14:23,500 --> 01:14:32,120
because that shouldn't happen right so
we have + right - right star would be
2488
01:14:32,120 --> 01:14:32,130
2489
01:14:32,130 --> 01:14:33,990
2490
01:14:33,990 --> 01:14:34,000
multiplication and then this would be
2491
01:14:34,000 --> 01:14:37,080
multiplication and then this would be
division and say whether it's slash
2492
01:14:37,080 --> 01:14:37,090
division and say whether it's slash
2493
01:14:37,090 --> 01:14:42,600
division and say whether it's slash
talking yeah and then same thing here we
2494
01:14:42,600 --> 01:14:42,610
talking yeah and then same thing here we
2495
01:14:42,610 --> 01:14:45,950
talking yeah and then same thing here we
would say it warned you
2496
01:14:45,950 --> 01:14:45,960
would say it warned you
2497
01:14:45,960 --> 01:14:55,950
would say it warned you
unexpected note
2498
01:14:55,950 --> 01:14:55,960
2499
01:14:55,960 --> 01:15:01,470
2500
01:15:01,470 --> 01:15:01,480
let's call this you know all right so
2501
01:15:01,480 --> 01:15:05,280
let's call this you know all right so
this one should give us something to
2502
01:15:05,280 --> 01:15:05,290
this one should give us something to
2503
01:15:05,290 --> 01:15:12,450
this one should give us something to
work with inter Denton if you have any
2504
01:15:12,450 --> 01:15:12,460
work with inter Denton if you have any
2505
01:15:12,460 --> 01:15:15,350
work with inter Denton if you have any
Diagnostics and we report them otherwise
2506
01:15:15,350 --> 01:15:15,360
Diagnostics and we report them otherwise
2507
01:15:15,360 --> 01:15:25,440
Diagnostics and we report them otherwise
we will for our syntax tree expression
2508
01:15:25,440 --> 01:15:25,450
we will for our syntax tree expression
2509
01:15:25,450 --> 01:15:30,420
we will for our syntax tree expression
no root I think it's gone yeah and then
2510
01:15:30,420 --> 01:15:30,430
no root I think it's gone yeah and then
2511
01:15:30,430 --> 01:15:37,620
no root I think it's gone yeah and then
we save our result equals evaluate and
2512
01:15:37,620 --> 01:15:37,630
we save our result equals evaluate and
2513
01:15:37,630 --> 01:15:43,500
we save our result equals evaluate and
then we say console dot write line is
2514
01:15:43,500 --> 01:15:43,510
then we say console dot write line is
2515
01:15:43,510 --> 01:15:49,710
then we say console dot write line is
that can invert if super nice because
2516
01:15:49,710 --> 01:15:49,720
that can invert if super nice because
2517
01:15:49,720 --> 01:15:54,980
that can invert if super nice because
that makes a little bit easier to read
2518
01:15:54,980 --> 01:15:54,990
2519
01:15:54,990 --> 01:15:57,150
2520
01:15:57,150 --> 01:15:57,160
let's try what happens
2521
01:15:57,160 --> 01:16:02,540
let's try what happens
one plus two is three two times three
2522
01:16:02,540 --> 01:16:02,550
one plus two is three two times three
2523
01:16:02,550 --> 01:16:04,620
one plus two is three two times three
well actually we don't parse that yet
2524
01:16:04,620 --> 01:16:04,630
well actually we don't parse that yet
2525
01:16:04,630 --> 01:16:11,720
well actually we don't parse that yet
okay two plus three minus one it's four
2526
01:16:11,720 --> 01:16:11,730
okay two plus three minus one it's four
2527
01:16:11,730 --> 01:16:18,450
okay two plus three minus one it's four
seems right and if we say really really
2528
01:16:18,450 --> 01:16:18,460
seems right and if we say really really
2529
01:16:18,460 --> 01:16:21,180
seems right and if we say really really
really really large number then we get
2530
01:16:21,180 --> 01:16:21,190
really really large number then we get
2531
01:16:21,190 --> 01:16:24,240
really really large number then we get
it's not a valid int alright so this way
2532
01:16:24,240 --> 01:16:24,250
it's not a valid int alright so this way
2533
01:16:24,250 --> 01:16:25,950
it's not a valid int alright so this way
we actually have some decent error
2534
01:16:25,950 --> 01:16:25,960
we actually have some decent error
2535
01:16:25,960 --> 01:16:27,890
we actually have some decent error
handling and we actually evaluate stuff
2536
01:16:27,890 --> 01:16:27,900
handling and we actually evaluate stuff
2537
01:16:27,900 --> 01:16:31,170
handling and we actually evaluate stuff
now let's actually go down to our parser
2538
01:16:31,170 --> 01:16:31,180
now let's actually go down to our parser
2539
01:16:31,180 --> 01:16:36,960
now let's actually go down to our parser
and try to handle multiplication because
2540
01:16:36,960 --> 01:16:36,970
and try to handle multiplication because
2541
01:16:36,970 --> 01:16:38,190
and try to handle multiplication because
how hard can it be right
2542
01:16:38,190 --> 01:16:38,200
how hard can it be right
2543
01:16:38,200 --> 01:16:41,640
how hard can it be right
we already handle plus and minus so all
2544
01:16:41,640 --> 01:16:41,650
we already handle plus and minus so all
2545
01:16:41,650 --> 01:16:46,020
we already handle plus and minus so all
we have to do here
2546
01:16:46,020 --> 01:16:46,030
2547
01:16:46,030 --> 01:16:49,360
2548
01:16:49,360 --> 01:16:49,370
are these guys right I would say what
2549
01:16:49,370 --> 01:16:52,660
are these guys right I would say what
does that start token and then / token
2550
01:16:52,660 --> 01:16:52,670
does that start token and then / token
2551
01:16:52,670 --> 01:17:03,430
does that start token and then / token
right now let's say 2 times 3 6 all
2552
01:17:03,430 --> 01:17:03,440
right now let's say 2 times 3 6 all
2553
01:17:03,440 --> 01:17:08,879
right now let's say 2 times 3 6 all
right it seems good 6 divided by 2 is 3
2554
01:17:08,879 --> 01:17:08,889
right it seems good 6 divided by 2 is 3
2555
01:17:08,889 --> 01:17:17,320
right it seems good 6 divided by 2 is 3
well 1 plus 2 times 3 it's not 9 so the
2556
01:17:17,320 --> 01:17:17,330
well 1 plus 2 times 3 it's not 9 so the
2557
01:17:17,330 --> 01:17:19,510
well 1 plus 2 times 3 it's not 9 so the
reason this is saying 9 is because the
2558
01:17:19,510 --> 01:17:19,520
reason this is saying 9 is because the
2559
01:17:19,520 --> 01:17:21,370
reason this is saying 9 is because the
parse tree it does not actually honor
2560
01:17:21,370 --> 01:17:21,380
parse tree it does not actually honor
2561
01:17:21,380 --> 01:17:26,169
parse tree it does not actually honor
our normal priority rules right normally
2562
01:17:26,169 --> 01:17:26,179
our normal priority rules right normally
2563
01:17:26,179 --> 01:17:31,080
our normal priority rules right normally
you would say 2 plus 3 binds stronger
2564
01:17:31,080 --> 01:17:31,090
you would say 2 plus 3 binds stronger
2565
01:17:31,090 --> 01:17:34,330
you would say 2 plus 3 binds stronger
then this one here but right now because
2566
01:17:34,330 --> 01:17:34,340
then this one here but right now because
2567
01:17:34,340 --> 01:17:35,740
then this one here but right now because
the way it's being parsed is we first
2568
01:17:35,740 --> 01:17:35,750
the way it's being parsed is we first
2569
01:17:35,750 --> 01:17:39,220
the way it's being parsed is we first
parse 1 plus 2 and then we just say plus
2570
01:17:39,220 --> 01:17:39,230
parse 1 plus 2 and then we just say plus
2571
01:17:39,230 --> 01:17:43,270
parse 1 plus 2 and then we just say plus
2 times 3 so we first evaluate 1 plus 2
2572
01:17:43,270 --> 01:17:43,280
2 times 3 so we first evaluate 1 plus 2
2573
01:17:43,280 --> 01:17:46,030
2 times 3 so we first evaluate 1 plus 2
which is 3 and then we say times 3 which
2574
01:17:46,030 --> 01:17:46,040
which is 3 and then we say times 3 which
2575
01:17:46,040 --> 01:17:47,979
which is 3 and then we say times 3 which
is 9 but that's not the correct way to
2576
01:17:47,979 --> 01:17:47,989
is 9 but that's not the correct way to
2577
01:17:47,989 --> 01:17:50,229
is 9 but that's not the correct way to
do the math so we have to parse this
2578
01:17:50,229 --> 01:17:50,239
do the math so we have to parse this
2579
01:17:50,239 --> 01:17:54,160
do the math so we have to parse this
differently so the way we handle that is
2580
01:17:54,160 --> 01:17:54,170
differently so the way we handle that is
2581
01:17:54,170 --> 01:17:56,709
differently so the way we handle that is
by just changing the way the parser is
2582
01:17:56,709 --> 01:17:56,719
by just changing the way the parser is
2583
01:17:56,719 --> 01:17:58,930
by just changing the way the parser is
organized so if you think about the
2584
01:17:58,930 --> 01:17:58,940
organized so if you think about the
2585
01:17:58,940 --> 01:18:00,580
organized so if you think about the
parser for a second right so this is a
2586
01:18:00,580 --> 01:18:00,590
parser for a second right so this is a
2587
01:18:00,590 --> 01:18:02,709
parser for a second right so this is a
what's called a recursive descent parser
2588
01:18:02,709 --> 01:18:02,719
what's called a recursive descent parser
2589
01:18:02,719 --> 01:18:04,840
what's called a recursive descent parser
because basically what you do is you
2590
01:18:04,840 --> 01:18:04,850
because basically what you do is you
2591
01:18:04,850 --> 01:18:07,770
because basically what you do is you
call these methods recursively right and
2592
01:18:07,770 --> 01:18:07,780
call these methods recursively right and
2593
01:18:07,780 --> 01:18:10,149
call these methods recursively right and
so this is how you get the tree
2594
01:18:10,149 --> 01:18:10,159
so this is how you get the tree
2595
01:18:10,159 --> 01:18:10,899
so this is how you get the tree
structure going
2596
01:18:10,899 --> 01:18:10,909
structure going
2597
01:18:10,909 --> 01:18:12,370
structure going
I know marques I'm not having really
2598
01:18:12,370 --> 01:18:12,380
I know marques I'm not having really
2599
01:18:12,380 --> 01:18:13,990
I know marques I'm not having really
recursion right now because I just have
2600
01:18:13,990 --> 01:18:14,000
recursion right now because I just have
2601
01:18:14,000 --> 01:18:16,959
recursion right now because I just have
a primitive while loop so let's actually
2602
01:18:16,959 --> 01:18:16,969
a primitive while loop so let's actually
2603
01:18:16,969 --> 01:18:20,560
a primitive while loop so let's actually
do a recursive part here so the trick is
2604
01:18:20,560 --> 01:18:20,570
do a recursive part here so the trick is
2605
01:18:20,570 --> 01:18:23,520
do a recursive part here so the trick is
you just split these guys into two and
2606
01:18:23,520 --> 01:18:23,530
you just split these guys into two and
2607
01:18:23,530 --> 01:18:27,850
you just split these guys into two and
then this is what people call parse more
2608
01:18:27,850 --> 01:18:27,860
then this is what people call parse more
2609
01:18:27,860 --> 01:18:33,570
then this is what people call parse more
to multiplicative expression let's say I
2610
01:18:33,570 --> 01:18:33,580
to multiplicative expression let's say I
2611
01:18:33,580 --> 01:18:35,950
to multiplicative expression let's say I
think the correct term for that is parts
2612
01:18:35,950 --> 01:18:35,960
think the correct term for that is parts
2613
01:18:35,960 --> 01:18:39,939
think the correct term for that is parts
factor which is basic to say you know
2614
01:18:39,939 --> 01:18:39,949
factor which is basic to say you know
2615
01:18:39,949 --> 01:18:44,370
factor which is basic to say you know
the things that are stronger together
2616
01:18:44,370 --> 01:18:44,380
the things that are stronger together
2617
01:18:44,380 --> 01:18:46,540
the things that are stronger together
let me say parse factor as the primary
2618
01:18:46,540 --> 01:18:46,550
let me say parse factor as the primary
2619
01:18:46,550 --> 01:18:49,600
let me say parse factor as the primary
expression times was divided by another
2620
01:18:49,600 --> 01:18:49,610
expression times was divided by another
2621
01:18:49,610 --> 01:18:52,209
expression times was divided by another
primary expression and let me say this
2622
01:18:52,209 --> 01:18:52,219
primary expression and let me say this
2623
01:18:52,219 --> 01:18:55,750
primary expression and let me say this
is a this is a we call this parse Terim
2624
01:18:55,750 --> 01:18:55,760
is a this is a we call this parse Terim
2625
01:18:55,760 --> 01:18:57,620
is a this is a we call this parse Terim
I believe it was the usual term and
2626
01:18:57,620 --> 01:18:57,630
I believe it was the usual term and
2627
01:18:57,630 --> 01:19:02,390
I believe it was the usual term and
internet that they use where we say this
2628
01:19:02,390 --> 01:19:02,400
internet that they use where we say this
2629
01:19:02,400 --> 01:19:04,370
internet that they use where we say this
is a bunch of factors that are strung
2630
01:19:04,370 --> 01:19:04,380
is a bunch of factors that are strung
2631
01:19:04,380 --> 01:19:08,050
is a bunch of factors that are strung
together and then this guy only handles
2632
01:19:08,050 --> 01:19:08,060
together and then this guy only handles
2633
01:19:08,060 --> 01:19:12,170
together and then this guy only handles
these guys so let's see whether this
2634
01:19:12,170 --> 01:19:12,180
these guys so let's see whether this
2635
01:19:12,180 --> 01:19:16,550
these guys so let's see whether this
actually solves our opponent well first
2636
01:19:16,550 --> 01:19:16,560
actually solves our opponent well first
2637
01:19:16,560 --> 01:19:23,510
actually solves our opponent well first
it would help if it compiles so we now
2638
01:19:23,510 --> 01:19:23,520
it would help if it compiles so we now
2639
01:19:23,520 --> 01:19:29,330
it would help if it compiles so we now
say 1 plus 2 times 3 now I get 7 and now
2640
01:19:29,330 --> 01:19:29,340
say 1 plus 2 times 3 now I get 7 and now
2641
01:19:29,340 --> 01:19:31,130
say 1 plus 2 times 3 now I get 7 and now
I get a different press 3 right so now
2642
01:19:31,130 --> 01:19:31,140
I get a different press 3 right so now
2643
01:19:31,140 --> 01:19:34,340
I get a different press 3 right so now
what ends up happening is we say 1 plus
2644
01:19:34,340 --> 01:19:34,350
what ends up happening is we say 1 plus
2645
01:19:34,350 --> 01:19:38,450
what ends up happening is we say 1 plus
and then the operand 4 plus is another
2646
01:19:38,450 --> 01:19:38,460
and then the operand 4 plus is another
2647
01:19:38,460 --> 01:19:43,670
and then the operand 4 plus is another
expression which is now our our factor
2648
01:19:43,670 --> 01:19:43,680
expression which is now our our factor
2649
01:19:43,680 --> 01:19:45,770
expression which is now our our factor
effectively that represents the result
2650
01:19:45,770 --> 01:19:45,780
effectively that represents the result
2651
01:19:45,780 --> 01:19:47,000
effectively that represents the result
of the computation so now we actually
2652
01:19:47,000 --> 01:19:47,010
of the computation so now we actually
2653
01:19:47,010 --> 01:19:51,500
of the computation so now we actually
have the correct priorities in our in
2654
01:19:51,500 --> 01:19:51,510
have the correct priorities in our in
2655
01:19:51,510 --> 01:19:55,880
have the correct priorities in our in
our evaluator so let's do one more thing
2656
01:19:55,880 --> 01:19:55,890
our evaluator so let's do one more thing
2657
01:19:55,890 --> 01:19:59,740
our evaluator so let's do one more thing
because right now what annoys me a bit
2658
01:19:59,740 --> 01:19:59,750
2659
01:19:59,750 --> 01:20:03,170
2660
01:20:03,170 --> 01:20:03,180
yeah I guess doesn't matter um so we
2661
01:20:03,180 --> 01:20:04,400
yeah I guess doesn't matter um so we
have that now the other thing that we
2662
01:20:04,400 --> 01:20:04,410
have that now the other thing that we
2663
01:20:04,410 --> 01:20:07,520
have that now the other thing that we
want to do probably is support
2664
01:20:07,520 --> 01:20:07,530
want to do probably is support
2665
01:20:07,530 --> 01:20:09,410
want to do probably is support
parenthesized expressions so let me
2666
01:20:09,410 --> 01:20:09,420
parenthesized expressions so let me
2667
01:20:09,420 --> 01:20:14,510
parenthesized expressions so let me
actually add another note for that so
2668
01:20:14,510 --> 01:20:14,520
actually add another note for that so
2669
01:20:14,520 --> 01:20:15,710
actually add another note for that so
what would that look like so we have a
2670
01:20:15,710 --> 01:20:15,720
what would that look like so we have a
2671
01:20:15,720 --> 01:20:20,320
what would that look like so we have a
sealed clasp parenthesized expression
2672
01:20:20,320 --> 01:20:20,330
sealed clasp parenthesized expression
2673
01:20:20,330 --> 01:20:30,919
sealed clasp parenthesized expression
syntax which is an expression syntax
2674
01:20:30,919 --> 01:20:30,929
2675
01:20:30,929 --> 01:20:32,669
2676
01:20:32,669 --> 01:20:32,679
there's no way I typed it correctly
2677
01:20:32,679 --> 01:20:34,890
there's no way I typed it correctly
prevent this I get look looks good
2678
01:20:34,890 --> 01:20:34,900
prevent this I get look looks good
2679
01:20:34,900 --> 01:20:37,919
prevent this I get look looks good
I'm syntax token so what do we have
2680
01:20:37,919 --> 01:20:37,929
I'm syntax token so what do we have
2681
01:20:37,929 --> 01:20:42,600
I'm syntax token so what do we have
syntax token we say open parenthesis
2682
01:20:42,600 --> 01:20:42,610
syntax token we say open parenthesis
2683
01:20:42,610 --> 01:20:46,800
syntax token we say open parenthesis
token then we say we have the expression
2684
01:20:46,800 --> 01:20:46,810
token then we say we have the expression
2685
01:20:46,810 --> 01:20:50,430
token then we say we have the expression
syntax which is the expression and then
2686
01:20:50,430 --> 01:20:50,440
syntax which is the expression and then
2687
01:20:50,440 --> 01:20:53,729
syntax which is the expression and then
we have another syntax token which is
2688
01:20:53,729 --> 01:20:53,739
we have another syntax token which is
2689
01:20:53,739 --> 01:20:58,680
we have another syntax token which is
the closed parenthesis token and then I
2690
01:20:58,680 --> 01:20:58,690
the closed parenthesis token and then I
2691
01:20:58,690 --> 01:21:07,950
the closed parenthesis token and then I
just store them in properties we have to
2692
01:21:07,950 --> 01:21:07,960
just store them in properties we have to
2693
01:21:07,960 --> 01:21:12,060
just store them in properties we have to
override a certain thing so we say this
2694
01:21:12,060 --> 01:21:12,070
override a certain thing so we say this
2695
01:21:12,070 --> 01:21:16,470
override a certain thing so we say this
is some kind X what do we say
2696
01:21:16,470 --> 01:21:16,480
is some kind X what do we say
2697
01:21:16,480 --> 01:21:26,560
is some kind X what do we say
parenthesized you know what I copy that
2698
01:21:26,560 --> 01:21:26,570
2699
01:21:26,570 --> 01:21:31,180
2700
01:21:31,180 --> 01:21:31,190
this guy here generate the you November
2701
01:21:31,190 --> 01:21:34,840
this guy here generate the you November
and then we say what do we do we say
2702
01:21:34,840 --> 01:21:34,850
and then we say what do we do we say
2703
01:21:34,850 --> 01:21:40,110
and then we say what do we do we say
yield return open parentheses token
2704
01:21:40,110 --> 01:21:40,120
yield return open parentheses token
2705
01:21:40,120 --> 01:21:42,700
yield return open parentheses token
closed parentheses token and there is
2706
01:21:42,700 --> 01:21:42,710
closed parentheses token and there is
2707
01:21:42,710 --> 01:21:44,560
closed parentheses token and there is
any yield return an expression in the
2708
01:21:44,560 --> 01:21:44,570
any yield return an expression in the
2709
01:21:44,570 --> 01:21:50,890
any yield return an expression in the
middle alright so this is our thing you
2710
01:21:50,890 --> 01:21:50,900
middle alright so this is our thing you
2711
01:21:50,900 --> 01:21:52,510
middle alright so this is our thing you
know we only have to parse it so the way
2712
01:21:52,510 --> 01:21:52,520
know we only have to parse it so the way
2713
01:21:52,520 --> 01:21:55,300
know we only have to parse it so the way
we would parse this is at the very very
2714
01:21:55,300 --> 01:21:55,310
we would parse this is at the very very
2715
01:21:55,310 --> 01:21:57,370
we would parse this is at the very very
bottom part why driven right now say
2716
01:21:57,370 --> 01:21:57,380
bottom part why driven right now say
2717
01:21:57,380 --> 01:21:59,830
bottom part why driven right now say
primary expression we now have two kinds
2718
01:21:59,830 --> 01:21:59,840
primary expression we now have two kinds
2719
01:21:59,840 --> 01:22:02,730
primary expression we now have two kinds
that we can expect we can say if current
2720
01:22:02,730 --> 01:22:02,740
that we can expect we can say if current
2721
01:22:02,740 --> 01:22:11,610
that we can expect we can say if current
kind equals send kind left sorry open
2722
01:22:11,610 --> 01:22:11,620
kind equals send kind left sorry open
2723
01:22:11,620 --> 01:22:17,010
kind equals send kind left sorry open
parentheses token then I would say var
2724
01:22:17,010 --> 01:22:17,020
parentheses token then I would say var
2725
01:22:17,020 --> 01:22:24,450
parentheses token then I would say var
left equals next token then I save our
2726
01:22:24,450 --> 01:22:24,460
left equals next token then I save our
2727
01:22:24,460 --> 01:22:29,260
left equals next token then I save our
expression equals parse this is one of
2728
01:22:29,260 --> 01:22:29,270
expression equals parse this is one of
2729
01:22:29,270 --> 01:22:30,190
expression equals parse this is one of
those things where you want to have
2730
01:22:30,190 --> 01:22:30,200
those things where you want to have
2731
01:22:30,200 --> 01:22:31,480
those things where you want to have
helper method so you don't have to
2732
01:22:31,480 --> 01:22:31,490
helper method so you don't have to
2733
01:22:31,490 --> 01:22:33,580
helper method so you don't have to
understand the structure of your stuff
2734
01:22:33,580 --> 01:22:33,590
understand the structure of your stuff
2735
01:22:33,590 --> 01:22:35,620
understand the structure of your stuff
so what we would do is it would just
2736
01:22:35,620 --> 01:22:35,630
so what we would do is it would just
2737
01:22:35,630 --> 01:22:40,050
so what we would do is it would just
have a private message private
2738
01:22:40,050 --> 01:22:40,060
have a private message private
2739
01:22:40,060 --> 01:22:46,170
have a private message private
expression subjects parse expression and
2740
01:22:46,170 --> 01:22:46,180
expression subjects parse expression and
2741
01:22:46,180 --> 01:22:52,090
expression subjects parse expression and
that just says return parse turn so you
2742
01:22:52,090 --> 01:22:52,100
that just says return parse turn so you
2743
01:22:52,100 --> 01:22:53,620
that just says return parse turn so you
have sensible names you don't have to
2744
01:22:53,620 --> 01:22:53,630
have sensible names you don't have to
2745
01:22:53,630 --> 01:22:56,980
have sensible names you don't have to
remember this thread the structure and
2746
01:22:56,980 --> 01:22:56,990
remember this thread the structure and
2747
01:22:56,990 --> 01:22:59,280
remember this thread the structure and
we can say this is part expression and
2748
01:22:59,280 --> 01:22:59,290
we can say this is part expression and
2749
01:22:59,290 --> 01:23:07,710
we can say this is part expression and
then I can say bar write is match for
2750
01:23:07,710 --> 01:23:07,720
then I can say bar write is match for
2751
01:23:07,720 --> 01:23:12,150
then I can say bar write is match for
syntax kind close parenthesis children
2752
01:23:12,150 --> 01:23:12,160
syntax kind close parenthesis children
2753
01:23:12,160 --> 01:23:17,850
syntax kind close parenthesis children
let me say we return a new parenthesis
2754
01:23:17,850 --> 01:23:17,860
let me say we return a new parenthesis
2755
01:23:17,860 --> 01:23:20,970
let me say we return a new parenthesis
this sized expression which is left
2756
01:23:20,970 --> 01:23:20,980
this sized expression which is left
2757
01:23:20,980 --> 01:23:31,690
this sized expression which is left
expression and write does that own it
2758
01:23:31,690 --> 01:23:31,700
expression and write does that own it
2759
01:23:31,700 --> 01:23:36,780
expression and write does that own it
let's find out so now let's say we do 1
2760
01:23:36,780 --> 01:23:36,790
let's find out so now let's say we do 1
2761
01:23:36,790 --> 01:23:43,600
let's find out so now let's say we do 1
plus 2 times 3 right and I think I
2762
01:23:43,600 --> 01:23:43,610
plus 2 times 3 right and I think I
2763
01:23:43,610 --> 01:23:47,640
plus 2 times 3 right and I think I
crashed
2764
01:23:47,640 --> 01:23:47,650
2765
01:23:47,650 --> 01:23:55,960
2766
01:23:55,960 --> 01:23:55,970
so let's attach a debugger 1 plus 2
2767
01:23:55,970 --> 01:24:00,510
so let's attach a debugger 1 plus 2
times 3 oh I know what the problem is
2768
01:24:00,510 --> 01:24:00,520
times 3 oh I know what the problem is
2769
01:24:00,520 --> 01:24:03,550
times 3 oh I know what the problem is
look it's disk right here so we haven't
2770
01:24:03,550 --> 01:24:03,560
look it's disk right here so we haven't
2771
01:24:03,560 --> 01:24:07,600
look it's disk right here so we haven't
handled our note in the evaluator so if
2772
01:24:07,600 --> 01:24:07,610
handled our note in the evaluator so if
2773
01:24:07,610 --> 01:24:10,720
handled our note in the evaluator so if
note is parenthesized expression syntax
2774
01:24:10,720 --> 01:24:10,730
note is parenthesized expression syntax
2775
01:24:10,730 --> 01:24:14,130
note is parenthesized expression syntax
p in that case it is just return
2776
01:24:14,130 --> 01:24:14,140
p in that case it is just return
2777
01:24:14,140 --> 01:24:20,100
p in that case it is just return
evaluate expression for p dot expression
2778
01:24:20,100 --> 01:24:20,110
evaluate expression for p dot expression
2779
01:24:20,110 --> 01:24:22,600
evaluate expression for p dot expression
right because parenthesized expressions
2780
01:24:22,600 --> 01:24:22,610
right because parenthesized expressions
2781
01:24:22,610 --> 01:24:26,440
right because parenthesized expressions
are just you just evaluate the child of
2782
01:24:26,440 --> 01:24:26,450
are just you just evaluate the child of
2783
01:24:26,450 --> 01:24:29,550
are just you just evaluate the child of
it so now let's do this again 1 plus 2
2784
01:24:29,550 --> 01:24:29,560
it so now let's do this again 1 plus 2
2785
01:24:29,560 --> 01:24:34,810
it so now let's do this again 1 plus 2
times 3 and it's 9 because yes we first
2786
01:24:34,810 --> 01:24:34,820
times 3 and it's 9 because yes we first
2787
01:24:34,820 --> 01:24:36,820
times 3 and it's 9 because yes we first
do this which is 3 and then times 3 and
2788
01:24:36,820 --> 01:24:36,830
do this which is 3 and then times 3 and
2789
01:24:36,830 --> 01:24:40,120
do this which is 3 and then times 3 and
so we have the proper note structure
2790
01:24:40,120 --> 01:24:40,130
so we have the proper note structure
2791
01:24:40,130 --> 01:24:42,550
so we have the proper note structure
here so what I also want to show here
2792
01:24:42,550 --> 01:24:42,560
here so what I also want to show here
2793
01:24:42,560 --> 01:24:45,010
here so what I also want to show here
right now is if I say 1 plus 2 and I
2794
01:24:45,010 --> 01:24:45,020
right now is if I say 1 plus 2 and I
2795
01:24:45,020 --> 01:24:48,520
right now is if I say 1 plus 2 and I
don't provide a closing parenthesis we
2796
01:24:48,520 --> 01:24:48,530
don't provide a closing parenthesis we
2797
01:24:48,530 --> 01:24:50,650
don't provide a closing parenthesis we
manufactured one here right so that's a
2798
01:24:50,650 --> 01:24:50,660
manufactured one here right so that's a
2799
01:24:50,660 --> 01:24:53,020
manufactured one here right so that's a
closed parenthesis token here that we
2800
01:24:53,020 --> 01:24:53,030
closed parenthesis token here that we
2801
01:24:53,030 --> 01:24:54,580
closed parenthesis token here that we
edited the tree so what's nice is that
2802
01:24:54,580 --> 01:24:54,590
edited the tree so what's nice is that
2803
01:24:54,590 --> 01:24:57,070
edited the tree so what's nice is that
when you when you process your trees you
2804
01:24:57,070 --> 01:24:57,080
when you when you process your trees you
2805
01:24:57,080 --> 01:24:58,990
when you when you process your trees you
don't have to deal with my reference
2806
01:24:58,990 --> 01:24:59,000
don't have to deal with my reference
2807
01:24:59,000 --> 01:25:01,060
don't have to deal with my reference
exceptions for for parts of the tree
2808
01:25:01,060 --> 01:25:01,070
exceptions for for parts of the tree
2809
01:25:01,070 --> 01:25:04,060
exceptions for for parts of the tree
that you that you just don't have right
2810
01:25:04,060 --> 01:25:04,070
that you that you just don't have right
2811
01:25:04,070 --> 01:25:07,300
that you that you just don't have right
so the the idea there is that you just
2812
01:25:07,300 --> 01:25:07,310
so the the idea there is that you just
2813
01:25:07,310 --> 01:25:09,190
so the the idea there is that you just
have synthesized tokens for that and you
2814
01:25:09,190 --> 01:25:09,200
have synthesized tokens for that and you
2815
01:25:09,200 --> 01:25:10,600
have synthesized tokens for that and you
just rely on the fact that you have
2816
01:25:10,600 --> 01:25:10,610
just rely on the fact that you have
2817
01:25:10,610 --> 01:25:13,810
just rely on the fact that you have
reported errors for those and then this
2818
01:25:13,810 --> 01:25:13,820
reported errors for those and then this
2819
01:25:13,820 --> 01:25:17,170
reported errors for those and then this
way things tend to work much better now
2820
01:25:17,170 --> 01:25:17,180
way things tend to work much better now
2821
01:25:17,180 --> 01:25:19,380
way things tend to work much better now
the downside of inserting tokens is that
2822
01:25:19,380 --> 01:25:19,390
the downside of inserting tokens is that
2823
01:25:19,390 --> 01:25:21,700
the downside of inserting tokens is that
you have to be careful how you structure
2824
01:25:21,700 --> 01:25:21,710
you have to be careful how you structure
2825
01:25:21,710 --> 01:25:25,180
you have to be careful how you structure
the parser because when you insert
2826
01:25:25,180 --> 01:25:25,190
the parser because when you insert
2827
01:25:25,190 --> 01:25:26,500
the parser because when you insert
tokens you might end up in loop
2828
01:25:26,500 --> 01:25:26,510
tokens you might end up in loop
2829
01:25:26,510 --> 01:25:27,730
tokens you might end up in loop
situations where you keep inserting
2830
01:25:27,730 --> 01:25:27,740
situations where you keep inserting
2831
01:25:27,740 --> 01:25:29,590
situations where you keep inserting
tokens and keep inserting tokens and you
2832
01:25:29,590 --> 01:25:29,600
tokens and keep inserting tokens and you
2833
01:25:29,600 --> 01:25:29,930
tokens and keep inserting tokens and you
never
2834
01:25:29,930 --> 01:25:29,940
never
2835
01:25:29,940 --> 01:25:31,900
never
you need to be very careful that you
2836
01:25:31,900 --> 01:25:31,910
you need to be very careful that you
2837
01:25:31,910 --> 01:25:34,220
you need to be very careful that you
ride your purse on such a way you always
2838
01:25:34,220 --> 01:25:34,230
ride your purse on such a way you always
2839
01:25:34,230 --> 01:25:37,220
ride your purse on such a way you always
consume tokens so that eventually you
2840
01:25:37,220 --> 01:25:37,230
consume tokens so that eventually you
2841
01:25:37,230 --> 01:25:38,959
consume tokens so that eventually you
will hit the end of file to open and
2842
01:25:38,959 --> 01:25:38,969
will hit the end of file to open and
2843
01:25:38,969 --> 01:25:41,050
will hit the end of file to open and
your parser terminates otherwise you
2844
01:25:41,050 --> 01:25:41,060
your parser terminates otherwise you
2845
01:25:41,060 --> 01:25:44,120
your parser terminates otherwise you
will create a lot of memory and nothing
2846
01:25:44,120 --> 01:25:44,130
will create a lot of memory and nothing
2847
01:25:44,130 --> 01:25:49,970
will create a lot of memory and nothing
happens all right so this one I think so
2848
01:25:49,970 --> 01:25:49,980
happens all right so this one I think so
2849
01:25:49,980 --> 01:25:51,320
happens all right so this one I think so
far so good
2850
01:25:51,320 --> 01:25:51,330
far so good
2851
01:25:51,330 --> 01:25:52,880
far so good
the one thing I would like to add in our
2852
01:25:52,880 --> 01:25:52,890
the one thing I would like to add in our
2853
01:25:52,890 --> 01:26:01,450
the one thing I would like to add in our
repple just forget shits and giggles is
2854
01:26:01,450 --> 01:26:01,460
2855
01:26:01,460 --> 01:26:04,100
2856
01:26:04,100 --> 01:26:04,110
yeah make the make the API is a little
2857
01:26:04,110 --> 01:26:06,950
yeah make the make the API is a little
bit nicer so for example we don't really
2858
01:26:06,950 --> 01:26:06,960
bit nicer so for example we don't really
2859
01:26:06,960 --> 01:26:08,390
bit nicer so for example we don't really
want to deal with the lexer and the
2860
01:26:08,390 --> 01:26:08,400
want to deal with the lexer and the
2861
01:26:08,400 --> 01:26:11,870
want to deal with the lexer and the
parser anyway realistically because what
2862
01:26:11,870 --> 01:26:11,880
parser anyway realistically because what
2863
01:26:11,880 --> 01:26:13,760
parser anyway realistically because what
we operate on is the syntax tree right
2864
01:26:13,760 --> 01:26:13,770
we operate on is the syntax tree right
2865
01:26:13,770 --> 01:26:15,200
we operate on is the syntax tree right
so what we can do is we can just have a
2866
01:26:15,200 --> 01:26:15,210
so what we can do is we can just have a
2867
01:26:15,210 --> 01:26:19,810
so what we can do is we can just have a
message here public static syntax tree
2868
01:26:19,810 --> 01:26:19,820
message here public static syntax tree
2869
01:26:19,820 --> 01:26:23,840
message here public static syntax tree
parse and we can just say give a text
2870
01:26:23,840 --> 01:26:23,850
parse and we can just say give a text
2871
01:26:23,850 --> 01:26:29,290
parse and we can just say give a text
and then we can just do our parser
2872
01:26:29,290 --> 01:26:29,300
and then we can just do our parser
2873
01:26:29,300 --> 01:26:33,860
and then we can just do our parser
equals new parser for the text and then
2874
01:26:33,860 --> 01:26:33,870
equals new parser for the text and then
2875
01:26:33,870 --> 01:26:42,800
equals new parser for the text and then
we can say return parser thought parse
2876
01:26:42,800 --> 01:26:42,810
we can say return parser thought parse
2877
01:26:42,810 --> 01:26:48,530
we can say return parser thought parse
and it makes the api's I don't know not
2878
01:26:48,530 --> 01:26:48,540
and it makes the api's I don't know not
2879
01:26:48,540 --> 01:26:52,070
and it makes the api's I don't know not
a whole lot cooler but I know I like
2880
01:26:52,070 --> 01:26:52,080
a whole lot cooler but I know I like
2881
01:26:52,080 --> 01:26:55,850
a whole lot cooler but I know I like
this one a lot more than having to deal
2882
01:26:55,850 --> 01:26:55,860
this one a lot more than having to deal
2883
01:26:55,860 --> 01:26:59,600
this one a lot more than having to deal
with the parser it also beats slightly
2884
01:26:59,600 --> 01:26:59,610
with the parser it also beats slightly
2885
01:26:59,610 --> 01:27:01,550
with the parser it also beats slightly
more logical subjects tree dot parse you
2886
01:27:01,550 --> 01:27:01,560
more logical subjects tree dot parse you
2887
01:27:01,560 --> 01:27:03,410
more logical subjects tree dot parse you
get back a subjects tree right seems
2888
01:27:03,410 --> 01:27:03,420
get back a subjects tree right seems
2889
01:27:03,420 --> 01:27:09,170
get back a subjects tree right seems
reasonable yeah so the done thing I
2890
01:27:09,170 --> 01:27:09,180
reasonable yeah so the done thing I
2891
01:27:09,180 --> 01:27:12,650
reasonable yeah so the done thing I
would like to add here is some pseudo
2892
01:27:12,650 --> 01:27:12,660
would like to add here is some pseudo
2893
01:27:12,660 --> 01:27:18,620
would like to add here is some pseudo
commands so we could say if line equals
2894
01:27:18,620 --> 01:27:18,630
2895
01:27:18,630 --> 01:27:26,770
2896
01:27:26,770 --> 01:27:26,780
so tree first of all we say continue
2897
01:27:26,780 --> 01:27:29,030
so tree first of all we say continue
more importantly let's have aesthetic
2898
01:27:29,030 --> 01:27:29,040
more importantly let's have aesthetic
2899
01:27:29,040 --> 01:27:32,510
more importantly let's have aesthetic
here actually doesn't have to be static
2900
01:27:32,510 --> 01:27:32,520
here actually doesn't have to be static
2901
01:27:32,520 --> 01:27:40,520
here actually doesn't have to be static
volume bull show tree falls I'd say and
2902
01:27:40,520 --> 01:27:40,530
volume bull show tree falls I'd say and
2903
01:27:40,530 --> 01:27:44,629
volume bull show tree falls I'd say and
then we can say show tree equals not
2904
01:27:44,629 --> 01:27:44,639
then we can say show tree equals not
2905
01:27:44,639 --> 01:27:51,709
then we can say show tree equals not
show tree and then we can say console
2906
01:27:51,709 --> 01:27:51,719
show tree and then we can say console
2907
01:27:51,719 --> 01:28:01,939
show tree and then we can say console
dot write line show tree showing parse
2908
01:28:01,939 --> 01:28:01,949
dot write line show tree showing parse
2909
01:28:01,949 --> 01:28:05,050
dot write line show tree showing parse
trees
2910
01:28:05,050 --> 01:28:05,060
2911
01:28:05,060 --> 01:28:11,550
2912
01:28:11,550 --> 01:28:11,560
otherwise not showing past phrase
2913
01:28:11,560 --> 01:28:15,480
otherwise not showing past phrase
so this way everyone our thing it looks
2914
01:28:15,480 --> 01:28:15,490
so this way everyone our thing it looks
2915
01:28:15,490 --> 01:28:21,540
so this way everyone our thing it looks
a little bit cleaner oh yeah it helps if
2916
01:28:21,540 --> 01:28:21,550
a little bit cleaner oh yeah it helps if
2917
01:28:21,550 --> 01:28:23,640
a little bit cleaner oh yeah it helps if
we actually handle that thing - where's
2918
01:28:23,640 --> 01:28:23,650
we actually handle that thing - where's
2919
01:28:23,650 --> 01:28:30,570
we actually handle that thing - where's
the pretty print here if show tree do
2920
01:28:30,570 --> 01:28:30,580
the pretty print here if show tree do
2921
01:28:30,580 --> 01:28:39,990
the pretty print here if show tree do
that otherwise don't do that I guess you
2922
01:28:39,990 --> 01:28:40,000
that otherwise don't do that I guess you
2923
01:28:40,000 --> 01:28:46,410
that otherwise don't do that I guess you
need to do that here now as well
2924
01:28:46,410 --> 01:28:46,420
2925
01:28:46,420 --> 01:28:50,430
2926
01:28:50,430 --> 01:28:50,440
you can sell one close to you get a
2927
01:28:50,440 --> 01:28:57,000
you can sell one close to you get a
result I can say show T samples - I get
2928
01:28:57,000 --> 01:28:57,010
result I can say show T samples - I get
2929
01:28:57,010 --> 01:28:59,189
result I can say show T samples - I get
the treat so this way we have some
2930
01:28:59,189 --> 01:28:59,199
the treat so this way we have some
2931
01:28:59,199 --> 01:29:05,010
the treat so this way we have some
diagnostic information without without
2932
01:29:05,010 --> 01:29:05,020
diagnostic information without without
2933
01:29:05,020 --> 01:29:06,330
diagnostic information without without
anything and then I think the other one
2934
01:29:06,330 --> 01:29:06,340
anything and then I think the other one
2935
01:29:06,340 --> 01:29:15,439
anything and then I think the other one
that I probably want out of line equals
2936
01:29:15,439 --> 01:29:15,449
that I probably want out of line equals
2937
01:29:15,449 --> 01:29:24,239
that I probably want out of line equals
CLS they say console dot clear
2938
01:29:24,239 --> 01:29:24,249
2939
01:29:24,249 --> 01:29:30,129
2940
01:29:30,129 --> 01:29:30,139
2941
01:29:30,139 --> 01:29:35,140
2942
01:29:35,140 --> 01:29:35,150
2943
01:29:35,150 --> 01:29:37,180
2944
01:29:37,180 --> 01:29:37,190
have a little bit nicer as far as the
2945
01:29:37,190 --> 01:29:38,140
have a little bit nicer as far as the
console is concerned
2946
01:29:38,140 --> 01:29:38,150
console is concerned
2947
01:29:38,150 --> 01:29:42,010
console is concerned
alright so I think we now have at least
2948
01:29:42,010 --> 01:29:42,020
alright so I think we now have at least
2949
01:29:42,020 --> 01:29:44,470
alright so I think we now have at least
a ripple that kind of sort of works for
2950
01:29:44,470 --> 01:29:44,480
a ripple that kind of sort of works for
2951
01:29:44,480 --> 01:29:46,570
a ripple that kind of sort of works for
us now let's quickly look at the project
2952
01:29:46,570 --> 01:29:46,580
us now let's quickly look at the project
2953
01:29:46,580 --> 01:29:47,740
us now let's quickly look at the project
structure that you have so far because
2954
01:29:47,740 --> 01:29:47,750
structure that you have so far because
2955
01:29:47,750 --> 01:29:49,090
structure that you have so far because
right now everything is in one giant
2956
01:29:49,090 --> 01:29:49,100
right now everything is in one giant
2957
01:29:49,100 --> 01:29:51,550
right now everything is in one giant
file which I know some people prefer
2958
01:29:51,550 --> 01:29:51,560
file which I know some people prefer
2959
01:29:51,560 --> 01:29:53,770
file which I know some people prefer
everything in one giant file I am NOT
2960
01:29:53,770 --> 01:29:53,780
everything in one giant file I am NOT
2961
01:29:53,780 --> 01:29:55,030
everything in one giant file I am NOT
one of those people because it makes
2962
01:29:55,030 --> 01:29:55,040
one of those people because it makes
2963
01:29:55,040 --> 01:29:59,350
one of those people because it makes
version control pretty ugly first thing
2964
01:29:59,350 --> 01:29:59,360
version control pretty ugly first thing
2965
01:29:59,360 --> 01:30:00,730
version control pretty ugly first thing
is the texture we name our namespace
2966
01:30:00,730 --> 01:30:00,740
is the texture we name our namespace
2967
01:30:00,740 --> 01:30:05,500
is the texture we name our namespace
here into Minsk let me create a folder
2968
01:30:05,500 --> 01:30:05,510
here into Minsk let me create a folder
2969
01:30:05,510 --> 01:30:10,920
here into Minsk let me create a folder
here which I will call code analysis and
2970
01:30:10,920 --> 01:30:10,930
here which I will call code analysis and
2971
01:30:10,930 --> 01:30:13,720
here which I will call code analysis and
yes if you have ever used was nine there
2972
01:30:13,720 --> 01:30:13,730
yes if you have ever used was nine there
2973
01:30:13,730 --> 01:30:16,120
yes if you have ever used was nine there
wasn't a P is the ones that are just
2974
01:30:16,120 --> 01:30:16,130
wasn't a P is the ones that are just
2975
01:30:16,130 --> 01:30:17,830
wasn't a P is the ones that are just
produced will look very familiar
2976
01:30:17,830 --> 01:30:17,840
produced will look very familiar
2977
01:30:17,840 --> 01:30:21,160
produced will look very familiar
let's just say so let me just add a new
2978
01:30:21,160 --> 01:30:21,170
let's just say so let me just add a new
2979
01:30:21,170 --> 01:30:27,540
let's just say so let me just add a new
file here stuff dot CS and let me take
2980
01:30:27,540 --> 01:30:27,550
file here stuff dot CS and let me take
2981
01:30:27,550 --> 01:30:33,430
file here stuff dot CS and let me take
everything we just built and put it into
2982
01:30:33,430 --> 01:30:33,440
everything we just built and put it into
2983
01:30:33,440 --> 01:30:41,020
everything we just built and put it into
an in space min starts code analysis and
2984
01:30:41,020 --> 01:30:41,030
an in space min starts code analysis and
2985
01:30:41,030 --> 01:30:43,810
an in space min starts code analysis and
put the stuff in here now of course we
2986
01:30:43,810 --> 01:30:43,820
put the stuff in here now of course we
2987
01:30:43,820 --> 01:30:55,549
put the stuff in here now of course we
need a ton of usings
2988
01:30:55,549 --> 01:30:55,559
2989
01:30:55,559 --> 01:30:58,619
2990
01:30:58,619 --> 01:30:58,629
and now I can just move these guys to
2991
01:30:58,629 --> 01:31:00,779
and now I can just move these guys to
separate files so let's just go this one
2992
01:31:00,779 --> 01:31:00,789
separate files so let's just go this one
2993
01:31:00,789 --> 01:31:16,099
separate files so let's just go this one
to this file to type move type type type
2994
01:31:16,099 --> 01:31:16,109
2995
01:31:16,109 --> 01:31:20,810
2996
01:31:20,810 --> 01:31:20,820
2997
01:31:20,820 --> 01:31:23,579
2998
01:31:23,579 --> 01:31:23,589
actually let me do a save all for now
2999
01:31:23,589 --> 01:31:26,819
actually let me do a save all for now
because I cannot deal with that many
3000
01:31:26,819 --> 01:31:26,829
because I cannot deal with that many
3001
01:31:26,829 --> 01:31:33,949
because I cannot deal with that many
open windows all right let's keep doing
3002
01:31:33,949 --> 01:31:33,959
open windows all right let's keep doing
3003
01:31:33,959 --> 01:31:45,029
open windows all right let's keep doing
overtime type move type I know this is
3004
01:31:45,029 --> 01:31:45,039
overtime type move type I know this is
3005
01:31:45,039 --> 01:31:53,029
overtime type move type I know this is
last one so let's just rename the file
3006
01:31:53,029 --> 01:31:53,039
3007
01:31:53,039 --> 01:31:58,229
3008
01:31:58,229 --> 01:31:58,239
all right then I guess here we can just
3009
01:31:58,239 --> 01:32:01,549
all right then I guess here we can just
take the delete hmm
3010
01:32:01,549 --> 01:32:01,559
take the delete hmm
3011
01:32:01,559 --> 01:32:04,319
take the delete hmm
what we select everything again that
3012
01:32:04,319 --> 01:32:04,329
what we select everything again that
3013
01:32:04,329 --> 01:32:09,419
what we select everything again that
also works don't wanna try to using for
3014
01:32:09,419 --> 01:32:09,429
also works don't wanna try to using for
3015
01:32:09,429 --> 01:32:15,439
also works don't wanna try to using for
code analysis and booyah now we have
3016
01:32:15,439 --> 01:32:15,449
code analysis and booyah now we have
3017
01:32:15,449 --> 01:32:18,509
code analysis and booyah now we have
just our pretty print and the repple in
3018
01:32:18,509 --> 01:32:18,519
just our pretty print and the repple in
3019
01:32:18,519 --> 01:32:20,599
just our pretty print and the repple in
here and everything else is neatly
3020
01:32:20,599 --> 01:32:20,609
here and everything else is neatly
3021
01:32:20,609 --> 01:32:26,899
here and everything else is neatly
distributed in a bunch of smaller files
3022
01:32:26,899 --> 01:32:26,909
3023
01:32:26,909 --> 01:32:30,779
3024
01:32:30,779 --> 01:32:30,789
I'd say I'm at this point so far quite
3025
01:32:30,789 --> 01:32:36,540
I'd say I'm at this point so far quite
happy with the result now let me
3026
01:32:36,540 --> 01:32:36,550
happy with the result now let me
3027
01:32:36,550 --> 01:32:38,069
happy with the result now let me
actually because I haven't done this in
3028
01:32:38,069 --> 01:32:38,079
actually because I haven't done this in
3029
01:32:38,079 --> 01:32:39,719
actually because I haven't done this in
a while look over the questions that
3030
01:32:39,719 --> 01:32:39,729
a while look over the questions that
3031
01:32:39,729 --> 01:32:52,200
a while look over the questions that
I've gone what do we have
3032
01:32:52,200 --> 01:32:52,210
3033
01:32:52,210 --> 01:32:58,480
3034
01:32:58,480 --> 01:32:58,490
3035
01:32:58,490 --> 01:33:02,740
3036
01:33:02,740 --> 01:33:02,750
so both of the questions were related to
3037
01:33:02,750 --> 01:33:04,630
so both of the questions were related to
what language are we using it very
3038
01:33:04,630 --> 01:33:04,640
what language are we using it very
3039
01:33:04,640 --> 01:33:12,370
what language are we using it very
answered yeah so some person asked why
3040
01:33:12,370 --> 01:33:12,380
answered yeah so some person asked why
3041
01:33:12,380 --> 01:33:16,210
answered yeah so some person asked why
do we duplicate the note information in
3042
01:33:16,210 --> 01:33:16,220
do we duplicate the note information in
3043
01:33:16,220 --> 01:33:19,690
do we duplicate the note information in
an enum and the class hierarchy so right
3044
01:33:19,690 --> 01:33:19,700
an enum and the class hierarchy so right
3045
01:33:19,700 --> 01:33:21,580
an enum and the class hierarchy so right
now what I what I have done here is I
3046
01:33:21,580 --> 01:33:21,590
now what I what I have done here is I
3047
01:33:21,590 --> 01:33:23,530
now what I what I have done here is I
have cheated a lot right I've done a lot
3048
01:33:23,530 --> 01:33:23,540
have cheated a lot right I've done a lot
3049
01:33:23,540 --> 01:33:25,210
have cheated a lot right I've done a lot
of instance checking so if you look at
3050
01:33:25,210 --> 01:33:25,220
of instance checking so if you look at
3051
01:33:25,220 --> 01:33:29,020
of instance checking so if you look at
the evaluator for example we just
3052
01:33:29,020 --> 01:33:29,030
the evaluator for example we just
3053
01:33:29,030 --> 01:33:31,350
the evaluator for example we just
quickly see where that guy is now here
3054
01:33:31,350 --> 01:33:31,360
quickly see where that guy is now here
3055
01:33:31,360 --> 01:33:33,850
quickly see where that guy is now here
we just do this Rd basically just say
3056
01:33:33,850 --> 01:33:33,860
we just do this Rd basically just say
3057
01:33:33,860 --> 01:33:37,540
we just do this Rd basically just say
you know if this if this instance is
3058
01:33:37,540 --> 01:33:37,550
you know if this if this instance is
3059
01:33:37,550 --> 01:33:38,950
you know if this if this instance is
this instance here and now with the new
3060
01:33:38,950 --> 01:33:38,960
this instance here and now with the new
3061
01:33:38,960 --> 01:33:40,660
this instance here and now with the new
c-sharp pattern matching is actually
3062
01:33:40,660 --> 01:33:40,670
c-sharp pattern matching is actually
3063
01:33:40,670 --> 01:33:42,310
c-sharp pattern matching is actually
pretty concise you can just do that but
3064
01:33:42,310 --> 01:33:42,320
pretty concise you can just do that but
3065
01:33:42,320 --> 01:33:44,110
pretty concise you can just do that but
for the most part you really want is you
3066
01:33:44,110 --> 01:33:44,120
for the most part you really want is you
3067
01:33:44,120 --> 01:33:45,700
for the most part you really want is you
want a switch statement because that is
3068
01:33:45,700 --> 01:33:45,710
want a switch statement because that is
3069
01:33:45,710 --> 01:33:47,500
want a switch statement because that is
just much more efficient especially when
3070
01:33:47,500 --> 01:33:47,510
just much more efficient especially when
3071
01:33:47,510 --> 01:33:51,130
just much more efficient especially when
you walk larger trees these things are
3072
01:33:51,130 --> 01:33:51,140
you walk larger trees these things are
3073
01:33:51,140 --> 01:33:52,840
you walk larger trees these things are
much much cheaper because what you do is
3074
01:33:52,840 --> 01:33:52,850
much much cheaper because what you do is
3075
01:33:52,850 --> 01:33:54,550
much much cheaper because what you do is
you basically ask the instance give me
3076
01:33:54,550 --> 01:33:54,560
you basically ask the instance give me
3077
01:33:54,560 --> 01:33:56,470
you basically ask the instance give me
an int which is you know the enum value
3078
01:33:56,470 --> 01:33:56,480
an int which is you know the enum value
3079
01:33:56,480 --> 01:33:58,270
an int which is you know the enum value
and then the switch statement is just a
3080
01:33:58,270 --> 01:33:58,280
and then the switch statement is just a
3081
01:33:58,280 --> 01:33:59,830
and then the switch statement is just a
jump table that directly dispatches to
3082
01:33:59,830 --> 01:33:59,840
jump table that directly dispatches to
3083
01:33:59,840 --> 01:34:01,420
jump table that directly dispatches to
the to the block and then you have of
3084
01:34:01,420 --> 01:34:01,430
the to the block and then you have of
3085
01:34:01,430 --> 01:34:03,880
the to the block and then you have of
course the cost still occurring in that
3086
01:34:03,880 --> 01:34:03,890
course the cost still occurring in that
3087
01:34:03,890 --> 01:34:05,350
course the cost still occurring in that
in their block but you only have one
3088
01:34:05,350 --> 01:34:05,360
in their block but you only have one
3089
01:34:05,360 --> 01:34:08,110
in their block but you only have one
cost as opposed to you try this one no
3090
01:34:08,110 --> 01:34:08,120
cost as opposed to you try this one no
3091
01:34:08,120 --> 01:34:10,450
cost as opposed to you try this one no
you try this one nope you try this one
3092
01:34:10,450 --> 01:34:10,460
you try this one nope you try this one
3093
01:34:10,460 --> 01:34:13,450
you try this one nope you try this one
nopes we do a plenty of costs before you
3094
01:34:13,450 --> 01:34:13,460
nopes we do a plenty of costs before you
3095
01:34:13,460 --> 01:34:14,710
nopes we do a plenty of costs before you
actually find the object so instead of
3096
01:34:14,710 --> 01:34:14,720
actually find the object so instead of
3097
01:34:14,720 --> 01:34:16,420
actually find the object so instead of
doing this you just directly jump to the
3098
01:34:16,420 --> 01:34:16,430
doing this you just directly jump to the
3099
01:34:16,430 --> 01:34:18,460
doing this you just directly jump to the
corresponding code block for three or
3100
01:34:18,460 --> 01:34:18,470
corresponding code block for three or
3101
01:34:18,470 --> 01:34:20,170
corresponding code block for three or
four instances like we have here no
3102
01:34:20,170 --> 01:34:20,180
four instances like we have here no
3103
01:34:20,180 --> 01:34:22,540
four instances like we have here no
point but I wanted to set the pattern
3104
01:34:22,540 --> 01:34:22,550
point but I wanted to set the pattern
3105
01:34:22,550 --> 01:34:25,570
point but I wanted to set the pattern
already so that we don't have to
3106
01:34:25,570 --> 01:34:25,580
already so that we don't have to
3107
01:34:25,580 --> 01:34:32,110
already so that we don't have to
duplicate so much information later yep
3108
01:34:32,110 --> 01:34:32,120
duplicate so much information later yep
3109
01:34:32,120 --> 01:34:33,490
duplicate so much information later yep
somebody says you could do different no
3110
01:34:33,490 --> 01:34:33,500
somebody says you could do different no
3111
01:34:33,500 --> 01:34:35,320
somebody says you could do different no
colors for the output that's actually
3112
01:34:35,320 --> 01:34:35,330
colors for the output that's actually
3113
01:34:35,330 --> 01:34:38,700
colors for the output that's actually
good idea we should probably do that
3114
01:34:38,700 --> 01:34:38,710
3115
01:34:38,710 --> 01:34:42,580
3116
01:34:42,580 --> 01:34:42,590
any plan writing a new CLR that will be
3117
01:34:42,590 --> 01:34:45,010
any plan writing a new CLR that will be
a lot of work right he new CLR a new
3118
01:34:45,010 --> 01:34:45,020
a lot of work right he new CLR a new
3119
01:34:45,020 --> 01:34:46,480
a lot of work right he new CLR a new
language for the CLR might actually be
3120
01:34:46,480 --> 01:34:46,490
language for the CLR might actually be
3121
01:34:46,490 --> 01:34:51,130
language for the CLR might actually be
something in fact that's what we do here
3122
01:34:51,130 --> 01:34:51,140
something in fact that's what we do here
3123
01:34:51,140 --> 01:34:54,940
something in fact that's what we do here
might be compiled onto il and that's
3124
01:34:54,940 --> 01:34:54,950
might be compiled onto il and that's
3125
01:34:54,950 --> 01:35:02,560
might be compiled onto il and that's
basically new language yeah somebody
3126
01:35:02,560 --> 01:35:02,570
basically new language yeah somebody
3127
01:35:02,570 --> 01:35:04,330
basically new language yeah somebody
mentioned lob em I have tried LLVM
3128
01:35:04,330 --> 01:35:04,340
mentioned lob em I have tried LLVM
3129
01:35:04,340 --> 01:35:06,640
mentioned lob em I have tried LLVM
before I've not succeeded yet in getting
3130
01:35:06,640 --> 01:35:06,650
before I've not succeeded yet in getting
3131
01:35:06,650 --> 01:35:09,100
before I've not succeeded yet in getting
my back-end up and running on a VM but
3132
01:35:09,100 --> 01:35:09,110
my back-end up and running on a VM but
3133
01:35:09,110 --> 01:35:10,210
my back-end up and running on a VM but
it is something I would like to look
3134
01:35:10,210 --> 01:35:10,220
it is something I would like to look
3135
01:35:10,220 --> 01:35:12,400
it is something I would like to look
into because my language is you saw
3136
01:35:12,400 --> 01:35:12,410
into because my language is you saw
3137
01:35:12,410 --> 01:35:13,600
into because my language is you saw
doesn't really deal with object
3138
01:35:13,600 --> 01:35:13,610
doesn't really deal with object
3139
01:35:13,610 --> 01:35:15,970
doesn't really deal with object
allocations so it should be fairly
3140
01:35:15,970 --> 01:35:15,980
allocations so it should be fairly
3141
01:35:15,980 --> 01:35:18,100
allocations so it should be fairly
straightforward to to take the language
3142
01:35:18,100 --> 01:35:18,110
straightforward to to take the language
3143
01:35:18,110 --> 01:35:20,170
straightforward to to take the language
subset that I have and omit actually
3144
01:35:20,170 --> 01:35:20,180
subset that I have and omit actually
3145
01:35:20,180 --> 01:35:22,990
subset that I have and omit actually
native code for that might make the
3146
01:35:22,990 --> 01:35:23,000
native code for that might make the
3147
01:35:23,000 --> 01:35:31,060
native code for that might make the
debugging a lot harder though yeah so
3148
01:35:31,060 --> 01:35:31,070
debugging a lot harder though yeah so
3149
01:35:31,070 --> 01:35:32,650
debugging a lot harder though yeah so
somebody suggests maybe we should have
3150
01:35:32,650 --> 01:35:32,660
somebody suggests maybe we should have
3151
01:35:32,660 --> 01:35:34,840
somebody suggests maybe we should have
done commits for the individual items
3152
01:35:34,840 --> 01:35:34,850
done commits for the individual items
3153
01:35:34,850 --> 01:35:38,170
done commits for the individual items
that's a good idea I generally do that
3154
01:35:38,170 --> 01:35:38,180
that's a good idea I generally do that
3155
01:35:38,180 --> 01:35:40,480
that's a good idea I generally do that
but when I get carried away I'm not
3156
01:35:40,480 --> 01:35:40,490
but when I get carried away I'm not
3157
01:35:40,490 --> 01:35:43,090
but when I get carried away I'm not
doing this but generally just how I work
3158
01:35:43,090 --> 01:35:43,100
doing this but generally just how I work
3159
01:35:43,100 --> 01:35:45,570
doing this but generally just how I work
I would I would commit logical chunks
3160
01:35:45,570 --> 01:35:45,580
I would I would commit logical chunks
3161
01:35:45,580 --> 01:35:49,930
I would I would commit logical chunks
and we can do this right now actually if
3162
01:35:49,930 --> 01:35:49,940
and we can do this right now actually if
3163
01:35:49,940 --> 01:35:52,840
and we can do this right now actually if
we wanted to let me think about that for
3164
01:35:52,840 --> 01:35:52,850
we wanted to let me think about that for
3165
01:35:52,850 --> 01:35:56,080
we wanted to let me think about that for
a second is that easy probably not right
3166
01:35:56,080 --> 01:35:56,090
a second is that easy probably not right
3167
01:35:56,090 --> 01:35:57,070
a second is that easy probably not right
now because you already have
3168
01:35:57,070 --> 01:35:57,080
now because you already have
3169
01:35:57,080 --> 01:35:59,170
now because you already have
interdependencies everywhere but I would
3170
01:35:59,170 --> 01:35:59,180
interdependencies everywhere but I would
3171
01:35:59,180 --> 01:36:02,620
interdependencies everywhere but I would
say for our first episode um you know
3172
01:36:02,620 --> 01:36:02,630
say for our first episode um you know
3173
01:36:02,630 --> 01:36:05,080
say for our first episode um you know
it's not do that and that's do it the
3174
01:36:05,080 --> 01:36:05,090
it's not do that and that's do it the
3175
01:36:05,090 --> 01:36:07,690
it's not do that and that's do it the
right way to check out it's called as
3176
01:36:07,690 --> 01:36:07,700
right way to check out it's called as
3177
01:36:07,700 --> 01:36:12,550
right way to check out it's called as
episode 1
3178
01:36:12,550 --> 01:36:12,560
3179
01:36:12,560 --> 01:36:18,130
3180
01:36:18,130 --> 01:36:18,140
yeah I guess episode 1 lexer and parser
3181
01:36:18,140 --> 01:36:21,170
yeah I guess episode 1 lexer and parser
right just for good measure and then we
3182
01:36:21,170 --> 01:36:21,180
right just for good measure and then we
3183
01:36:21,180 --> 01:36:25,130
right just for good measure and then we
just say add these guys why don't we go
3184
01:36:25,130 --> 01:36:25,140
just say add these guys why don't we go
3185
01:36:25,140 --> 01:36:29,540
just say add these guys why don't we go
to what we were to commit I'm not sure I
3186
01:36:29,540 --> 01:36:29,550
to what we were to commit I'm not sure I
3187
01:36:29,550 --> 01:36:31,450
to what we were to commit I'm not sure I
want to commit deviance code once but
3188
01:36:31,450 --> 01:36:31,460
want to commit deviance code once but
3189
01:36:31,460 --> 01:36:42,549
want to commit deviance code once but
yeah it is what it is all right let's do
3190
01:36:42,549 --> 01:36:42,559
3191
01:36:42,559 --> 01:36:44,529
3192
01:36:44,529 --> 01:36:44,539
the tune so here's all the stuff we're
3193
01:36:44,539 --> 01:36:51,810
the tune so here's all the stuff we're
about to commit
3194
01:36:51,810 --> 01:36:51,820
3195
01:36:51,820 --> 01:36:58,770
3196
01:36:58,770 --> 01:36:58,780
yeah good enough alright add lexer and
3197
01:36:58,780 --> 01:37:06,210
yeah good enough alright add lexer and
parser this adds the basics maybe we
3198
01:37:06,210 --> 01:37:06,220
parser this adds the basics maybe we
3199
01:37:06,220 --> 01:37:11,360
parser this adds the basics maybe we
should say that expression evaluate or
3200
01:37:11,360 --> 01:37:11,370
should say that expression evaluate or
3201
01:37:11,370 --> 01:37:16,680
should say that expression evaluate or
evaluate or that's the basics we need
3202
01:37:16,680 --> 01:37:16,690
evaluate or that's the basics we need
3203
01:37:16,690 --> 01:37:27,320
evaluate or that's the basics we need
specifically lexer parser and
3204
01:37:27,320 --> 01:37:27,330
specifically lexer parser and
3205
01:37:27,330 --> 01:37:36,240
specifically lexer parser and
diagnostics mistakes diagnostics that
3206
01:37:36,240 --> 01:37:36,250
diagnostics mistakes diagnostics that
3207
01:37:36,250 --> 01:37:45,670
diagnostics mistakes diagnostics that
will lay the foundation for our compiler
3208
01:37:45,670 --> 01:37:45,680
3209
01:37:45,680 --> 01:37:52,340
3210
01:37:52,340 --> 01:37:52,350
I'd say good enough so I think for our
3211
01:37:52,350 --> 01:37:55,580
I'd say good enough so I think for our
first episode that is a pretty decent
3212
01:37:55,580 --> 01:37:55,590
first episode that is a pretty decent
3213
01:37:55,590 --> 01:38:04,490
first episode that is a pretty decent
start alright so yeah my my lights are
3214
01:38:04,490 --> 01:38:04,500
start alright so yeah my my lights are
3215
01:38:04,500 --> 01:38:07,550
start alright so yeah my my lights are
all fading so I look very interesting
3216
01:38:07,550 --> 01:38:07,560
all fading so I look very interesting
3217
01:38:07,560 --> 01:38:09,590
all fading so I look very interesting
probably very dark it's a very critical
3218
01:38:09,590 --> 01:38:09,600
probably very dark it's a very critical
3219
01:38:09,600 --> 01:38:12,680
probably very dark it's a very critical
thing here so I think the next episodes
3220
01:38:12,680 --> 01:38:12,690
thing here so I think the next episodes
3221
01:38:12,690 --> 01:38:14,330
thing here so I think the next episodes
will focus a little bit more on getting
3222
01:38:14,330 --> 01:38:14,340
will focus a little bit more on getting
3223
01:38:14,340 --> 01:38:16,610
will focus a little bit more on getting
more stuff from the language going maybe
3224
01:38:16,610 --> 01:38:16,620
more stuff from the language going maybe
3225
01:38:16,620 --> 01:38:19,580
more stuff from the language going maybe
some statements and then also we have to
3226
01:38:19,580 --> 01:38:19,590
some statements and then also we have to
3227
01:38:19,590 --> 01:38:20,930
some statements and then also we have to
think about how we and we want to run
3228
01:38:20,930 --> 01:38:20,940
think about how we and we want to run
3229
01:38:20,940 --> 01:38:22,700
think about how we and we want to run
this guy probably start first with an e
3230
01:38:22,700 --> 01:38:22,710
this guy probably start first with an e
3231
01:38:22,710 --> 01:38:25,940
this guy probably start first with an e
value of an interpreter because it's
3232
01:38:25,940 --> 01:38:25,950
value of an interpreter because it's
3233
01:38:25,950 --> 01:38:27,320
value of an interpreter because it's
much easier to do an interpreter than it
3234
01:38:27,320 --> 01:38:27,330
much easier to do an interpreter than it
3235
01:38:27,330 --> 01:38:30,050
much easier to do an interpreter than it
is to omit il and then we will walk our
3236
01:38:30,050 --> 01:38:30,060
is to omit il and then we will walk our
3237
01:38:30,060 --> 01:38:34,490
is to omit il and then we will walk our
way slowly up alright so this we are
3238
01:38:34,490 --> 01:38:34,500
way slowly up alright so this we are
3239
01:38:34,500 --> 01:38:37,250
way slowly up alright so this we are
pretty much in time I was hoping for 90
3240
01:38:37,250 --> 01:38:37,260
pretty much in time I was hoping for 90
3241
01:38:37,260 --> 01:38:42,710
pretty much in time I was hoping for 90
minutes we're now at 100 minutes but
285562
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.