WEBVTT

1
00:00:04.250 --> 00:00:09.000
<00:00:04.250>Today <00:00:04.366>I'm <00:00:04.483>here <00:00:04.600>to <00:00:04.716>talk <00:00:04.833>about <00:00:04.950>a <00:00:05.066>topic <00:00:05.183>that <00:00:05.300>is <00:00:05.416>very <00:00:05.533>often <00:00:05.650>perceived

2
00:00:09.060 --> 00:00:12.000
<00:00:09.060>as <00:00:09.526>intimidating <00:00:09.993>or, <00:00:10.460>uh,

3
00:00:12.400 --> 00:00:14.720
<00:00:12.400>tiresome <00:00:12.750>even <00:00:13.100>by <00:00:13.450>experienced <00:00:13.800>developers.

4
00:00:15.100 --> 00:00:20.040
<00:00:15.100>And <00:00:15.240>the <00:00:15.379>topic <00:00:15.520>is <00:00:15.660>the <00:00:15.799>inner <00:00:15.940>workings <00:00:16.079>of <00:00:16.219>programming <00:00:16.360>languages. <00:00:16.500>So,

5
00:00:20.200 --> 00:00:24.120
<00:00:20.200>a <00:00:20.327>few <00:00:20.454>more <00:00:20.581>words <00:00:20.709>about <00:00:20.836>me. <00:00:20.963>I <00:00:21.090>do <00:00:21.218>work <00:00:21.345>on <00:00:21.472>open <00:00:21.599>source,

6
00:00:24.440 --> 00:00:26.800
<00:00:24.440>I <00:00:24.615>work <00:00:24.790>on <00:00:24.965>open <00:00:25.140>source <00:00:25.315>at <00:00:25.490>the <00:00:25.665>Guild. <00:00:25.840>Um,

7
00:00:27.240 --> 00:00:31.040
<00:00:27.240>I <00:00:27.380>also <00:00:27.520>co <00:00:27.659>organize <00:00:27.799>a <00:00:27.939>telescope <00:00:28.080>meetup <00:00:28.220>in <00:00:28.360>Poland <00:00:28.500>in <00:00:28.639>rwa.

8
00:00:31.580 --> 00:00:35.160
<00:00:31.580>And <00:00:31.696>you <00:00:31.813>can <00:00:31.930>find <00:00:32.046>me <00:00:32.163>on <00:00:32.280>social <00:00:32.396>media, <00:00:32.513>on <00:00:32.629>Twitter, <00:00:32.746>as <00:00:32.863>Alexandra <00:00:32.980>says,

9
00:00:35.380 --> 00:00:39.440
<00:00:35.380>or <00:00:35.613>check <00:00:35.846>out <00:00:36.080>my <00:00:36.313>personal <00:00:36.546>website <00:00:36.780>alexandra.codes.

10
00:00:41.150 --> 00:00:41.983
Okay,

11
00:00:42.060 --> 00:00:46.800
<00:00:42.060>so <00:00:42.215>the <00:00:42.371>plan <00:00:42.526>for <00:00:42.682>today <00:00:42.837>is <00:00:42.993>to <00:00:43.148>look <00:00:43.304>into <00:00:43.460>creating

12
00:00:47.040 --> 00:00:50.920
<00:00:47.040>a <00:00:47.180>new <00:00:47.320>programming <00:00:47.460>language. <00:00:47.600>We'll <00:00:47.740>talk <00:00:47.879>about <00:00:48.019>what <00:00:48.160>makes <00:00:48.300>a <00:00:48.440>language.

13
00:00:51.190 --> 00:00:52.840
<00:00:51.190>Then <00:00:51.656>we'll <00:00:52.123>also, <00:00:52.589>um,

14
00:00:53.330 --> 00:00:57.320
<00:00:53.330>cover <00:00:53.485>a <00:00:53.641>little <00:00:53.796>bit <00:00:53.952>of <00:00:54.107>theory <00:00:54.263>about <00:00:54.418>interpreters, <00:00:54.574>compilers <00:00:54.730>parts,

15
00:00:57.940 --> 00:01:01.760
<00:00:57.940>and <00:00:58.173>so <00:00:58.406>on. <00:00:58.640>And <00:00:58.873>we'll <00:00:59.106>also, <00:00:59.339>uh,

16
00:01:02.110 --> 00:01:06.160
<00:01:02.110>look <00:01:02.285>into <00:01:02.460>how <00:01:02.635>to, <00:01:02.810>uh, <00:01:02.985>extend <00:01:03.160>an <00:01:03.335>existing <00:01:03.510>language.

17
00:01:08.170 --> 00:01:09.110
<00:01:08.170>So, <00:01:09.016>uh,

18
00:01:09.550 --> 00:01:13.630
<00:01:09.550>I <00:01:09.657>also <00:01:09.765>wanted <00:01:09.873>to <00:01:09.980>say <00:01:10.088>a <00:01:10.196>few <00:01:10.303>words <00:01:10.411>about <00:01:10.519>the <00:01:10.626>goal <00:01:10.734>of <00:01:10.842>this <00:01:10.950>talk.

19
00:01:14.330 --> 00:01:19.150
<00:01:14.330>So <00:01:14.437>maybe <00:01:14.545>it'll <00:01:14.653>be <00:01:14.760>a <00:01:14.868>fun <00:01:14.976>area <00:01:15.083>for <00:01:15.191>you <00:01:15.299>to <00:01:15.406>explore, <00:01:15.514>or <00:01:15.622>maybe <00:01:15.730>I,

20
00:01:19.300 --> 00:01:23.270
<00:01:19.300>I'll <00:01:19.416>inspire <00:01:19.533>you <00:01:19.649>to <00:01:19.766>create <00:01:19.883>your <00:01:20.000>own <00:01:20.116>programming <00:01:20.233>language <00:01:20.350>or <00:01:20.466>contribute <00:01:20.583>to <00:01:20.700>your

21
00:01:23.430 --> 00:01:27.030
<00:01:23.430>favorite <00:01:23.570>one. <00:01:23.710>But <00:01:23.850>even <00:01:23.990>if <00:01:24.130>you're <00:01:24.270>not <00:01:24.410>particularly <00:01:24.550>interested <00:01:24.690>in <00:01:24.830>that,

22
00:01:27.190 --> 00:01:30.430
<00:01:27.190>I <00:01:27.297>still <00:01:27.405>want <00:01:27.513>you <00:01:27.620>to <00:01:27.728>take <00:01:27.836>something <00:01:27.943>out <00:01:28.051>of <00:01:28.159>it. <00:01:28.266>So <00:01:28.374>if <00:01:28.482>you <00:01:28.590>wonder,

23
00:01:30.810 --> 00:01:34.190
<00:01:30.810>how <00:01:30.926>can <00:01:31.043>I <00:01:31.160>benefit <00:01:31.276>from <00:01:31.393>this <00:01:31.510>kind <00:01:31.626>of <00:01:31.743>talk, <00:01:31.860>if <00:01:31.976>I, <00:01:32.093>for <00:01:32.210>example,

24
00:01:34.360 --> 00:01:38.870
<00:01:34.360>build <00:01:34.535>user <00:01:34.710>interfaces <00:01:34.885>or <00:01:35.060>APIs <00:01:35.235>on <00:01:35.410>daily <00:01:35.585>basis? <00:01:35.760>Well,

25
00:01:39.080 --> 00:01:39.913
<00:01:39.080>let's <00:01:39.829>see.

26
00:01:40.470 --> 00:01:44.870
<00:01:40.470>I <00:01:40.563>want <00:01:40.656>to <00:01:40.750>give <00:01:40.843>you <00:01:40.936>a <00:01:41.030>few <00:01:41.123>examples <00:01:41.216>of <00:01:41.310>when <00:01:41.403>this <00:01:41.496>kind <00:01:41.590>of <00:01:41.683>knowledge <00:01:41.776>pays <00:01:41.870>off

27
00:01:46.590 --> 00:01:47.423
<00:01:46.590>the <00:01:46.964>first <00:01:47.339>one.

28
00:01:47.670 --> 00:01:52.450
<00:01:47.670>So <00:01:47.763>maybe <00:01:47.856>you <00:01:47.950>work <00:01:48.043>on <00:01:48.136>a <00:01:48.230>real <00:01:48.323>large <00:01:48.416>code <00:01:48.510>base <00:01:48.603>and <00:01:48.696>you <00:01:48.790>have <00:01:48.883>a <00:01:48.976>very <00:01:49.070>unique

29
00:01:52.450 --> 00:01:53.770
<00:01:52.450>style <00:01:52.687>that <00:01:52.925>you <00:01:53.162>want <00:01:53.400>to <00:01:53.638>enforce.

30
00:01:54.310 --> 00:01:58.610
<00:01:54.310>So <00:01:54.485>writing <00:01:54.660>LinkedIn <00:01:54.835>rules <00:01:55.010>often <00:01:55.185>means <00:01:55.360>working <00:01:55.535>with, <00:01:55.710>uh,

31
00:01:58.960 --> 00:02:03.530
<00:01:58.960>like <00:01:59.060>the <00:01:59.160>inner <00:01:59.260>parts <00:01:59.360>of <00:01:59.460>the <00:01:59.560>language <00:01:59.660>because <00:01:59.760>we <00:01:59.860>are <00:01:59.960>trying <00:02:00.060>to <00:02:00.160>work <00:02:00.260>on <00:02:00.360>the

32
00:02:03.730 --> 00:02:04.563
<00:02:03.730>language <00:02:04.479>structure.

33
00:02:05.070 --> 00:02:09.050
<00:02:05.070>So <00:02:05.197>that <00:02:05.324>means <00:02:05.451>working <00:02:05.579>with <00:02:05.706>ASTs <00:02:05.833>going <00:02:05.960>very <00:02:06.088>deep <00:02:06.215>into <00:02:06.342>the <00:02:06.470>language.

34
00:02:09.840 --> 00:02:13.370
<00:02:09.840>Another <00:02:10.015>example, <00:02:10.190>maybe <00:02:10.365>you <00:02:10.539>want <00:02:10.715>to <00:02:10.890>enhance <00:02:11.065>your <00:02:11.240>id.

35
00:02:13.900 --> 00:02:18.250
<00:02:13.900>Maybe <00:02:14.016>there's <00:02:14.133>a <00:02:14.250>coding <00:02:14.366>pattern <00:02:14.483>or <00:02:14.600>baller <00:02:14.716>play <00:02:14.833>that <00:02:14.950>you <00:02:15.066>write <00:02:15.183>very <00:02:15.300>often,

36
00:02:18.350 --> 00:02:23.250
<00:02:18.350>and <00:02:18.450>it <00:02:18.549>would <00:02:18.650>be <00:02:18.750>really <00:02:18.850>nice <00:02:18.950>if <00:02:19.049>your <00:02:19.150>editor <00:02:19.250>could <00:02:19.350>replace <00:02:19.450>or <00:02:19.549>edit <00:02:19.650>it <00:02:19.750>for

37
00:02:23.250 --> 00:02:26.210
<00:02:23.250>you. <00:02:23.483>So <00:02:23.716>again, <00:02:23.950>for <00:02:24.183>more <00:02:24.416>complicated <00:02:24.650>things,

38
00:02:26.390 --> 00:02:29.090
<00:02:26.390>you <00:02:26.565>may <00:02:26.739>want <00:02:26.915>to <00:02:27.089>work <00:02:27.265>with <00:02:27.440>the <00:02:27.614>languages <00:02:27.790>structure

39
00:02:31.180 --> 00:02:32.960
<00:02:31.180>or, <00:02:31.646>uh, <00:02:32.113>another <00:02:32.580>example,

40
00:02:33.850 --> 00:02:37.080
<00:02:33.850>maybe <00:02:34.049>you <00:02:34.250>need <00:02:34.450>a <00:02:34.650>custom <00:02:34.850>domain <00:02:35.049>specific <00:02:35.250>language.

41
00:02:37.540 --> 00:02:40.560
<00:02:37.540>In <00:02:37.715>some <00:02:37.890>business <00:02:38.065>domains, <00:02:38.239>rules <00:02:38.415>can <00:02:38.590>be <00:02:38.765>very <00:02:38.940>complex.

42
00:02:41.460 --> 00:02:46.360
<00:02:41.460>And <00:02:41.567>having <00:02:41.675>this <00:02:41.783>D <00:02:41.890>S <00:02:41.998>L, <00:02:42.106>this <00:02:42.213>domain <00:02:42.321>specific <00:02:42.429>language <00:02:42.536>could <00:02:42.644>allow <00:02:42.752>those, <00:02:42.860>uh,

43
00:02:46.360 --> 00:02:50.960
<00:02:46.360>those <00:02:46.476>business <00:02:46.593>experts <00:02:46.710>who <00:02:46.826>might <00:02:46.943>not <00:02:47.060>be <00:02:47.176>very <00:02:47.293>familiar <00:02:47.410>with <00:02:47.526>any <00:02:47.643>general <00:02:47.760>purpose

44
00:02:51.360 --> 00:02:55.200
<00:02:51.360>languages <00:02:51.515>to <00:02:51.671>still <00:02:51.826>be <00:02:51.982>able <00:02:52.137>to <00:02:52.293>modify <00:02:52.448>those <00:02:52.604>rules <00:02:52.760>themselves.

45
00:02:57.300 --> 00:02:58.200
<00:02:57.300>And <00:02:57.705>of <00:02:58.109>course,

46
00:02:58.350 --> 00:03:03.160
<00:02:58.350>some <00:02:58.489>of <00:02:58.630>these <00:02:58.769>problems <00:02:58.910>are <00:02:59.049>solvable <00:02:59.190>with <00:02:59.329>s <00:02:59.470>but <00:02:59.609>many <00:02:59.750>aren't.

47
00:03:03.700 --> 00:03:07.480
<00:03:03.700>And <00:03:03.875>programming <00:03:04.049>languages <00:03:04.225>are <00:03:04.399>not <00:03:04.575>the <00:03:04.750>most <00:03:04.924>straightforward <00:03:05.100>problems.

48
00:03:08.190 --> 00:03:09.800
<00:03:08.190>Code <00:03:08.540>is <00:03:08.890>a <00:03:09.240>structured <00:03:09.590>data,

49
00:03:10.420 --> 00:03:15.000
<00:03:10.420>and <00:03:10.547>it's <00:03:10.674>often <00:03:10.801>easier <00:03:10.929>to <00:03:11.056>transform <00:03:11.183>it <00:03:11.310>instead <00:03:11.438>of <00:03:11.565>brute <00:03:11.692>forcing <00:03:11.820>to

50
00:03:15.600 --> 00:03:16.433
s

51
00:03:17.770 --> 00:03:21.790
<00:03:17.770>And <00:03:17.870>I <00:03:17.970>wanted <00:03:18.070>to <00:03:18.170>give <00:03:18.270>this <00:03:18.370>dog <00:03:18.470>because <00:03:18.570>all <00:03:18.670>of <00:03:18.770>that <00:03:18.870>can <00:03:18.970>be <00:03:19.070>quite <00:03:19.170>intimidating.

52
00:03:22.070 --> 00:03:25.630
<00:03:22.070>I <00:03:22.225>was <00:03:22.381>working <00:03:22.536>on <00:03:22.692>interpreters <00:03:22.847>and <00:03:23.003>compilers, <00:03:23.158>uh, <00:03:23.314>to <00:03:23.470>university,

53
00:03:26.210 --> 00:03:29.110
<00:03:26.210>but <00:03:26.410>then <00:03:26.610>I <00:03:26.810>mostly <00:03:27.010>forgot, <00:03:27.210>uh, <00:03:27.410>about <00:03:27.610>that.

54
00:03:29.170 --> 00:03:33.110
<00:03:29.170>And <00:03:29.277>then <00:03:29.385>when <00:03:29.493>I <00:03:29.600>had <00:03:29.708>to <00:03:29.816>write <00:03:29.923>some <00:03:30.031>Babel <00:03:30.139>plugins <00:03:30.246>or <00:03:30.354>other, <00:03:30.462>other <00:03:30.570>transformers,

55
00:03:33.730 --> 00:03:38.150
<00:03:33.730>uh, <00:03:33.837>it <00:03:33.945>was <00:03:34.053>quite <00:03:34.160>a <00:03:34.268>challenge. <00:03:34.376>But <00:03:34.483>also <00:03:34.591>it's <00:03:34.699>a <00:03:34.806>nice <00:03:34.914>kind <00:03:35.022>of <00:03:35.130>challenge.

56
00:03:38.650 --> 00:03:41.030
<00:03:38.650>And, <00:03:39.000>um, <00:03:39.350>with <00:03:39.700>this <00:03:40.050>talk,

57
00:03:41.290 --> 00:03:46.230
<00:03:41.290>you <00:03:41.383>should <00:03:41.476>have <00:03:41.570>like <00:03:41.663>a <00:03:41.756>good <00:03:41.850>start <00:03:41.943>to <00:03:42.036>be <00:03:42.130>able <00:03:42.223>to <00:03:42.316>play <00:03:42.410>with <00:03:42.503>languages <00:03:42.596>on <00:03:42.690>your

58
00:03:46.230 --> 00:03:49.670
<00:03:46.230>own. <00:03:46.429>And <00:03:46.630>for <00:03:46.829>the <00:03:47.030>purpose <00:03:47.230>of <00:03:47.429>this <00:03:47.630>talk,

59
00:03:49.910 --> 00:03:54.430
<00:03:49.910>I <00:03:50.065>created <00:03:50.221>a <00:03:50.376>very <00:03:50.532>minimal <00:03:50.687>language, <00:03:50.843>uh, <00:03:50.998>it's <00:03:51.154>called <00:03:51.310>Ang,

60
00:03:54.890 --> 00:03:59.710
<00:03:54.890>and <00:03:55.017>it'll <00:03:55.144>suit <00:03:55.271>us <00:03:55.399>as <00:03:55.526>a <00:03:55.653>base <00:03:55.780>to <00:03:55.908>explore <00:03:56.035>the <00:03:56.162>inner <00:03:56.290>workings

61
00:03:59.710 --> 00:04:04.670
<00:03:59.710>open <00:03:59.826>language. <00:03:59.943>I <00:04:00.060>also <00:04:00.176>wanted <00:04:00.293>to <00:04:00.410>mention <00:04:00.526>that <00:04:00.643>it's <00:04:00.760>not <00:04:00.876>a <00:04:00.993>random <00:04:01.110>name.

62
00:04:05.330 --> 00:04:09.390
<00:04:05.330>So <00:04:05.485>Alexandra, <00:04:05.641>in <00:04:05.796>Polish, <00:04:05.952>uh, <00:04:06.107>like <00:04:06.263>the <00:04:06.418>shortcut <00:04:06.574>is <00:04:06.730>ola,

63
00:04:09.490 --> 00:04:14.470
<00:04:09.490>and <00:04:09.597>Ola <00:04:09.705>and <00:04:09.813>language <00:04:09.920>is <00:04:10.028>ang. <00:04:10.136>So, <00:04:10.243>uh, <00:04:10.351>here's <00:04:10.459>the <00:04:10.566>origin <00:04:10.674>of <00:04:10.782>the <00:04:10.890>name.

64
00:04:16.860 --> 00:04:20.110
<00:04:16.860>This <00:04:17.093>is, <00:04:17.326>uh, <00:04:17.560>the <00:04:17.793>online <00:04:18.026>syntax. <00:04:18.260>Um,

65
00:04:20.730 --> 00:04:24.030
<00:04:20.730>it <00:04:20.830>doesn't <00:04:20.930>do <00:04:21.030>much <00:04:21.130>right <00:04:21.230>now, <00:04:21.330>but <00:04:21.430>we <00:04:21.530>can <00:04:21.630>have <00:04:21.730>functions, <00:04:21.830>we <00:04:21.930>can <00:04:22.030>call <00:04:22.130>them.

66
00:04:24.530 --> 00:04:28.630
<00:04:24.530>And <00:04:24.685>by <00:04:24.841>default, <00:04:24.996>the <00:04:25.152>last <00:04:25.307>expression <00:04:25.463>is <00:04:25.618>a <00:04:25.774>return <00:04:25.929>statement.

67
00:04:30.800 --> 00:04:33.260
<00:04:30.800>And <00:04:31.080>before <00:04:31.360>jumping <00:04:31.640>into <00:04:31.920>the <00:04:32.200>code,

68
00:04:33.460 --> 00:04:37.980
<00:04:33.460>I <00:04:33.576>wanted <00:04:33.693>to <00:04:33.810>cover <00:04:33.926>a <00:04:34.043>little <00:04:34.159>bit <00:04:34.276>of <00:04:34.393>theory <00:04:34.510>behind <00:04:34.626>languages. <00:04:34.743>So <00:04:34.859>firstly,

69
00:04:38.050 --> 00:04:42.340
<00:04:38.050>what <00:04:38.225>makes <00:04:38.400>a <00:04:38.575>language <00:04:38.750>as <00:04:38.925>everything <00:04:39.100>in <00:04:39.275>programming, <00:04:39.450>uh,

70
00:04:42.940 --> 00:04:47.500
<00:04:42.940>languages <00:04:43.067>also <00:04:43.194>need <00:04:43.321>some <00:04:43.449>kind <00:04:43.576>of <00:04:43.703>specification. <00:04:43.830>And <00:04:43.958>in <00:04:44.085>case <00:04:44.212>of <00:04:44.340>languages,

71
00:04:47.500 --> 00:04:48.380
<00:04:47.500>this <00:04:47.764>thing <00:04:48.028>is <00:04:48.292>grammar.

72
00:04:49.240 --> 00:04:53.300
<00:04:49.240>So <00:04:49.380>grammars <00:04:49.520>are <00:04:49.660>like <00:04:49.800>set <00:04:49.940>of <00:04:50.080>rules <00:04:50.220>that <00:04:50.360>describe <00:04:50.500>the <00:04:50.640>language.

73
00:04:54.200 --> 00:04:58.420
<00:04:54.200>And <00:04:54.355>same <00:04:54.511>as <00:04:54.666>you <00:04:54.822>have <00:04:54.977>like <00:04:55.133>grammars <00:04:55.288>in <00:04:55.444>spoken <00:04:55.599>languages,

74
00:04:58.720 --> 00:05:01.020
<00:04:58.720>you <00:04:58.953>also <00:04:59.186>have <00:04:59.420>them <00:04:59.653>in <00:04:59.886>programming <00:05:00.120>languages.

75
00:05:01.480 --> 00:05:04.540
<00:05:01.480>But <00:05:01.635>if <00:05:01.791>you <00:05:01.946>make <00:05:02.102>a <00:05:02.257>mistake <00:05:02.413>in <00:05:02.568>a <00:05:02.724>spoken <00:05:02.880>language,

76
00:05:04.540 --> 00:05:07.700
<00:05:04.540>there's <00:05:04.695>still <00:05:04.851>a <00:05:05.006>chance <00:05:05.162>that <00:05:05.317>someone <00:05:05.473>will <00:05:05.628>understand <00:05:05.784>you. <00:05:05.940>However,

77
00:05:08.080 --> 00:05:10.700
<00:05:08.080>if <00:05:08.255>you <00:05:08.430>make <00:05:08.604>a <00:05:08.780>mistake <00:05:08.955>in <00:05:09.130>a <00:05:09.305>programming <00:05:09.479>language,

78
00:05:10.700 --> 00:05:15.660
<00:05:10.700>then <00:05:10.793>the <00:05:10.886>machine <00:05:10.979>won't <00:05:11.073>be <00:05:11.166>able <00:05:11.260>to <00:05:11.353>deduce <00:05:11.446>what <00:05:11.539>you <00:05:11.633>hand <00:05:11.726>in <00:05:11.820>mind <00:05:11.913>and <00:05:12.006>it'll <00:05:12.099>throw

79
00:05:15.660 --> 00:05:17.870
<00:05:15.660>an <00:05:16.360>error. <00:05:17.060>Uh,

80
00:05:18.120 --> 00:05:21.070
<00:05:18.120>there <00:05:18.320>are <00:05:18.520>many <00:05:18.720>kinds <00:05:18.920>or <00:05:19.120>levels <00:05:19.320>of <00:05:19.520>grammars,

81
00:05:21.090 --> 00:05:25.470
<00:05:21.090>but <00:05:21.217>we'll <00:05:21.344>briefly <00:05:21.471>talk <00:05:21.599>only <00:05:21.726>about <00:05:21.853>this <00:05:21.980>to <00:05:22.108>today. <00:05:22.235>So <00:05:22.362>this, <00:05:22.489>uh,

82
00:05:26.180 --> 00:05:26.970
<00:05:26.180>like <00:05:26.891>the,

83
00:05:26.970 --> 00:05:31.550
<00:05:26.970>the <00:05:27.070>goal <00:05:27.170>is <00:05:27.270>to <00:05:27.370>give <00:05:27.470>you <00:05:27.570>like <00:05:27.670>an <00:05:27.770>understanding <00:05:27.870>why <00:05:27.970>brute <00:05:28.070>forcing <00:05:28.170>a <00:05:28.270>language <00:05:28.370>with

84
00:05:31.750 --> 00:05:35.870
<00:05:31.750>forensics <00:05:31.950>is <00:05:32.150>not <00:05:32.350>the <00:05:32.550>best <00:05:32.750>idea. <00:05:32.950>So <00:05:33.150>first,

85
00:05:35.960 --> 00:05:38.390
<00:05:35.960>let's <00:05:36.239>see <00:05:36.520>a <00:05:36.799>regular <00:05:37.080>grammar. <00:05:37.359>Uh,

86
00:05:39.050 --> 00:05:41.230
<00:05:39.050>so <00:05:39.516>here's <00:05:39.983>an <00:05:40.450>example,

87
00:05:41.230 --> 00:05:44.550
<00:05:41.230>like <00:05:41.430>an <00:05:41.630>abstract <00:05:41.830>example <00:05:42.030>of <00:05:42.230>a <00:05:42.430>bedtime <00:05:42.630>routine.

88
00:05:45.090 --> 00:05:49.430
<00:05:45.090>So <00:05:45.197>when <00:05:45.305>you <00:05:45.413>are <00:05:45.520>getting <00:05:45.628>ready <00:05:45.736>for <00:05:45.843>bed, <00:05:45.951>you <00:05:46.059>have <00:05:46.166>like <00:05:46.274>this <00:05:46.382>very <00:05:46.490>simple,

89
00:05:49.580 --> 00:05:52.830
<00:05:49.580>predictable <00:05:49.755>routine. <00:05:49.930>You <00:05:50.104>put <00:05:50.280>your <00:05:50.455>bottoms <00:05:50.630>top <00:05:50.805>and <00:05:50.979>slippers,

90
00:05:53.130 --> 00:05:57.110
<00:05:53.130>and <00:05:53.237>you <00:05:53.345>don't <00:05:53.453>put <00:05:53.560>your <00:05:53.668>slippers <00:05:53.776>before <00:05:53.883>the, <00:05:53.991>uh, <00:05:54.099>before <00:05:54.206>putting <00:05:54.314>your <00:05:54.422>bottoms <00:05:54.530>and,

91
00:05:57.120 --> 00:06:01.320
<00:05:57.120>and <00:05:57.275>so <00:05:57.431>on. <00:05:57.586>So <00:05:57.742>it's <00:05:57.897>predictable, <00:05:58.053>it's <00:05:58.208>step <00:05:58.364>by <00:05:58.520>step.

92
00:06:01.540 --> 00:06:05.760
<00:06:01.540>And <00:06:01.680>you <00:06:01.820>know <00:06:01.960>what <00:06:02.100>comes <00:06:02.240>next <00:06:02.380>by <00:06:02.520>knowing <00:06:02.660>what <00:06:02.800>was <00:06:02.940>before.

93
00:06:07.530 --> 00:06:11.550
<00:06:07.530>And <00:06:07.637>this <00:06:07.745>is <00:06:07.853>a <00:06:07.960>good <00:06:08.068>use <00:06:08.176>case <00:06:08.283>for <00:06:08.391>Rex <00:06:08.499>because <00:06:08.606>as <00:06:08.714>the <00:06:08.822>name <00:06:08.929>suggests,

94
00:06:12.090 --> 00:06:13.950
<00:06:12.090>Rex <00:06:12.440>stands <00:06:12.789>for <00:06:13.140>regular <00:06:13.489>expressions.

95
00:06:14.370 --> 00:06:19.350
<00:06:14.370>So <00:06:14.510>it's <00:06:14.650>well <00:06:14.790>suited <00:06:14.930>for <00:06:15.070>regular <00:06:15.210>grammars, <00:06:15.350>which <00:06:15.490>is <00:06:15.630>regular <00:06:15.770>languages.

96
00:06:20.970 --> 00:06:24.390
<00:06:20.970>And <00:06:21.203>now, <00:06:21.436>uh, <00:06:21.670>context <00:06:21.903>free <00:06:22.136>grammar. <00:06:22.370>Uh,

97
00:06:24.390 --> 00:06:28.510
<00:06:24.390>this <00:06:24.483>is <00:06:24.576>what <00:06:24.669>we're <00:06:24.763>gonna <00:06:24.856>operate <00:06:24.950>in <00:06:25.043>today <00:06:25.136>when <00:06:25.229>we <00:06:25.323>are <00:06:25.416>going <00:06:25.510>to <00:06:25.603>look <00:06:25.696>into <00:06:25.789>all

98
00:06:28.510 --> 00:06:32.510
<00:06:28.510>length <00:06:28.685>code. <00:06:28.860>So <00:06:29.034>in <00:06:29.210>context <00:06:29.385>free, <00:06:29.560>you <00:06:29.735>can, <00:06:29.909>uh,

99
00:06:32.930 --> 00:06:37.110
<00:06:32.930>you <00:06:33.037>can <00:06:33.145>form <00:06:33.253>rules <00:06:33.360>in <00:06:33.468>a <00:06:33.576>more <00:06:33.683>complex <00:06:33.791>way. <00:06:33.899>You <00:06:34.006>can <00:06:34.114>form <00:06:34.222>recursive <00:06:34.330>rules.

100
00:06:37.340 --> 00:06:42.110
<00:06:37.340>Here <00:06:37.456>is <00:06:37.573>a <00:06:37.690>minimal <00:06:37.806>example. <00:06:37.923>It's <00:06:38.040>a <00:06:38.156>palindrome. <00:06:38.273>So <00:06:38.390>what <00:06:38.506>is <00:06:38.623>a <00:06:38.740>palindrome?

101
00:06:42.210 --> 00:06:45.710
<00:06:42.210>It <00:06:42.349>can <00:06:42.489>be <00:06:42.630>an <00:06:42.770>empty <00:06:42.909>character, <00:06:43.049>like <00:06:43.190>nothing <00:06:43.330>is <00:06:43.469>a <00:06:43.609>palindrome.

102
00:06:46.010 --> 00:06:48.870
<00:06:46.010>It <00:06:46.165>can <00:06:46.321>be <00:06:46.476>a <00:06:46.632>single <00:06:46.787>character, <00:06:46.943>which <00:06:47.098>is <00:06:47.254>a <00:06:47.409>palindrome,

103
00:06:49.130 --> 00:06:53.550
<00:06:49.130>or <00:06:49.257>it <00:06:49.384>can <00:06:49.511>be <00:06:49.639>something <00:06:49.766>that <00:06:49.893>has <00:06:50.020>this <00:06:50.148>character <00:06:50.275>on <00:06:50.402>the <00:06:50.530>front,

104
00:06:53.930 --> 00:06:57.110
<00:06:53.930>on <00:06:54.085>the <00:06:54.241>back, <00:06:54.396>and <00:06:54.552>the <00:06:54.707>poly <00:06:54.863>drum <00:06:55.018>on <00:06:55.174>the <00:06:55.330>inside.

105
00:06:59.350 --> 00:07:01.290
<00:06:59.350>So <00:06:59.700>in <00:07:00.050>other <00:07:00.400>words, <00:07:00.750>uh,

106
00:07:01.680 --> 00:07:05.610
<00:07:01.680>like <00:07:01.835>we <00:07:01.991>can <00:07:02.146>think <00:07:02.302>about <00:07:02.457>it <00:07:02.613>that <00:07:02.768>regular <00:07:02.924>grammars, <00:07:03.080>uh,

107
00:07:06.200 --> 00:07:10.570
<00:07:06.200>with <00:07:06.340>regular <00:07:06.479>grammars, <00:07:06.620>what <00:07:06.760>comes <00:07:06.900>next <00:07:07.039>depends <00:07:07.180>on <00:07:07.320>the <00:07:07.460>previous <00:07:07.599>step.

108
00:07:11.110 --> 00:07:13.050
<00:07:11.110>And <00:07:11.576>with <00:07:12.043>context <00:07:12.510>programs,

109
00:07:13.200 --> 00:07:16.770
<00:07:13.200>what <00:07:13.375>comes <00:07:13.550>next <00:07:13.724>doesn't <00:07:13.900>depend <00:07:14.075>on <00:07:14.250>the <00:07:14.425>previous <00:07:14.599>step.

110
00:07:18.500 --> 00:07:22.880
<00:07:18.500>Uh, <00:07:18.600>here <00:07:18.700>is <00:07:18.800>the <00:07:18.900>alliance <00:07:19.000>grammar. <00:07:19.100>Uh, <00:07:19.200>you <00:07:19.300>don't <00:07:19.400>have <00:07:19.500>to <00:07:19.600>read <00:07:19.700>through <00:07:19.800>it. <00:07:19.900>Uh,

111
00:07:22.880 --> 00:07:24.920
<00:07:22.880>we'll <00:07:23.055>take <00:07:23.230>a <00:07:23.405>closer <00:07:23.580>look <00:07:23.755>at <00:07:23.930>the <00:07:24.105>language <00:07:24.280>later,

112
00:07:24.940 --> 00:07:28.960
<00:07:24.940>but <00:07:25.047>I <00:07:25.155>just <00:07:25.263>wanted <00:07:25.370>to <00:07:25.478>give <00:07:25.586>you <00:07:25.693>a <00:07:25.801>sense <00:07:25.909>of <00:07:26.016>the <00:07:26.124>inner <00:07:26.232>mechanism, <00:07:26.340>uh,

113
00:07:29.230 --> 00:07:33.720
<00:07:29.230>like <00:07:29.346>what <00:07:29.463>makes <00:07:29.580>the <00:07:29.696>structure <00:07:29.813>on <00:07:29.930>the <00:07:30.046>language, <00:07:30.163>what's <00:07:30.280>allowed <00:07:30.396>and <00:07:30.513>what's <00:07:30.630>not,

114
00:07:33.740 --> 00:07:37.240
<00:07:33.740>how <00:07:33.895>it <00:07:34.051>all <00:07:34.206>works, <00:07:34.362>that <00:07:34.517>the <00:07:34.673>other <00:07:34.828>tools <00:07:34.984>know, <00:07:35.140>uh,

115
00:07:37.670 --> 00:07:42.080
<00:07:37.670>like <00:07:37.777>when <00:07:37.885>to <00:07:37.993>have <00:07:38.100>a <00:07:38.208>syntax <00:07:38.316>error <00:07:38.423>or <00:07:38.531>when <00:07:38.639>to <00:07:38.746>throw <00:07:38.854>a <00:07:38.962>parse <00:07:39.070>error.

116
00:07:43.960 --> 00:07:48.690
<00:07:43.960>Okay? <00:07:44.047>And <00:07:44.135>now, <00:07:44.222>uh, <00:07:44.310>so <00:07:44.397>we <00:07:44.484>know <00:07:44.572>what <00:07:44.659>makes <00:07:44.747>a <00:07:44.835>language <00:07:44.922>and <00:07:45.010>we <00:07:45.097>know <00:07:45.185>that <00:07:45.272>it's, <00:07:45.359>uh,

117
00:07:48.880 --> 00:07:50.970
<00:07:48.880>grammar. <00:07:49.580>And, <00:07:50.280>uh,

118
00:07:51.340 --> 00:07:54.850
<00:07:51.340>let's <00:07:51.440>say <00:07:51.540>we <00:07:51.640>more <00:07:51.740>or <00:07:51.840>less <00:07:51.940>decided <00:07:52.040>how <00:07:52.140>the <00:07:52.240>language <00:07:52.340>should <00:07:52.440>behave <00:07:52.540>and <00:07:52.640>look <00:07:52.740>like.

119
00:07:55.830 --> 00:08:00.210
<00:07:55.830>And, <00:07:55.957>uh, <00:07:56.084>we <00:07:56.211>also <00:07:56.339>know <00:07:56.466>that <00:07:56.593>we're <00:07:56.720>dealing <00:07:56.848>with <00:07:56.975>context <00:07:57.102>free <00:07:57.229>language.

120
00:08:00.910 --> 00:08:05.370
<00:08:00.910>And <00:08:01.110>now <00:08:01.310>is <00:08:01.510>ang <00:08:01.710>interpreted <00:08:01.910>or <00:08:02.110>compiled? <00:08:02.310>Well,

121
00:08:05.770 --> 00:08:09.650
<00:08:05.770>I <00:08:05.886>wanted <00:08:06.003>to <00:08:06.120>take <00:08:06.236>a <00:08:06.353>moment <00:08:06.469>to <00:08:06.586>talk <00:08:06.703>about <00:08:06.820>this <00:08:06.936>common <00:08:07.053>misconception <00:08:07.169>about

122
00:08:09.650 --> 00:08:12.130
<00:08:09.650>interpreters <00:08:10.349>and <00:08:11.049>compilers,

123
00:08:12.360 --> 00:08:16.970
<00:08:12.360>because <00:08:12.515>very <00:08:12.671>often <00:08:12.826>it's <00:08:12.982>tempting <00:08:13.137>to <00:08:13.293>categorize <00:08:13.448>languages <00:08:13.604>by <00:08:13.760>saying

124
00:08:17.080 --> 00:08:21.330
<00:08:17.080>interpreted <00:08:17.280>language <00:08:17.479>or <00:08:17.680>compiled <00:08:17.880>language, <00:08:18.080>while <00:08:18.280>in <00:08:18.479>reality,

125
00:08:21.960 --> 00:08:26.890
<00:08:21.960>it's, <00:08:22.067>uh, <00:08:22.175>not <00:08:22.283>that <00:08:22.390>one <00:08:22.498>contract, <00:08:22.606>it's <00:08:22.713>another, <00:08:22.821>it's <00:08:22.929>a <00:08:23.036>bit <00:08:23.144>more <00:08:23.252>complex. <00:08:23.359>So,

126
00:08:27.350 --> 00:08:28.110
uh,

127
00:08:28.110 --> 00:08:32.530
<00:08:28.110>the <00:08:28.210>thing <00:08:28.310>is <00:08:28.410>that <00:08:28.510>the <00:08:28.610>language <00:08:28.710>per <00:08:28.810>se <00:08:28.910>doesn't <00:08:29.010>matter <00:08:29.110>because <00:08:29.210>when <00:08:29.310>I <00:08:29.410>was <00:08:29.510>showing

128
00:08:32.530 --> 00:08:33.370
<00:08:32.530>you <00:08:32.908>the <00:08:33.286>grammars,

129
00:08:33.390 --> 00:08:37.690
<00:08:33.390>the <00:08:33.545>nowhere <00:08:33.701>there <00:08:33.856>we <00:08:34.012>were <00:08:34.167>talking <00:08:34.323>about <00:08:34.478>compilation <00:08:34.634>or <00:08:34.789>interpreting

130
00:08:38.360 --> 00:08:42.250
<00:08:38.360>what <00:08:38.534>matters <00:08:38.710>is <00:08:38.885>the <00:08:39.060>implementation <00:08:39.235>of <00:08:39.409>the <00:08:39.585>language. <00:08:39.760>Oh,

131
00:08:42.710 --> 00:08:46.090
<00:08:42.710>it <00:08:42.850>wasn't <00:08:42.990>supposed <00:08:43.130>to <00:08:43.270>be <00:08:43.410>there. <00:08:43.550>Let <00:08:43.690>me <00:08:43.830>remove <00:08:43.970>this. <00:08:44.110>Um,

132
00:08:46.750 --> 00:08:47.810
<00:08:46.750>so <00:08:47.704>the,

133
00:08:48.230 --> 00:08:53.050
<00:08:48.230>we <00:08:48.405>don't <00:08:48.580>categorize <00:08:48.755>into <00:08:48.930>compile <00:08:49.105>languages <00:08:49.280>or <00:08:49.455>interpreted <00:08:49.630>languages.

134
00:08:53.390 --> 00:08:58.240
<00:08:53.390>We <00:08:53.506>categorize <00:08:53.623>based <00:08:53.740>on <00:08:53.856>the <00:08:53.973>implementation. <00:08:54.090>And <00:08:54.206>in <00:08:54.323>fact, <00:08:54.439>there <00:08:54.556>can <00:08:54.673>be <00:08:54.790>language,

135
00:08:58.640 --> 00:09:02.760
<00:08:58.640>language <00:08:58.840>implementations <00:08:59.040>that <00:08:59.240>have <00:08:59.439>both <00:08:59.640>of <00:08:59.840>those <00:09:00.040>words.

136
00:09:03.620 --> 00:09:07.200
<00:09:03.620>So <00:09:03.795>I <00:09:03.970>have <00:09:04.145>one <00:09:04.320>example <00:09:04.495>with <00:09:04.670>V <00:09:04.845>eight <00:09:05.020>ignition.

137
00:09:07.860 --> 00:09:12.560
<00:09:07.860>So <00:09:07.987>when <00:09:08.114>you <00:09:08.241>write <00:09:08.369>JavaScript <00:09:08.496>and <00:09:08.623>execute <00:09:08.750>in <00:09:08.878>a <00:09:09.005>V <00:09:09.132>eight <00:09:09.260>environment,

138
00:09:12.580 --> 00:09:17.120
<00:09:12.580>so <00:09:12.735>like <00:09:12.891>chromium <00:09:13.046>browsers, <00:09:13.202>what <00:09:13.357>happens <00:09:13.513>is <00:09:13.668>the <00:09:13.824>first <00:09:13.980>step,

139
00:09:17.220 --> 00:09:22.200
<00:09:17.220>the <00:09:17.360>ignition <00:09:17.500>compiler <00:09:17.640>takes <00:09:17.780>your <00:09:17.920>JavaScript <00:09:18.060>code <00:09:18.200>and <00:09:18.340>creates <00:09:18.480>a <00:09:18.620>byte

140
00:09:22.200 --> 00:09:25.720
<00:09:22.200>code, <00:09:22.400>which <00:09:22.600>is <00:09:22.800>like <00:09:23.000>optimized <00:09:23.200>and, <00:09:23.400>uh, <00:09:23.600>uh,

141
00:09:25.820 --> 00:09:29.640
<00:09:25.820>all <00:09:25.947>the <00:09:26.074>like <00:09:26.201>different <00:09:26.329>transformations <00:09:26.456>and <00:09:26.583>optimizations <00:09:26.710>that <00:09:26.838>could <00:09:26.965>be <00:09:27.092>done <00:09:27.220>on

142
00:09:29.640 --> 00:09:31.080
<00:09:29.640>your <00:09:29.856>code <00:09:30.072>are <00:09:30.288>done <00:09:30.504>in <00:09:30.720>the <00:09:30.936>step.

143
00:09:31.780 --> 00:09:36.320
<00:09:31.780>And <00:09:31.935>then <00:09:32.091>ignition <00:09:32.246>interpreter <00:09:32.402>takes <00:09:32.557>this <00:09:32.713>bite <00:09:32.868>coat <00:09:33.024>and <00:09:33.180>actually

144
00:09:36.320 --> 00:09:37.400
<00:09:36.320>produces <00:09:36.806>the <00:09:37.292>result.

145
00:09:39.420 --> 00:09:43.920
<00:09:39.420>So <00:09:39.575>instead <00:09:39.731>of <00:09:39.886>categorizing <00:09:40.042>in <00:09:40.197>two, <00:09:40.353>uh, <00:09:40.508>I <00:09:40.664>am, <00:09:40.819>uh,

146
00:09:45.030 --> 00:09:49.650
<00:09:45.030>I'm <00:09:45.137>more <00:09:45.245>in <00:09:45.353>favor <00:09:45.460>categorizing <00:09:45.568>in <00:09:45.676>three. <00:09:45.783>So <00:09:45.891>let's <00:09:45.999>look <00:09:46.106>at <00:09:46.214>the <00:09:46.322>three <00:09:46.430>categories.

147
00:09:50.750 --> 00:09:55.450
<00:09:50.750>The <00:09:50.925>first <00:09:51.100>one <00:09:51.275>is <00:09:51.450>purely, <00:09:51.625>uh, <00:09:51.800>compilers. <00:09:51.975>So, <00:09:52.150>uh,

148
00:09:55.690 --> 00:09:59.690
<00:09:55.690>compiler <00:09:55.830>takes <00:09:55.970>the <00:09:56.110>source <00:09:56.250>code <00:09:56.390>and <00:09:56.530>produces <00:09:56.670>the <00:09:56.810>machine <00:09:56.950>execute <00:09:57.090>table.

149
00:10:00.200 --> 00:10:03.730
<00:10:00.200>Then <00:10:00.340>you <00:10:00.480>can <00:10:00.620>run <00:10:00.760>this <00:10:00.900>machine <00:10:01.040>execute <00:10:01.180>table <00:10:01.320>on <00:10:01.460>your, <00:10:01.600>uh,

150
00:10:04.080 --> 00:10:07.690
<00:10:04.080>like <00:10:04.207>in <00:10:04.334>your <00:10:04.461>operating <00:10:04.589>system <00:10:04.716>without <00:10:04.843>any <00:10:04.970>other <00:10:05.098>additional <00:10:05.225>tools <00:10:05.352>because <00:10:05.480>your,

151
00:10:08.110 --> 00:10:12.210
<00:10:08.110>uh, <00:10:08.310>your <00:10:08.510>machine <00:10:08.710>understands <00:10:08.910>it, <00:10:09.110>understands <00:10:09.310>it, <00:10:09.510>uh,

152
00:10:12.350 --> 00:10:16.510
<00:10:12.350>out <00:10:12.550>of <00:10:12.750>the <00:10:12.950>box. <00:10:13.150>Then <00:10:13.350>the <00:10:13.550>second <00:10:13.750>kind,

153
00:10:16.820 --> 00:10:20.430
<00:10:16.820>this <00:10:16.995>is <00:10:17.170>this <00:10:17.345>example <00:10:17.520>of <00:10:17.695>V <00:10:17.870>eight, <00:10:18.045>uh, <00:10:18.220>ignition.

154
00:10:21.090 --> 00:10:22.790
<00:10:21.090>So <00:10:21.370>you <00:10:21.650>write <00:10:21.930>the <00:10:22.210>source <00:10:22.490>code,

155
00:10:23.060 --> 00:10:26.990
<00:10:23.060>then <00:10:23.215>a <00:10:23.371>compiler <00:10:23.526>step <00:10:23.682>produces <00:10:23.837>a <00:10:23.993>very <00:10:24.148>optimized <00:10:24.304>bite <00:10:24.459>code,

156
00:10:27.890 --> 00:10:32.790
<00:10:27.890>and <00:10:28.064>then <00:10:28.240>interpreter <00:10:28.415>takes <00:10:28.590>the <00:10:28.765>bytecode <00:10:28.939>and <00:10:29.115>produces <00:10:29.290>the

157
00:10:32.790 --> 00:10:37.360
<00:10:32.790>result. <00:10:33.069>And <00:10:33.349>finally, <00:10:33.630>purely <00:10:33.910>interpreters. <00:10:34.189>Uh,

158
00:10:37.700 --> 00:10:41.440
<00:10:37.700>so <00:10:37.900>there's <00:10:38.100>only <00:10:38.300>like <00:10:38.500>one <00:10:38.700>step, <00:10:38.900>uh, <00:10:39.100>uh,

159
00:10:41.550 --> 00:10:46.280
<00:10:41.550>interpreter <00:10:41.677>takes <00:10:41.804>your <00:10:41.931>source <00:10:42.059>code, <00:10:42.186>goes <00:10:42.313>through <00:10:42.440>it, <00:10:42.568>and <00:10:42.695>produces <00:10:42.822>the <00:10:42.949>result.

160
00:10:48.680 --> 00:10:49.580
<00:10:48.680>And <00:10:49.490>actually,

161
00:10:49.580 --> 00:10:54.340
<00:10:49.580>there's <00:10:49.707>a <00:10:49.834>very <00:10:49.961>long <00:10:50.089>road <00:10:50.216>from <00:10:50.343>like <00:10:50.470>writing <00:10:50.598>the <00:10:50.725>source <00:10:50.852>code <00:10:50.980>to

162
00:10:54.340 --> 00:10:58.540
<00:10:54.340>getting <00:10:54.467>the <00:10:54.594>result. <00:10:54.721>So <00:10:54.849>we're <00:10:54.976>going <00:10:55.103>to <00:10:55.230>look <00:10:55.358>at <00:10:55.485>this <00:10:55.612>road <00:10:55.740>today.

163
00:10:58.920 --> 00:11:02.260
<00:10:58.920>So <00:10:59.047>here <00:10:59.174>I <00:10:59.301>have <00:10:59.429>a <00:10:59.556>diagram, <00:10:59.683>like <00:10:59.810>more <00:10:59.938>or <00:11:00.065>less <00:11:00.192>presenting <00:11:00.319>this,

164
00:11:02.760 --> 00:11:05.980
<00:11:02.760>and <00:11:02.993>let's <00:11:03.226>see <00:11:03.460>what's <00:11:03.693>happening <00:11:03.926>here. <00:11:04.160>Uh,

165
00:11:06.400 --> 00:11:09.860
<00:11:06.400>the <00:11:06.516>first <00:11:06.633>part <00:11:06.750>that <00:11:06.866>is <00:11:06.983>a <00:11:07.100>common <00:11:07.216>part <00:11:07.333>for <00:11:07.449>all <00:11:07.566>those <00:11:07.683>different <00:11:07.800>paths,

166
00:11:09.860 --> 00:11:12.620
<00:11:09.860>like <00:11:10.093>whether <00:11:10.326>it's <00:11:10.560>interpreted <00:11:10.793>or <00:11:11.026>compiled, <00:11:11.260>uh,

167
00:11:12.800 --> 00:11:16.140
<00:11:12.800>we <00:11:12.955>first <00:11:13.111>have <00:11:13.266>to <00:11:13.422>do <00:11:13.577>something <00:11:13.733>called <00:11:13.888>scanning <00:11:14.044>and <00:11:14.199>parsing.

168
00:11:16.640 --> 00:11:19.900
<00:11:16.640>So <00:11:16.840>the <00:11:17.040>scanner <00:11:17.240>takes <00:11:17.439>your <00:11:17.640>code <00:11:17.840>and, <00:11:18.040>uh,

169
00:11:20.220 --> 00:11:23.620
<00:11:20.220>produces <00:11:20.420>a <00:11:20.620>stream <00:11:20.820>of <00:11:21.020>tokens <00:11:21.220>from <00:11:21.420>your <00:11:21.620>code.

170
00:11:24.000 --> 00:11:27.460
<00:11:24.000>So <00:11:24.175>like <00:11:24.350>the <00:11:24.525>very <00:11:24.700>minimal <00:11:24.875>meaningful <00:11:25.050>pieces <00:11:25.225>of <00:11:25.400>information.

171
00:11:28.080 --> 00:11:30.820
<00:11:28.080>And <00:11:28.313>then <00:11:28.546>parser <00:11:28.780>creates <00:11:29.013>a <00:11:29.246>syntax <00:11:29.480>tree.

172
00:11:30.820 --> 00:11:35.260
<00:11:30.820>You <00:11:30.947>might <00:11:31.074>have <00:11:31.201>heard <00:11:31.329>terms <00:11:31.456>like <00:11:31.583>abstract <00:11:31.710>syntax <00:11:31.838>tree <00:11:31.965>or <00:11:32.092>pars <00:11:32.220>three.

173
00:11:35.530 --> 00:11:38.820
<00:11:35.530>Technically <00:11:35.670>they <00:11:35.810>are, <00:11:35.949>there <00:11:36.089>are <00:11:36.230>some <00:11:36.370>small <00:11:36.510>differences <00:11:36.650>between <00:11:36.790>these <00:11:36.930>two,

174
00:11:38.820 --> 00:11:42.260
<00:11:38.820>but <00:11:38.975>I'm <00:11:39.131>gonna <00:11:39.286>use, <00:11:39.442>uh, <00:11:39.597>this, <00:11:39.753>this <00:11:39.908>terms <00:11:40.064>interchangeably <00:11:40.220>today.

175
00:11:42.960 --> 00:11:47.580
<00:11:42.960>So <00:11:43.160>basically <00:11:43.360>parser <00:11:43.560>gives <00:11:43.760>context <00:11:43.960>to <00:11:44.160>the <00:11:44.360>tokens.

176
00:11:47.580 --> 00:11:51.500
<00:11:47.580>So <00:11:47.707>for <00:11:47.834>example, <00:11:47.961>when <00:11:48.089>it <00:11:48.216>says <00:11:48.343>a <00:11:48.470>cons <00:11:48.598>keyword, <00:11:48.725>and <00:11:48.852>then, <00:11:48.980>uh,

177
00:11:51.640 --> 00:11:54.840
<00:11:51.640>it <00:11:51.780>says <00:11:51.920>that <00:11:52.060>there's <00:11:52.199>gonna <00:11:52.340>be <00:11:52.480>an <00:11:52.620>equal <00:11:52.760>token. <00:11:52.900>Later <00:11:53.040>on,

178
00:11:54.860 --> 00:11:57.680
<00:11:54.860>it <00:11:55.015>can <00:11:55.171>deduce <00:11:55.326>or <00:11:55.482>there's <00:11:55.637>gonna <00:11:55.793>be <00:11:55.948>a <00:11:56.104>variable <00:11:56.260>declaration.

179
00:11:59.510 --> 00:12:02.490
<00:11:59.510>And <00:11:59.650>if <00:11:59.790>we <00:11:59.930>go, <00:12:00.069>if <00:12:00.210>we <00:12:00.350>branch <00:12:00.490>out <00:12:00.630>from <00:12:00.770>this <00:12:00.910>step,

180
00:12:02.660 --> 00:12:07.370
<00:12:02.660>we're <00:12:02.767>gonna <00:12:02.875>have <00:12:02.983>a <00:12:03.090>very <00:12:03.198>minimal <00:12:03.306>interpreter. <00:12:03.413>So <00:12:03.521>based <00:12:03.629>on <00:12:03.736>the <00:12:03.844>syntax <00:12:03.952>three, <00:12:04.060>uh,

181
00:12:07.630 --> 00:12:11.970
<00:12:07.630>we <00:12:07.757>can <00:12:07.884>like <00:12:08.011>go <00:12:08.139>through <00:12:08.266>it <00:12:08.393>note <00:12:08.520>by <00:12:08.648>note <00:12:08.775>and <00:12:08.902>evaluate <00:12:09.030>it,

182
00:12:12.550 --> 00:12:14.410
<00:12:12.550>and <00:12:12.783>that <00:12:13.016>will <00:12:13.250>give <00:12:13.483>us <00:12:13.716>a <00:12:13.949>result.

183
00:12:15.350 --> 00:12:19.370
<00:12:15.350>But <00:12:15.505>we <00:12:15.661>can <00:12:15.816>also <00:12:15.972>go <00:12:16.127>further <00:12:16.283>to <00:12:16.438>an <00:12:16.594>analysis <00:12:16.750>step.

184
00:12:19.910 --> 00:12:21.450
<00:12:19.910>And <00:12:20.256>in <00:12:20.603>this <00:12:20.949>step, <00:12:21.296>um,

185
00:12:21.760 --> 00:12:25.690
<00:12:21.760>that <00:12:21.887>usually <00:12:22.014>means <00:12:22.141>like <00:12:22.269>going <00:12:22.396>through <00:12:22.523>the <00:12:22.650>past <00:12:22.778>three <00:12:22.905>and <00:12:23.032>picking <00:12:23.160>up,

186
00:12:25.690 --> 00:12:30.450
<00:12:25.690>picking <00:12:25.797>up <00:12:25.905>some <00:12:26.013>information <00:12:26.120>that <00:12:26.228>will <00:12:26.336>be <00:12:26.443>used <00:12:26.551>in <00:12:26.659>later <00:12:26.766>steps. <00:12:26.874>So <00:12:26.982>for <00:12:27.090>example,

187
00:12:30.590 --> 00:12:33.610
<00:12:30.590>adding <00:12:30.823>some <00:12:31.056>metadata <00:12:31.290>to <00:12:31.523>each <00:12:31.756>node, <00:12:31.990>uh,

188
00:12:33.910 --> 00:12:37.730
<00:12:33.910>or <00:12:34.037>also <00:12:34.164>keeping <00:12:34.291>track <00:12:34.419>of <00:12:34.546>all <00:12:34.673>the <00:12:34.800>environments, <00:12:34.928>like <00:12:35.055>all <00:12:35.182>the <00:12:35.310>scopes.

189
00:12:37.730 --> 00:12:40.690
<00:12:37.730>So <00:12:37.870>for <00:12:38.010>example, <00:12:38.150>if <00:12:38.290>you <00:12:38.430>are <00:12:38.570>inside <00:12:38.710>of <00:12:38.850>a <00:12:38.990>function's <00:12:39.130>body,

190
00:12:41.200 --> 00:12:44.410
<00:12:41.200>like <00:12:41.316>what <00:12:41.433>are <00:12:41.550>all <00:12:41.666>the <00:12:41.783>variables <00:12:41.900>that <00:12:42.016>we <00:12:42.133>can <00:12:42.250>access <00:12:42.366>from <00:12:42.483>the <00:12:42.600>insights?

191
00:12:44.430 --> 00:12:47.970
<00:12:44.430>So <00:12:44.604>this <00:12:44.780>step <00:12:44.954>like <00:12:45.130>produces <00:12:45.305>those, <00:12:45.479>uh, <00:12:45.655>environment <00:12:45.829>months,

192
00:12:50.080 --> 00:12:54.900
<00:12:50.080>and <00:12:50.220>then <00:12:50.360>we <00:12:50.500>are <00:12:50.640>going <00:12:50.780>into <00:12:50.920>the <00:12:51.060>world <00:12:51.200>of <00:12:51.340>compilers. <00:12:51.480>And,

193
00:12:55.240 --> 00:12:58.260
<00:12:55.240>uh, <00:12:55.395>there <00:12:55.551>can <00:12:55.706>be <00:12:55.862>a <00:12:56.017>bunch <00:12:56.173>of <00:12:56.328>optimizations <00:12:56.484>going <00:12:56.640>on.

194
00:12:58.690 --> 00:13:02.660
<00:12:58.690>It's <00:12:58.890>usually <00:12:59.090>some <00:12:59.290>kind <00:12:59.490>of <00:12:59.690>intermediate <00:12:59.890>representations <00:13:00.090>representation,

195
00:13:03.110 --> 00:13:07.460
<00:13:03.110>which <00:13:03.226>makes <00:13:03.343>it <00:13:03.460>easier <00:13:03.576>to <00:13:03.693>like, <00:13:03.810>produce <00:13:03.926>different <00:13:04.043>kind <00:13:04.160>of <00:13:04.276>languages <00:13:04.393>from <00:13:04.510>it.

196
00:13:08.280 --> 00:13:12.420
<00:13:08.280>And <00:13:08.407>you <00:13:08.534>can <00:13:08.661>think <00:13:08.789>of <00:13:08.916>those <00:13:09.043>optimization <00:13:09.170>steps <00:13:09.298>as <00:13:09.425>like <00:13:09.552>a <00:13:09.680>chain.

197
00:13:12.520 --> 00:13:16.060
<00:13:12.520>And <00:13:12.627>each <00:13:12.735>step <00:13:12.843>produces <00:13:12.950>something <00:13:13.058>that <00:13:13.166>will <00:13:13.273>be <00:13:13.381>picked <00:13:13.489>up <00:13:13.596>by <00:13:13.704>the <00:13:13.812>next <00:13:13.920>one.

198
00:13:16.960 --> 00:13:21.740
<00:13:16.960>And <00:13:17.100>from <00:13:17.240>there <00:13:17.380>we <00:13:17.520>can <00:13:17.660>go <00:13:17.800>into <00:13:17.940>another <00:13:18.080>language. <00:13:18.220>So, <00:13:18.360>uh,

199
00:13:21.910 --> 00:13:25.260
<00:13:21.910>those <00:13:22.110>kind <00:13:22.310>of <00:13:22.510>compilers <00:13:22.709>are <00:13:22.910>usually <00:13:23.110>called <00:13:23.310>transpilers.

200
00:13:25.720 --> 00:13:29.980
<00:13:25.720>So <00:13:25.860>they <00:13:26.000>produce <00:13:26.140>a <00:13:26.280>language <00:13:26.420>on <00:13:26.560>a <00:13:26.700>similar <00:13:26.840>level <00:13:26.980>of <00:13:27.120>obstruction.

201
00:13:30.520 --> 00:13:33.500
<00:13:30.520>We <00:13:30.660>can <00:13:30.800>go <00:13:30.939>into <00:13:31.079>the <00:13:31.220>bytecode, <00:13:31.360>the <00:13:31.500>bytecode <00:13:31.640>will <00:13:31.780>be <00:13:31.920>done,

202
00:13:33.890 --> 00:13:36.580
<00:13:33.890>interpreted <00:13:34.240>by <00:13:34.590>a <00:13:34.939>separate <00:13:35.290>interpreter,

203
00:13:37.200 --> 00:13:39.860
<00:13:37.200>or <00:13:37.400>it <00:13:37.600>can <00:13:37.800>also <00:13:38.000>produce <00:13:38.200>a <00:13:38.400>machine <00:13:38.600>code.

204
00:13:41.120 --> 00:13:45.980
<00:13:41.120>And <00:13:41.220>today <00:13:41.320>we're <00:13:41.420>going <00:13:41.520>to <00:13:41.620>look <00:13:41.720>into <00:13:41.820>this <00:13:41.920>path <00:13:42.020>and <00:13:42.120>we're <00:13:42.220>going <00:13:42.320>to <00:13:42.420>see <00:13:42.520>how

205
00:13:46.320 --> 00:13:47.540
<00:13:46.320>Ang <00:13:46.686>is <00:13:47.052>doing <00:13:47.418>this.

206
00:13:49.440 --> 00:13:52.900
<00:13:49.440>So <00:13:49.615>let's <00:13:49.790>dive <00:13:49.965>into <00:13:50.140>the <00:13:50.315>code <00:13:50.490>Without <00:13:50.665>further <00:13:50.840>ado.

207
00:13:54.660 --> 00:13:58.530
<00:13:54.660>First, <00:13:54.787>uh, <00:13:54.914>you'll <00:13:55.041>need <00:13:55.169>to <00:13:55.296>tell <00:13:55.423>me <00:13:55.550>if <00:13:55.678>this <00:13:55.805>is <00:13:55.932>big <00:13:56.060>enough.

208
00:14:00.150 --> 00:14:03.680
<00:14:00.150>Okay, <00:14:00.290>I <00:14:00.430>see <00:14:00.569>a <00:14:00.709>lot <00:14:00.850>of <00:14:00.990>thumbs <00:14:01.130>up. <00:14:01.270>Cool. <00:14:01.410>So, <00:14:01.550>uh,

209
00:14:05.490 --> 00:14:09.480
<00:14:05.490>to <00:14:05.770>demonstrate <00:14:06.050>the <00:14:06.330>language <00:14:06.610>I <00:14:06.890>created,

210
00:14:10.460 --> 00:14:15.090
<00:14:10.460>uh, <00:14:10.635>a <00:14:10.810>small <00:14:10.985>application, <00:14:11.160>is <00:14:11.335>this <00:14:11.510>also <00:14:11.685>big <00:14:11.860>enough?

211
00:14:16.080 --> 00:14:16.913
<00:14:16.080>Okay, <00:14:16.829>awesome.

212
00:14:17.190 --> 00:14:20.770
<00:14:17.190>So <00:14:17.306>I <00:14:17.423>created <00:14:17.540>the <00:14:17.656>small <00:14:17.773>application <00:14:17.890>to <00:14:18.006>like <00:14:18.123>visualize <00:14:18.240>different <00:14:18.356>parts <00:14:18.473>of <00:14:18.590>the

213
00:14:21.050 --> 00:14:25.730
<00:14:21.050>language. <00:14:21.250>And, <00:14:21.449>uh, <00:14:21.650>this <00:14:21.849>is <00:14:22.050>the <00:14:22.250>Ang <00:14:22.449>syntax.

214
00:14:26.550 --> 00:14:31.090
<00:14:26.550>And <00:14:26.677>here <00:14:26.804>the <00:14:26.931>first, <00:14:27.059>uh, <00:14:27.186>the <00:14:27.313>first <00:14:27.440>step <00:14:27.568>when, <00:14:27.695>you <00:14:27.822>know, <00:14:27.949>uh,

215
00:14:31.310 --> 00:14:35.930
<00:14:31.310>trying <00:14:31.426>to <00:14:31.543>get <00:14:31.660>a <00:14:31.776>result <00:14:31.893>from <00:14:32.010>the <00:14:32.126>code <00:14:32.243>is <00:14:32.359>tokenize <00:14:32.476>the, <00:14:32.593>the <00:14:32.709>waxing,

216
00:14:36.510 --> 00:14:41.490
<00:14:36.510>uh, <00:14:36.685>part. <00:14:36.860>So <00:14:37.035>we <00:14:37.210>can <00:14:37.385>see <00:14:37.560>that <00:14:37.735>our <00:14:37.910>lecture,

217
00:14:42.270 --> 00:14:46.770
<00:14:42.270>uh, <00:14:42.386>part, <00:14:42.503>uh, <00:14:42.620>created <00:14:42.736>a <00:14:42.853>stream <00:14:42.970>of <00:14:43.086>tokens. <00:14:43.203>So <00:14:43.319>we <00:14:43.436>have <00:14:43.553>lead <00:14:43.670>keyword.

218
00:14:47.510 --> 00:14:49.890
<00:14:47.510>We <00:14:47.743>know <00:14:47.976>that <00:14:48.210>ad <00:14:48.443>is <00:14:48.676>an <00:14:48.910>identifier.

219
00:14:49.990 --> 00:14:54.960
<00:14:49.990>We <00:14:50.106>have <00:14:50.223>a <00:14:50.340>bunch <00:14:50.456>of <00:14:50.573>tokens <00:14:50.690>like <00:14:50.806>equals <00:14:50.923>or <00:14:51.040>plus. <00:14:51.156>And <00:14:51.273>it <00:14:51.390>also,

220
00:14:55.340 --> 00:14:59.760
<00:14:55.340>uh, <00:14:55.480>it <00:14:55.620>also, <00:14:55.760>uh, <00:14:55.900>knows <00:14:56.040>that <00:14:56.180>there <00:14:56.320>are <00:14:56.460>like <00:14:56.600>left <00:14:56.740>parents,

221
00:15:00.290 --> 00:15:04.840
<00:15:00.290>right <00:15:00.417>parents, <00:15:00.544>and <00:15:00.671>so <00:15:00.799>on. <00:15:00.926>So <00:15:01.053>now <00:15:01.180>let's <00:15:01.308>look <00:15:01.435>at <00:15:01.562>the <00:15:01.689>code.

222
00:15:05.380 --> 00:15:08.880
<00:15:05.380>Um, <00:15:05.613>there <00:15:05.846>are <00:15:06.080>different <00:15:06.313>tools <00:15:06.546>that, <00:15:06.780>uh,

223
00:15:08.880 --> 00:15:11.840
<00:15:08.880>like <00:15:09.035>in <00:15:09.191>JavaScript <00:15:09.346>that <00:15:09.502>allow <00:15:09.657>you <00:15:09.813>to <00:15:09.968>write <00:15:10.124>a <00:15:10.280>grammar,

224
00:15:11.980 --> 00:15:16.200
<00:15:11.980>and <00:15:12.080>then <00:15:12.180>they <00:15:12.280>just <00:15:12.380>produce <00:15:12.480>like <00:15:12.580>some <00:15:12.680>utilities <00:15:12.780>for <00:15:12.880>you <00:15:12.980>to <00:15:13.080>be <00:15:13.180>able <00:15:13.280>to <00:15:13.380>create

225
00:15:16.520 --> 00:15:21.440
<00:15:16.520>languages <00:15:16.636>very, <00:15:16.753>very <00:15:16.870>fast <00:15:16.986>and <00:15:17.103>very, <00:15:17.220>very <00:15:17.336>easily. <00:15:17.453>Uh, <00:15:17.569>I'm <00:15:17.686>not <00:15:17.803>using, <00:15:17.920>uh,

226
00:15:21.730 --> 00:15:26.480
<00:15:21.730>those <00:15:21.857>kind <00:15:21.984>of <00:15:22.111>tools. <00:15:22.239>I'm <00:15:22.366>using <00:15:22.493>something <00:15:22.620>called, <00:15:22.748>uh, <00:15:22.875>types <00:15:23.002>strip <00:15:23.130>parsec.

227
00:15:27.100 --> 00:15:32.040
<00:15:27.100>So <00:15:27.227>types <00:15:27.354>two <00:15:27.481>parsec <00:15:27.609>is, <00:15:27.736>I <00:15:27.863>think <00:15:27.990>I <00:15:28.118>have <00:15:28.245>the <00:15:28.372>GitHub <00:15:28.500>here.

228
00:15:32.590 --> 00:15:37.560
<00:15:32.590>This <00:15:32.745>is <00:15:32.901>a <00:15:33.056>very <00:15:33.212>minimal <00:15:33.367>tool <00:15:33.523>from <00:15:33.678>Microsoft. <00:15:33.834>Um, <00:15:33.990>it's,

229
00:15:37.560 --> 00:15:42.160
<00:15:37.560>it's <00:15:37.687>a <00:15:37.814>set <00:15:37.941>of <00:15:38.069>utilities <00:15:38.196>to <00:15:38.323>be <00:15:38.450>able <00:15:38.578>to <00:15:38.705>create <00:15:38.832>parsers <00:15:38.959>and

230
00:15:42.160 --> 00:15:47.040
<00:15:42.160>lectures. <00:15:42.276>So <00:15:42.393>we're <00:15:42.510>going <00:15:42.626>to <00:15:42.743>see <00:15:42.860>that <00:15:42.976>in <00:15:43.093>action <00:15:43.209>right <00:15:43.326>now. <00:15:43.443>So <00:15:43.560>first,

231
00:15:47.040 --> 00:15:50.320
<00:15:47.040>what's <00:15:47.156>going <00:15:47.273>on <00:15:47.390>in <00:15:47.506>the <00:15:47.623>code? <00:15:47.740>I <00:15:47.856>have <00:15:47.973>this <00:15:48.089>inam <00:15:48.206>to <00:15:48.323>just <00:15:48.439>say,

232
00:15:50.390 --> 00:15:53.480
<00:15:50.390>what <00:15:50.564>are <00:15:50.740>all <00:15:50.915>the <00:15:51.090>possible <00:15:51.265>tokens? <00:15:51.439>In <00:15:51.615>my <00:15:51.790>language?

233
00:15:54.390 --> 00:15:58.370
<00:15:54.390>You <00:15:54.490>see <00:15:54.590>that <00:15:54.689>there <00:15:54.790>aren't <00:15:54.890>that <00:15:54.990>many <00:15:55.090>of <00:15:55.189>them, <00:15:55.290>but <00:15:55.390>we <00:15:55.490>can <00:15:55.590>always <00:15:55.689>extend <00:15:55.790>it.

234
00:15:59.390 --> 00:16:03.860
<00:15:59.390>Um, <00:15:59.623>and <00:15:59.856>then <00:16:00.090>I <00:16:00.323>have <00:16:00.556>this <00:16:00.790>lecture,

235
00:16:04.280 --> 00:16:08.580
<00:16:04.280>I'm <00:16:04.420>using <00:16:04.560>built <00:16:04.699>lecture <00:16:04.839>from <00:16:04.980>TSS <00:16:05.120>Parsec. <00:16:05.260>And <00:16:05.400>what's <00:16:05.540>happening <00:16:05.680>here,

236
00:16:08.880 --> 00:16:13.060
<00:16:08.880>I'm <00:16:09.035>telling <00:16:09.191>this <00:16:09.346>lecture <00:16:09.502>how <00:16:09.657>to <00:16:09.813>behave. <00:16:09.968>So <00:16:10.124>for <00:16:10.280>example,

237
00:16:13.170 --> 00:16:15.740
<00:16:13.170>when <00:16:13.449>it <00:16:13.729>says, <00:16:14.010>uh, <00:16:14.290>new <00:16:14.569>line,

238
00:16:16.330 --> 00:16:20.540
<00:16:16.330>then <00:16:16.470>this <00:16:16.610>needs <00:16:16.750>to <00:16:16.890>be <00:16:17.030>interpreted <00:16:17.170>as <00:16:17.310>token <00:16:17.450>kind <00:16:17.590>new <00:16:17.730>line.

239
00:16:20.960 --> 00:16:24.700
<00:16:20.960>Or <00:16:21.067>when <00:16:21.175>it <00:16:21.283>says <00:16:21.390>a <00:16:21.498>number, <00:16:21.606>this <00:16:21.713>is <00:16:21.821>gonna <00:16:21.929>be <00:16:22.036>a <00:16:22.144>token <00:16:22.252>kind <00:16:22.360>number.

240
00:16:25.240 --> 00:16:30.220
<00:16:25.240>The <00:16:25.380>first <00:16:25.520>one, <00:16:25.660>uh, <00:16:25.800>parameter, <00:16:25.940>this <00:16:26.080>bullion, <00:16:26.220>uh, <00:16:26.360>it's, <00:16:26.500>it's <00:16:26.640>telling,

241
00:16:30.560 --> 00:16:34.940
<00:16:30.560>uh, <00:16:30.676>tss <00:16:30.793>parsec <00:16:30.910>whether <00:16:31.026>to <00:16:31.143>ignore <00:16:31.260>this <00:16:31.376>or <00:16:31.493>not. <00:16:31.609>So <00:16:31.726>for <00:16:31.843>example, <00:16:31.959>here,

242
00:16:36.220 --> 00:16:40.620
<00:16:36.220>I, <00:16:36.320>I <00:16:36.420>don't <00:16:36.520>care <00:16:36.620>about <00:16:36.720>spaces, <00:16:36.820>so <00:16:36.920>I <00:16:37.020>want <00:16:37.120>the <00:16:37.220>lecture <00:16:37.320>to <00:16:37.420>just <00:16:37.520>ignore <00:16:37.620>them,

243
00:16:40.620 --> 00:16:43.300
<00:16:40.620>like <00:16:40.900>be <00:16:41.180>able <00:16:41.460>to <00:16:41.740>categorize <00:16:42.020>it,

244
00:16:43.520 --> 00:16:48.420
<00:16:43.520>but <00:16:43.720>don't <00:16:43.920>actually <00:16:44.120>show <00:16:44.319>it <00:16:44.520>to <00:16:44.720>me <00:16:44.920>here.

245
00:16:49.760 --> 00:16:52.860
<00:16:49.760>So <00:16:49.960>this <00:16:50.160>is <00:16:50.360>the <00:16:50.560>lecture <00:16:50.760>part. <00:16:50.960>And, <00:16:51.160>um,

246
00:16:53.550 --> 00:16:56.900
<00:16:53.550>every <00:16:53.705>single <00:16:53.861>time <00:16:54.016>if <00:16:54.172>I <00:16:54.327>do <00:16:54.483>something <00:16:54.638>that <00:16:54.794>is <00:16:54.949>like,

247
00:16:56.900 --> 00:17:01.060
<00:16:56.900>if <00:16:57.000>I <00:16:57.100>type <00:16:57.199>something <00:16:57.300>that <00:16:57.400>is <00:16:57.500>not <00:16:57.600>allowed <00:16:57.699>by <00:16:57.800>a, <00:16:57.900>uh, <00:16:58.000>language. <00:16:58.100>So <00:16:58.199>for <00:16:58.300>example,

248
00:17:01.800 --> 00:17:03.020
<00:17:01.800>oh <00:17:02.074>yeah, <00:17:02.348>something <00:17:02.623>like <00:17:02.898>that.

249
00:17:03.670 --> 00:17:07.540
<00:17:03.670>It'll <00:17:03.770>give <00:17:03.870>me <00:17:03.969>an <00:17:04.069>error <00:17:04.169>that <00:17:04.270>it's <00:17:04.369>unable <00:17:04.470>to <00:17:04.569>tokenize <00:17:04.669>the <00:17:04.770>rest <00:17:04.869>of <00:17:04.970>the <00:17:05.069>input

250
00:17:07.540 --> 00:17:11.100
<00:17:07.540>because <00:17:07.773>it <00:17:08.006>doesn't <00:17:08.240>know <00:17:08.473>what <00:17:08.706>this <00:17:08.940>is.

251
00:17:13.780 --> 00:17:18.070
<00:17:13.780>Okay, <00:17:13.980>and <00:17:14.180>now <00:17:14.379>let's <00:17:14.579>see <00:17:14.780>the <00:17:14.980>parser. <00:17:15.180>So,

252
00:17:19.090 --> 00:17:23.110
<00:17:19.089>uh, <00:17:19.245>I <00:17:19.401>will <00:17:19.556>open <00:17:19.712>the <00:17:19.867>parser <00:17:20.023>file. <00:17:20.178>We'll <00:17:20.334>close <00:17:20.490>this.

253
00:17:23.690 --> 00:17:26.310
<00:17:23.690>So <00:17:24.040>with <00:17:24.390>Times <00:17:24.740>Square <00:17:25.090>parsec,

254
00:17:26.450 --> 00:17:31.150
<00:17:26.450>you <00:17:26.605>create <00:17:26.761>rules <00:17:26.916>for <00:17:27.072>different <00:17:27.227>kinds <00:17:27.383>of <00:17:27.538>expression. <00:17:27.694>So, <00:17:27.850>um,

255
00:17:31.490 --> 00:17:35.590
<00:17:31.490>my <00:17:31.630>expression <00:17:31.770>in <00:17:31.910>my <00:17:32.050>language <00:17:32.190>are, <00:17:32.330>for <00:17:32.470>example, <00:17:32.610>numerical, <00:17:32.750>uh, <00:17:32.890>numeric,

256
00:17:35.590 --> 00:17:37.950
<00:17:35.590>literal <00:17:36.290>identifier <00:17:36.990>term.

257
00:17:38.670 --> 00:17:42.430
<00:17:38.670>I <00:17:38.825>have <00:17:38.981>a <00:17:39.136>bunch <00:17:39.292>of <00:17:39.447>automatic <00:17:39.603>expressions <00:17:39.758>like <00:17:39.914>ary <00:17:40.070>expression,

258
00:17:42.950 --> 00:17:47.390
<00:17:42.950>multiplicative <00:17:43.230>power, <00:17:43.510>additive <00:17:43.790>assignment, <00:17:44.070>uh, <00:17:44.350>expression.

259
00:17:47.390 --> 00:17:51.520
<00:17:47.390>So <00:17:47.545>I <00:17:47.701>can <00:17:47.856>assign, <00:17:48.012>uh, <00:17:48.167>some <00:17:48.323>expressions <00:17:48.478>to <00:17:48.634>a <00:17:48.790>variable.

260
00:17:52.580 --> 00:17:57.320
<00:17:52.580>Uh, <00:17:52.720>we <00:17:52.860>can <00:17:53.000>also <00:17:53.139>have <00:17:53.280>function <00:17:53.419>expressions. <00:17:53.560>And <00:17:53.699>finally, <00:17:53.840>function <00:17:53.980>calls.

261
00:17:57.780 --> 00:18:02.600
<00:17:57.780>And <00:17:57.920>the <00:17:58.060>whole <00:17:58.200>thing, <00:17:58.340>uh, <00:17:58.480>is <00:17:58.620>being <00:17:58.760>wrapped <00:17:58.899>with <00:17:59.040>a <00:17:59.180>program.

262
00:18:02.820 --> 00:18:06.800
<00:18:02.820>So <00:18:02.913>if <00:18:03.006>you <00:18:03.100>take <00:18:03.193>a <00:18:03.286>look <00:18:03.379>at <00:18:03.473>the <00:18:03.566>three, <00:18:03.659>then <00:18:03.753>there's <00:18:03.846>a <00:18:03.939>program <00:18:04.033>at <00:18:04.126>the <00:18:04.220>top.

263
00:18:07.220 --> 00:18:10.480
<00:18:07.220>And <00:18:07.375>the <00:18:07.531>program, <00:18:07.686>what <00:18:07.842>it <00:18:07.997>has, <00:18:08.153>it <00:18:08.308>has <00:18:08.464>different <00:18:08.620>statements.

264
00:18:11.150 --> 00:18:15.560
<00:18:11.150>When <00:18:11.257>you <00:18:11.365>see <00:18:11.473>this <00:18:11.580>cloud, <00:18:11.688>there <00:18:11.796>are <00:18:11.903>two <00:18:12.011>statements. <00:18:12.119>The <00:18:12.226>first <00:18:12.334>one <00:18:12.442>is, <00:18:12.550>oh,

265
00:18:15.680 --> 00:18:17.880
<00:18:15.680>I <00:18:15.960>can <00:18:16.240>actually, <00:18:16.520>uh, <00:18:16.800>hover <00:18:17.080>it.

266
00:18:18.340 --> 00:18:22.600
<00:18:18.340>It <00:18:18.456>took <00:18:18.573>me <00:18:18.689>more <00:18:18.806>like <00:18:18.923>the <00:18:19.040>whole <00:18:19.156>highlighting <00:18:19.273>than <00:18:19.389>actually <00:18:19.506>writing <00:18:19.623>this <00:18:19.740>language.

267
00:18:22.620 --> 00:18:27.120
<00:18:22.620>So <00:18:22.760>please <00:18:22.899>appreciate <00:18:23.040>it. <00:18:23.179>And <00:18:23.320>so <00:18:23.459>this <00:18:23.600>is <00:18:23.739>the <00:18:23.879>first <00:18:24.020>expression,

268
00:18:27.140 --> 00:18:28.520
<00:18:27.140>the <00:18:27.761>variable <00:18:28.382>declaration,

269
00:18:29.140 --> 00:18:33.520
<00:18:29.140>and <00:18:29.340>the <00:18:29.540>next <00:18:29.740>expression <00:18:29.940>is <00:18:30.140>the <00:18:30.340>function <00:18:30.540>call.

270
00:18:33.980 --> 00:18:37.840
<00:18:33.980>So <00:18:34.180>how <00:18:34.380>those <00:18:34.580>rules <00:18:34.780>look <00:18:34.980>like. <00:18:35.180>So, <00:18:35.380>uh,

271
00:18:38.170 --> 00:18:42.840
<00:18:38.170>maybe <00:18:38.286>let's <00:18:38.403>go <00:18:38.520>to <00:18:38.636>the <00:18:38.753>bottom. <00:18:38.870>So <00:18:38.986>let's <00:18:39.103>see, <00:18:39.220>what <00:18:39.336>is <00:18:39.453>the <00:18:39.570>program?

272
00:18:43.220 --> 00:18:48.080
<00:18:43.220>So <00:18:43.420>here <00:18:43.620>using, <00:18:43.820>uh, <00:18:44.020>TypeScript <00:18:44.220>Parsec, <00:18:44.420>uh, <00:18:44.620>utilities,

273
00:18:49.080 --> 00:18:50.360
<00:18:49.080>I <00:18:49.464>am <00:18:49.848>creating <00:18:50.232>rules.

274
00:18:50.500 --> 00:18:54.960
<00:18:50.500>So <00:18:50.616>here <00:18:50.733>I'm <00:18:50.850>saying <00:18:50.966>that <00:18:51.083>programs <00:18:51.200>program <00:18:51.316>is <00:18:51.433>something <00:18:51.550>that <00:18:51.666>has <00:18:51.783>a <00:18:51.900>sequence.

275
00:18:55.510 --> 00:18:56.720
<00:18:55.510>It's <00:18:55.873>an <00:18:56.236>optional <00:18:56.599>sequence,

276
00:18:56.720 --> 00:19:01.240
<00:18:56.720>because <00:18:56.875>program <00:18:57.031>without <00:18:57.186>any <00:18:57.342>statements <00:18:57.497>is <00:18:57.653>still <00:18:57.808>valid. <00:18:57.964>And <00:18:58.120>this,

277
00:19:01.710 --> 00:19:06.480
<00:19:01.710>this <00:19:01.865>is <00:19:02.021>a <00:19:02.176>sequence <00:19:02.332>of <00:19:02.487>expressions <00:19:02.643>that <00:19:02.798>are <00:19:02.954>being <00:19:03.110>separated

278
00:19:06.750 --> 00:19:09.840
<00:19:06.750>with <00:19:06.983>a <00:19:07.216>token <00:19:07.450>new <00:19:07.683>line. <00:19:07.916>And <00:19:08.150>there's,

279
00:19:09.840 --> 00:19:12.640
<00:19:09.840>that <00:19:09.980>can <00:19:10.120>also <00:19:10.260>be <00:19:10.399>an <00:19:10.540>optional <00:19:10.679>new <00:19:10.820>line <00:19:10.959>at <00:19:11.100>the <00:19:11.240>end.

280
00:19:14.270 --> 00:19:17.650
<00:19:14.270>And <00:19:14.410>then <00:19:14.550>when <00:19:14.690>I <00:19:14.830>have <00:19:14.970>a <00:19:15.110>match, <00:19:15.250>when <00:19:15.389>tro <00:19:15.530>parsec, <00:19:15.670>uh,

281
00:19:18.710 --> 00:19:21.810
<00:19:18.710>can <00:19:18.910>actually <00:19:19.110>match <00:19:19.310>my <00:19:19.510>coat <00:19:19.710>to <00:19:19.910>this <00:19:20.110>row,

282
00:19:22.640 --> 00:19:27.130
<00:19:22.640>then <00:19:22.756>I'm <00:19:22.873>saying <00:19:22.990>that, <00:19:23.106>um, <00:19:23.223>okay, <00:19:23.340>my <00:19:23.456>note <00:19:23.573>is <00:19:23.690>gonna <00:19:23.806>look <00:19:23.923>like <00:19:24.040>that.

283
00:19:27.200 --> 00:19:30.970
<00:19:27.200>There's <00:19:27.340>gonna <00:19:27.480>be <00:19:27.620>a <00:19:27.760>kind <00:19:27.900>program, <00:19:28.040>program <00:19:28.180>is <00:19:28.320>gonna <00:19:28.460>have <00:19:28.600>statements.

284
00:19:31.550 --> 00:19:36.290
<00:19:31.550>And <00:19:31.677>I <00:19:31.804>also <00:19:31.931>have <00:19:32.059>this <00:19:32.186>meta <00:19:32.313>property. <00:19:32.440>And, <00:19:32.568>uh, <00:19:32.695>I <00:19:32.822>have <00:19:32.950>like,

285
00:19:36.320 --> 00:19:40.050
<00:19:36.320>from <00:19:36.475>and <00:19:36.631>to, <00:19:36.786>and <00:19:36.942>basically <00:19:37.097>my, <00:19:37.253>uh, <00:19:37.408>my, <00:19:37.564>like <00:19:37.720>the,

286
00:19:40.070 --> 00:19:44.570
<00:19:40.070>the <00:19:40.186>major <00:19:40.303>motivation <00:19:40.419>was <00:19:40.536>to <00:19:40.653>do <00:19:40.770>those <00:19:40.886>highlights <00:19:41.003>and <00:19:41.120>be <00:19:41.236>able <00:19:41.353>to <00:19:41.470>like,

287
00:19:44.910 --> 00:19:49.250
<00:19:44.910>you <00:19:45.050>know, <00:19:45.190>actually <00:19:45.330>show <00:19:45.470>different <00:19:45.610>kinds <00:19:45.750>of <00:19:45.890>notes <00:19:46.030>in <00:19:46.170>this <00:19:46.310>application.

288
00:19:50.930 --> 00:19:52.980
<00:19:50.930>Okay, <00:19:51.163>so <00:19:51.396>this <00:19:51.630>is <00:19:51.863>the <00:19:52.096>par <00:19:52.330>three.

289
00:19:53.400 --> 00:19:57.100
<00:19:53.400>And <00:19:53.575>now <00:19:53.750>let's <00:19:53.925>take <00:19:54.100>a <00:19:54.275>look <00:19:54.450>at <00:19:54.625>the <00:19:54.800>interpreter.

290
00:19:58.710 --> 00:20:03.450
<00:19:58.710>So <00:19:58.865>I'm <00:19:59.021>going <00:19:59.176>to <00:19:59.332>open <00:19:59.487>the, <00:19:59.643>uh, <00:19:59.798>interpreter <00:19:59.954>TSS <00:20:00.110>file.

291
00:20:04.740 --> 00:20:09.120
<00:20:04.740>So <00:20:04.915>as <00:20:05.090>I <00:20:05.265>mentioned <00:20:05.440>during <00:20:05.615>this <00:20:05.790>theory <00:20:05.965>part, <00:20:06.140>um,

292
00:20:10.720 --> 00:20:14.490
<00:20:10.720>when <00:20:10.847>we <00:20:10.974>have <00:20:11.101>the <00:20:11.229>tokens <00:20:11.356>and <00:20:11.483>then <00:20:11.610>when <00:20:11.738>we <00:20:11.865>have <00:20:11.992>the <00:20:12.120>parer,

293
00:20:14.550 --> 00:20:19.210
<00:20:14.550>we <00:20:14.657>can <00:20:14.765>easily <00:20:14.873>branch <00:20:14.980>out <00:20:15.088>from <00:20:15.196>there <00:20:15.303>and <00:20:15.411>create <00:20:15.519>a <00:20:15.626>very <00:20:15.734>minimal <00:20:15.842>interpreter. <00:20:15.950>It's,

294
00:20:19.330 --> 00:20:21.690
<00:20:19.330>uh, <00:20:19.563>usually <00:20:19.796>called <00:20:20.030>a <00:20:20.263>three <00:20:20.496>walk <00:20:20.730>interpreter,

295
00:20:22.020 --> 00:20:27.010
<00:20:22.020>which <00:20:22.127>means <00:20:22.235>we <00:20:22.343>are <00:20:22.450>going <00:20:22.558>to <00:20:22.666>do <00:20:22.773>a <00:20:22.881>single <00:20:22.989>walk <00:20:23.096>through <00:20:23.204>this <00:20:23.312>abstract <00:20:23.420>syntax

296
00:20:27.010 --> 00:20:31.810
<00:20:27.010>tree <00:20:27.126>and <00:20:27.243>produce <00:20:27.360>the <00:20:27.476>result. <00:20:27.593>So <00:20:27.710>I <00:20:27.826>have <00:20:27.943>a <00:20:28.060>bunch <00:20:28.176>of <00:20:28.293>utilities <00:20:28.410>here,

297
00:20:31.810 --> 00:20:36.210
<00:20:31.810>but <00:20:31.950>here <00:20:32.090>is <00:20:32.230>the, <00:20:32.370>the, <00:20:32.510>the <00:20:32.649>main <00:20:32.790>function <00:20:32.929>interpreted. <00:20:33.070>So, <00:20:33.210>um,

298
00:20:37.320 --> 00:20:41.290
<00:20:37.320>also <00:20:37.460>inside <00:20:37.600>I'm <00:20:37.740>taking <00:20:37.879>care <00:20:38.020>of <00:20:38.159>the <00:20:38.300>scopes <00:20:38.439>of <00:20:38.580>the <00:20:38.720>environment.

299
00:20:41.480 --> 00:20:44.850
<00:20:41.480>Sometimes <00:20:41.635>in <00:20:41.791>some <00:20:41.946>cases <00:20:42.102>it <00:20:42.257>could <00:20:42.413>be <00:20:42.568>an <00:20:42.724>additional <00:20:42.880>step,

300
00:20:44.910 --> 00:20:48.000
<00:20:44.910>it <00:20:45.065>could <00:20:45.221>be <00:20:45.376>an <00:20:45.532>additional <00:20:45.687>like <00:20:45.843>walk <00:20:45.998>through <00:20:46.154>the <00:20:46.310>tree.

301
00:20:48.580 --> 00:20:51.600
<00:20:48.580>But <00:20:48.754>here <00:20:48.929>I'm <00:20:49.105>doing <00:20:49.280>this <00:20:49.455>like <00:20:49.629>everything <00:20:49.804>in <00:20:49.980>once.

302
00:20:52.620 --> 00:20:57.080
<00:20:52.620>So <00:20:52.736>I <00:20:52.853>have <00:20:52.969>this <00:20:53.086>utility <00:20:53.203>to <00:20:53.320>create <00:20:53.436>a <00:20:53.553>function <00:20:53.669>scope, <00:20:53.786>which <00:20:53.903>will <00:20:54.020>know,

303
00:20:57.460 --> 00:21:01.520
<00:20:57.460>for <00:20:57.600>example, <00:20:57.740>that <00:20:57.880>if <00:20:58.020>I'm <00:20:58.160>out <00:20:58.300>inside <00:20:58.440>of <00:20:58.580>this <00:20:58.720>function, <00:20:58.860>uh,

304
00:21:01.740 --> 00:21:04.000
<00:21:01.740>in <00:21:01.940>my <00:21:02.140>scope, <00:21:02.340>I <00:21:02.540>have <00:21:02.740>A <00:21:02.940>and <00:21:03.140>B.

305
00:21:06.690 --> 00:21:09.220
<00:21:06.690>Okay. <00:21:06.890>And <00:21:07.090>then <00:21:07.290>I <00:21:07.490>have <00:21:07.690>this <00:21:07.890>evaluate <00:21:08.090>function,

306
00:21:09.720 --> 00:21:14.460
<00:21:09.720>and <00:21:09.836>I'm <00:21:09.953>switching <00:21:10.070>through <00:21:10.186>the <00:21:10.303>notes. <00:21:10.420>And <00:21:10.536>for <00:21:10.653>each <00:21:10.770>note, <00:21:10.886>I <00:21:11.003>am, <00:21:11.120>uh,

307
00:21:14.630 --> 00:21:18.020
<00:21:14.630>doing <00:21:14.770>some <00:21:14.910>work. <00:21:15.050>So <00:21:15.190>for <00:21:15.330>example, <00:21:15.470>if <00:21:15.610>I <00:21:15.750>have <00:21:15.890>an <00:21:16.030>identifier,

308
00:21:18.690 --> 00:21:22.220
<00:21:18.690>then <00:21:18.797>it <00:21:18.905>means <00:21:19.013>that <00:21:19.120>I <00:21:19.228>have <00:21:19.336>to <00:21:19.443>find <00:21:19.551>it <00:21:19.659>in <00:21:19.766>the <00:21:19.874>scope <00:21:19.982>because, <00:21:20.090>um,

309
00:21:22.770 --> 00:21:26.820
<00:21:22.770>this <00:21:22.910>is <00:21:23.050>how <00:21:23.190>I <00:21:23.330>know <00:21:23.470>was <00:21:23.610>the <00:21:23.750>value <00:21:23.889>behind <00:21:24.030>this <00:21:24.170>identifier.

310
00:21:27.680 --> 00:21:30.660
<00:21:27.680>Uh, <00:21:27.880>when <00:21:28.080>I <00:21:28.280>have, <00:21:28.480>for <00:21:28.680>example, <00:21:28.880>numeric <00:21:29.080>literal,

311
00:21:31.100 --> 00:21:35.100
<00:21:31.100>I <00:21:31.216>just <00:21:31.333>return <00:21:31.449>its <00:21:31.566>value <00:21:31.683>and <00:21:31.800>then <00:21:31.916>it's <00:21:32.033>gonna <00:21:32.149>be <00:21:32.266>picked <00:21:32.383>by, <00:21:32.500>uh,

312
00:21:35.930 --> 00:21:39.220
<00:21:35.930>like <00:21:36.105>a <00:21:36.280>different <00:21:36.455>step. <00:21:36.630>For <00:21:36.805>example, <00:21:36.980>by <00:21:37.155>urinary <00:21:37.330>expression.

313
00:21:39.240 --> 00:21:41.980
<00:21:39.240>In <00:21:39.590>urinary <00:21:39.940>expression, <00:21:40.290>I, <00:21:40.640>uh,

314
00:21:42.570 --> 00:21:46.340
<00:21:42.570>just <00:21:42.803>add <00:21:43.036>minus <00:21:43.270>to <00:21:43.503>the, <00:21:43.736>uh, <00:21:43.970>apparent,

315
00:21:46.590 --> 00:21:51.060
<00:21:46.590>which <00:21:46.697>is <00:21:46.805>also <00:21:46.913>evaluated. <00:21:47.020>This <00:21:47.128>is <00:21:47.236>recursive <00:21:47.343>function <00:21:47.451>and <00:21:47.559>so <00:21:47.666>on <00:21:47.774>and <00:21:47.882>so <00:21:47.990>forth.

316
00:21:51.110 --> 00:21:54.700
<00:21:51.110>We'll, <00:21:51.310>uh, <00:21:51.510>look <00:21:51.709>into <00:21:51.909>like <00:21:52.110>extending <00:21:52.310>this <00:21:52.510>later,

317
00:21:54.920 --> 00:21:58.900
<00:21:54.920>but <00:21:55.047>I <00:21:55.174>also <00:21:55.301>wanted <00:21:55.429>to <00:21:55.556>show <00:21:55.683>you <00:21:55.810>some, <00:21:55.938>uh, <00:21:56.065>the <00:21:56.192>evaluation <00:21:56.320>steps.

318
00:21:59.320 --> 00:22:04.020
<00:21:59.320>So <00:21:59.460>I <00:21:59.600>kind <00:21:59.740>of <00:21:59.879>made <00:22:00.020>this <00:22:00.159>like <00:22:00.300>inside <00:22:00.439>the <00:22:00.580>bugger. <00:22:00.720>So,

319
00:22:04.240 --> 00:22:07.460
<00:22:04.240>uh, <00:22:04.367>so <00:22:04.494>that <00:22:04.621>we <00:22:04.749>are <00:22:04.876>able <00:22:05.003>to <00:22:05.130>see <00:22:05.258>like <00:22:05.385>what's <00:22:05.512>the <00:22:05.640>order,

320
00:22:07.770 --> 00:22:10.460
<00:22:07.770>like <00:22:07.970>how <00:22:08.170>the <00:22:08.370>interpreter <00:22:08.570>goes <00:22:08.770>through <00:22:08.970>the <00:22:09.170>notes.

321
00:22:11.080 --> 00:22:15.300
<00:22:11.080>So <00:22:11.207>at <00:22:11.334>the <00:22:11.461>first <00:22:11.589>step <00:22:11.716>it's, <00:22:11.843>uh, <00:22:11.970>it's <00:22:12.098>like <00:22:12.225>the, <00:22:12.352>the, <00:22:12.480>the,

322
00:22:15.300 --> 00:22:19.140
<00:22:15.300>the <00:22:15.455>highest <00:22:15.611>level <00:22:15.766>node. <00:22:15.922>The <00:22:16.077>program, <00:22:16.233>it's <00:22:16.388>see <00:22:16.544>the <00:22:16.700>program,

323
00:22:19.600 --> 00:22:23.300
<00:22:19.600>it <00:22:19.800>knows <00:22:20.000>that <00:22:20.199>inside <00:22:20.399>the <00:22:20.600>scope <00:22:20.800>is <00:22:21.000>add,

324
00:22:24.280 --> 00:22:26.940
<00:22:24.280>and <00:22:24.480>then <00:22:24.680>it <00:22:24.879>goes <00:22:25.080>to <00:22:25.280>the <00:22:25.480>function <00:22:25.680>call.

325
00:22:27.760 --> 00:22:32.060
<00:22:27.760>And <00:22:27.887>inside <00:22:28.014>of <00:22:28.141>the <00:22:28.269>function <00:22:28.396>call, <00:22:28.523>it <00:22:28.650>actually <00:22:28.778>goes <00:22:28.905>to <00:22:29.032>the <00:22:29.160>function.

326
00:22:32.480 --> 00:22:35.700
<00:22:32.480>And <00:22:32.620>we <00:22:32.760>can <00:22:32.900>see <00:22:33.040>here <00:22:33.180>that <00:22:33.320>we <00:22:33.460>have <00:22:33.600>a <00:22:33.740>different <00:22:33.880>scope,

327
00:22:35.700 --> 00:22:38.620
<00:22:35.700>we <00:22:35.855>have <00:22:36.011>more <00:22:36.166>information <00:22:36.322>here. <00:22:36.477>We <00:22:36.633>not <00:22:36.788>only <00:22:36.944>have <00:22:37.100>add,

328
00:22:38.620 --> 00:22:42.540
<00:22:38.620>but <00:22:38.775>we <00:22:38.931>also <00:22:39.086>have <00:22:39.242>information. <00:22:39.397>What <00:22:39.553>are <00:22:39.708>A <00:22:39.864>and <00:22:40.020>B?

329
00:22:43.930 --> 00:22:44.780
<00:22:43.930>Then, <00:22:44.695>uh,

330
00:22:45.240 --> 00:22:49.660
<00:22:45.240>it <00:22:45.356>picks <00:22:45.473>up <00:22:45.590>the <00:22:45.706>information <00:22:45.823>about <00:22:45.940>the <00:22:46.056>identifier <00:22:46.173>to <00:22:46.290>actually <00:22:46.406>produce <00:22:46.523>the <00:22:46.640>result.

331
00:22:50.720 --> 00:22:54.110
<00:22:50.720>And, <00:22:51.420>uh, <00:22:52.120>yeah,

332
00:22:54.130 --> 00:22:58.790
<00:22:54.130>and <00:22:54.257>we <00:22:54.384>have <00:22:54.511>the <00:22:54.639>last <00:22:54.766>step <00:22:54.893>and <00:22:55.020>we <00:22:55.148>have <00:22:55.275>the <00:22:55.402>result <00:22:55.530>free.

333
00:22:59.810 --> 00:23:03.390
<00:22:59.810>So <00:22:59.937>this <00:23:00.064>is <00:23:00.191>how <00:23:00.319>the <00:23:00.446>source <00:23:00.573>code <00:23:00.700>of <00:23:00.828>the <00:23:00.955>language <00:23:01.082>looks <00:23:01.210>like.

334
00:23:03.690 --> 00:23:07.830
<00:23:03.690>And <00:23:03.817>now <00:23:03.944>I <00:23:04.071>was <00:23:04.199>thinking <00:23:04.326>about <00:23:04.453>doing <00:23:04.580>something, <00:23:04.708>uh, <00:23:04.835>to <00:23:04.962>extend <00:23:05.090>it.

335
00:23:08.530 --> 00:23:12.430
<00:23:08.530>And <00:23:08.646>the <00:23:08.763>thing <00:23:08.879>I <00:23:08.996>came <00:23:09.113>up <00:23:09.230>with <00:23:09.346>was <00:23:09.463>to, <00:23:09.580>uh, <00:23:09.696>a <00:23:09.813>print <00:23:09.930>statement,

336
00:23:12.430 --> 00:23:16.830
<00:23:12.430>but <00:23:12.517>it <00:23:12.605>won't <00:23:12.692>be <00:23:12.780>a <00:23:12.867>regular <00:23:12.955>print <00:23:13.042>statement. <00:23:13.130>Like <00:23:13.217>it <00:23:13.305>won't <00:23:13.392>be <00:23:13.480>a, <00:23:13.567>I <00:23:13.655>dunno, <00:23:13.742>like <00:23:13.830>a,

337
00:23:17.150 --> 00:23:20.510
<00:23:17.150>a <00:23:17.383>library, <00:23:17.616>print <00:23:17.850>or <00:23:18.083>console <00:23:18.316>log. <00:23:18.550>Uh,

338
00:23:20.760 --> 00:23:24.910
<00:23:20.760>we're <00:23:21.040>gonna <00:23:21.320>add <00:23:21.600>something <00:23:21.879>like <00:23:22.160>this.

339
00:23:25.530 --> 00:23:29.470
<00:23:25.530>So <00:23:25.670>this, <00:23:25.810>uh, <00:23:25.950>question <00:23:26.090>mark <00:23:26.230>at <00:23:26.370>the <00:23:26.510>end <00:23:26.649>of <00:23:26.790>a <00:23:26.930>term,

340
00:23:30.580 --> 00:23:35.560
<00:23:30.580>uh, <00:23:30.687>is <00:23:30.795>gonna <00:23:30.903>not <00:23:31.010>only <00:23:31.118>return <00:23:31.226>the <00:23:31.333>expression, <00:23:31.441>but <00:23:31.549>it's <00:23:31.656>also <00:23:31.764>gonna <00:23:31.872>print <00:23:31.980>it.

341
00:23:36.220 --> 00:23:40.800
<00:23:36.220>So <00:23:36.320>right <00:23:36.420>now <00:23:36.520>we <00:23:36.620>see <00:23:36.720>that <00:23:36.820>there <00:23:36.920>are <00:23:37.020>errors <00:23:37.120>because <00:23:37.220>our <00:23:37.320>lecture <00:23:37.420>doesn't <00:23:37.520>know <00:23:37.620>what

342
00:23:40.820 --> 00:23:41.840
<00:23:40.820>is <00:23:41.126>the <00:23:41.432>question <00:23:41.737>mark.

343
00:23:42.420 --> 00:23:46.840
<00:23:42.420>So <00:23:42.547>the <00:23:42.674>first <00:23:42.801>step <00:23:42.929>for <00:23:43.056>us <00:23:43.183>is <00:23:43.310>to <00:23:43.438>open <00:23:43.565>the <00:23:43.692>lecture <00:23:43.820>pile

344
00:23:47.660 --> 00:23:50.920
<00:23:47.660>and <00:23:47.815>we're <00:23:47.971>going <00:23:48.126>to <00:23:48.282>add <00:23:48.437>a <00:23:48.593>new <00:23:48.748>type. <00:23:48.904>Let's, <00:23:49.060>uh,

345
00:23:51.310 --> 00:23:55.810
<00:23:51.310>call <00:23:51.510>it <00:23:51.710>question <00:23:51.909>mark. <00:23:52.110>Oh, <00:23:52.310>thank <00:23:52.510>you, <00:23:52.710>co-pilot.

346
00:23:56.790 --> 00:23:57.623
Uh,

347
00:23:57.830 --> 00:24:01.850
<00:23:57.830>we <00:23:57.929>are <00:23:58.030>also <00:23:58.129>going <00:23:58.230>to <00:23:58.330>add <00:23:58.429>it <00:23:58.530>to <00:23:58.629>the <00:23:58.730>lecture <00:23:58.830>so <00:23:58.929>that <00:23:59.030>the <00:23:59.129>lecture <00:23:59.230>know

348
00:24:02.860 --> 00:24:07.050
<00:24:02.860>knows <00:24:03.015>how <00:24:03.171>to <00:24:03.326>proceed <00:24:03.482>when <00:24:03.637>it <00:24:03.793>finds <00:24:03.948>the <00:24:04.104>question <00:24:04.260>mark.

349
00:24:08.360 --> 00:24:11.780
<00:24:08.360>By <00:24:08.467>the <00:24:08.575>way, <00:24:08.683>GitHub <00:24:08.790>copilots <00:24:08.898>is <00:24:09.006>very, <00:24:09.113>very <00:24:09.221>good <00:24:09.329>with <00:24:09.436>this <00:24:09.544>kind <00:24:09.652>of <00:24:09.760>thing.

350
00:24:11.840 --> 00:24:14.740
<00:24:11.840>So <00:24:11.995>if <00:24:12.151>you're <00:24:12.306>looking <00:24:12.462>into, <00:24:12.617>you <00:24:12.773>know, <00:24:12.928>making <00:24:13.084>some, <00:24:13.240>uh,

351
00:24:15.380 --> 00:24:17.300
<00:24:15.380>contributions <00:24:15.613>to <00:24:15.846>languages <00:24:16.080>or <00:24:16.313>play <00:24:16.546>with <00:24:16.780>languages,

352
00:24:17.300 --> 00:24:21.060
<00:24:17.300>then <00:24:17.455>it's <00:24:17.611>gonna <00:24:17.766>be <00:24:17.922>of <00:24:18.077>a <00:24:18.233>great <00:24:18.388>help. <00:24:18.544>Uh, <00:24:18.700>okay,

353
00:24:21.080 --> 00:24:25.070
<00:24:21.080>so <00:24:21.254>if <00:24:21.429>I <00:24:21.605>go <00:24:21.780>to <00:24:21.955>my <00:24:22.129>code, <00:24:22.304>then <00:24:22.480>yeah,

354
00:24:25.140 --> 00:24:28.390
<00:24:25.140>this <00:24:25.267>arrow <00:24:25.394>is <00:24:25.521>gone. <00:24:25.649>I <00:24:25.776>know <00:24:25.903>that <00:24:26.030>this <00:24:26.158>is <00:24:26.285>a <00:24:26.412>question <00:24:26.540>mark,

355
00:24:29.550 --> 00:24:33.770
<00:24:29.550>but <00:24:29.643>now <00:24:29.736>if <00:24:29.830>you <00:24:29.923>go <00:24:30.016>to <00:24:30.110>the <00:24:30.203>parser, <00:24:30.296>uh, <00:24:30.389>even <00:24:30.483>if <00:24:30.576>I <00:24:30.669>do <00:24:30.763>for <00:24:30.856>example <00:24:30.950>this,

356
00:24:34.480 --> 00:24:37.770
<00:24:34.480>then <00:24:34.635>the <00:24:34.791>parser <00:24:34.946>knows <00:24:35.102>that <00:24:35.257>there <00:24:35.413>is <00:24:35.568>a <00:24:35.724>numeric <00:24:35.880>literal,

357
00:24:37.910 --> 00:24:42.450
<00:24:37.910>but <00:24:38.017>it <00:24:38.125>still <00:24:38.233>doesn't <00:24:38.340>know <00:24:38.448>what <00:24:38.556>to <00:24:38.663>do <00:24:38.771>with <00:24:38.879>the <00:24:38.986>question <00:24:39.094>mark. <00:24:39.202>So, <00:24:39.310>uh,

358
00:24:43.190 --> 00:24:47.250
<00:24:43.190>before <00:24:43.306>going <00:24:43.423>to <00:24:43.540>the <00:24:43.656>parser, <00:24:43.773>I <00:24:43.890>have <00:24:44.006>this <00:24:44.123>file <00:24:44.240>with <00:24:44.356>all <00:24:44.473>different, <00:24:44.590>uh,

359
00:24:48.020 --> 00:24:50.450
<00:24:48.020>types <00:24:48.195>because <00:24:48.370>all <00:24:48.545>of <00:24:48.720>that <00:24:48.895>is <00:24:49.070>written <00:24:49.245>type <00:24:49.420>script.

360
00:24:50.630 --> 00:24:55.050
<00:24:50.630>So <00:24:50.805>I'm <00:24:50.980>going <00:24:51.155>to <00:24:51.330>add <00:24:51.505>a <00:24:51.680>new <00:24:51.855>expression <00:24:52.030>type

361
00:24:55.390 --> 00:24:57.970
<00:24:55.390>export <00:24:56.090>interface, <00:24:56.790>uh,

362
00:24:59.260 --> 00:25:03.490
<00:24:59.260>print <00:24:59.435>expression, <00:24:59.610>yes, <00:24:59.785>it's <00:24:59.960>gonna <00:25:00.135>extend <00:25:00.310>the <00:25:00.485>base <00:25:00.660>note,

363
00:25:04.310 --> 00:25:08.610
<00:25:04.310>yes, <00:25:04.465>kind <00:25:04.621>print <00:25:04.776>expression <00:25:04.932>inside, <00:25:05.087>there's <00:25:05.243>gonna <00:25:05.398>be <00:25:05.554>an <00:25:05.710>expression,

364
00:25:08.950 --> 00:25:12.850
<00:25:08.950>and <00:25:09.090>that's <00:25:09.230>it. <00:25:09.370>There's <00:25:09.510>an <00:25:09.650>error <00:25:09.790>because <00:25:09.930>in <00:25:10.070>the <00:25:10.210>base <00:25:10.350>note,

365
00:25:13.550 --> 00:25:18.530
<00:25:13.550>we <00:25:13.657>expect, <00:25:13.765>uh, <00:25:13.873>the <00:25:13.980>kind <00:25:14.088>to <00:25:14.196>be <00:25:14.303>in <00:25:14.411>the <00:25:14.519>syntax <00:25:14.626>kind <00:25:14.734>tie, <00:25:14.842>uh, <00:25:14.950>union.

366
00:25:19.390 --> 00:25:24.220
<00:25:19.390>So <00:25:19.483>we're <00:25:19.576>going <00:25:19.670>to <00:25:19.763>add <00:25:19.856>it <00:25:19.950>here <00:25:20.043>as <00:25:20.136>well. <00:25:20.230>Okay, <00:25:20.323>so <00:25:20.416>we <00:25:20.510>have <00:25:20.603>the <00:25:20.696>types <00:25:20.790>covered,

367
00:25:24.920 --> 00:25:28.860
<00:25:24.920>but <00:25:25.036>now <00:25:25.153>I <00:25:25.270>still <00:25:25.386>need <00:25:25.503>to <00:25:25.620>add <00:25:25.736>a <00:25:25.853>rule <00:25:25.970>for <00:25:26.086>the <00:25:26.203>print <00:25:26.320>expression.

368
00:25:29.360 --> 00:25:33.820
<00:25:29.360>So <00:25:29.500>I'm <00:25:29.639>going <00:25:29.780>to <00:25:29.919>create <00:25:30.060>a <00:25:30.199>new <00:25:30.340>one. <00:25:30.479>Let's <00:25:30.620>say <00:25:30.760>cons,

369
00:25:34.990 --> 00:25:36.500
<00:25:34.990>print <00:25:36.349>expression.

370
00:25:36.970 --> 00:25:41.060
<00:25:36.970>This <00:25:37.170>is <00:25:37.370>a <00:25:37.570>role <00:25:37.770>that <00:25:37.970>takes <00:25:38.170>token <00:25:38.370>kind,

371
00:25:41.360 --> 00:25:45.140
<00:25:41.360>and <00:25:41.500>it's <00:25:41.639>going <00:25:41.780>to <00:25:41.919>be <00:25:42.060>mapped <00:25:42.199>to, <00:25:42.340>not <00:25:42.479>to <00:25:42.620>ast <00:25:42.760>expression,

372
00:25:45.160 --> 00:25:49.460
<00:25:45.160>but <00:25:45.315>to <00:25:45.471>the <00:25:45.626>print <00:25:45.782>expression <00:25:45.937>interface <00:25:46.093>that <00:25:46.248>we <00:25:46.404>just <00:25:46.560>added.

373
00:25:50.220 --> 00:25:54.560
<00:25:50.220>I <00:25:50.347>will <00:25:50.474>go <00:25:50.601>back <00:25:50.729>and <00:25:50.856>we'll <00:25:50.983>actually <00:25:51.110>implement <00:25:51.238>this <00:25:51.365>tool. <00:25:51.492>I <00:25:51.620>will,

374
00:25:54.560 --> 00:25:58.440
<00:25:54.560>let's <00:25:54.715>say <00:25:54.871>I <00:25:55.026>will <00:25:55.182>do <00:25:55.337>this <00:25:55.493>here. <00:25:55.648>So <00:25:55.804>print <00:25:55.960>expression,

375
00:26:00.100 --> 00:26:02.560
<00:26:00.100>set <00:26:00.300>pattern, <00:26:00.500>we're <00:26:00.699>going <00:26:00.899>to <00:26:01.100>use <00:26:01.300>apply <00:26:01.500>function,

376
00:26:02.570 --> 00:26:05.800
<00:26:02.570>which <00:26:02.770>will <00:26:02.970>apply <00:26:03.169>the <00:26:03.370>rule <00:26:03.570>to <00:26:03.770>the, <00:26:03.970>um,

377
00:26:06.700 --> 00:26:10.560
<00:26:06.700>to <00:26:07.050>this <00:26:07.400>expression. <00:26:07.750>And, <00:26:08.100>uh,

378
00:26:10.670 --> 00:26:15.550
<00:26:10.670>copilot <00:26:10.810>tries <00:26:10.950>to <00:26:11.090>help <00:26:11.230>me. <00:26:11.370>Well, <00:26:11.510>let's <00:26:11.650>say <00:26:11.790>it's <00:26:11.930>almost <00:26:12.070>correct.

379
00:26:16.190 --> 00:26:20.870
<00:26:16.190>I <00:26:16.330>want <00:26:16.470>this <00:26:16.610>print <00:26:16.750>expression <00:26:16.890>to <00:26:17.030>be <00:26:17.170>a <00:26:17.310>sequence, <00:26:17.450>but, <00:26:17.590>uh,

380
00:26:21.220 --> 00:26:24.830
<00:26:21.220>it's <00:26:21.375>a <00:26:21.531>sequence <00:26:21.686>where <00:26:21.842>first <00:26:21.997>element <00:26:22.153>is <00:26:22.308>a <00:26:22.464>term. <00:26:22.620>I'm,

381
00:26:24.930 --> 00:26:29.510
<00:26:24.930>I'm <00:26:25.023>will <00:26:25.116>also <00:26:25.210>show <00:26:25.303>you <00:26:25.396>what <00:26:25.490>the <00:26:25.583>term <00:26:25.676>is <00:26:25.770>because <00:26:25.863>I <00:26:25.956>haven't <00:26:26.050>before. <00:26:26.143>A <00:26:26.236>term <00:26:26.330>is,

382
00:26:30.580 --> 00:26:32.990
<00:26:30.580>yeah, <00:26:30.813>this <00:26:31.046>is <00:26:31.280>either <00:26:31.513>a <00:26:31.746>function <00:26:31.980>call,

383
00:26:33.750 --> 00:26:38.590
<00:26:33.750>literal <00:26:33.925>identifier <00:26:34.100>in <00:26:34.275>expression <00:26:34.450>or <00:26:34.625>something <00:26:34.800>that <00:26:34.975>is <00:26:35.150>being

384
00:26:38.590 --> 00:26:43.030
<00:26:38.590>wrapped <00:26:38.823>in <00:26:39.056>the, <00:26:39.290>uh, <00:26:39.523>par <00:26:39.756>parents. <00:26:39.990>Okay?

385
00:26:43.670 --> 00:26:47.320
<00:26:43.670>Okay, <00:26:43.825>let <00:26:43.981>me <00:26:44.136>go <00:26:44.292>back. <00:26:44.447>So <00:26:44.603>we <00:26:44.758>have <00:26:44.914>the <00:26:45.070>term,

386
00:26:47.950 --> 00:26:52.240
<00:26:47.950>then <00:26:48.150>we <00:26:48.350>have <00:26:48.550>a <00:26:48.750>question <00:26:48.950>mark, <00:26:49.150>and, <00:26:49.350>uh,

387
00:26:53.460 --> 00:26:57.920
<00:26:53.460>yes, <00:26:53.567>thank <00:26:53.675>you. <00:26:53.783>This <00:26:53.890>is <00:26:53.998>actually <00:26:54.106>helpful <00:26:54.213>and <00:26:54.321>we're <00:26:54.429>going <00:26:54.536>to <00:26:54.644>return <00:26:54.752>the, <00:26:54.860>uh,

388
00:26:58.070 --> 00:27:00.120
<00:26:58.070>note <00:26:58.350>object <00:26:58.629>with <00:26:58.909>all <00:26:59.189>the <00:26:59.470>information.

389
00:27:00.660 --> 00:27:04.240
<00:27:00.660>So <00:27:01.010>the <00:27:01.360>kind <00:27:01.710>expression <00:27:02.060>inside,

390
00:27:04.240 --> 00:27:07.280
<00:27:04.240>we <00:27:04.380>have <00:27:04.520>the <00:27:04.660>expression <00:27:04.800>that <00:27:04.940>was <00:27:05.080>being <00:27:05.220>matched. <00:27:05.360>So <00:27:05.500>the <00:27:05.640>term,

391
00:27:09.060 --> 00:27:13.800
<00:27:09.060>and <00:27:09.235>we'll <00:27:09.409>also <00:27:09.585>return <00:27:09.760>this, <00:27:09.935>uh, <00:27:10.110>meta <00:27:10.284>for <00:27:10.460>debugging.

392
00:27:14.460 --> 00:27:18.400
<00:27:14.460>We <00:27:14.615>have <00:27:14.771>from, <00:27:14.926>so <00:27:15.082>with <00:27:15.237>TSS <00:27:15.393>power <00:27:15.548>sector, <00:27:15.704>those <00:27:15.860>utilities,

393
00:27:18.400 --> 00:27:22.880
<00:27:18.400>like <00:27:18.540>always <00:27:18.680>the <00:27:18.820>second <00:27:18.960>argument, <00:27:19.100>it's <00:27:19.240>uh, <00:27:19.380>something <00:27:19.520>called <00:27:19.660>token <00:27:19.800>range.

394
00:27:23.100 --> 00:27:26.560
<00:27:23.100>So <00:27:23.240>then <00:27:23.379>you <00:27:23.520>can <00:27:23.659>kind <00:27:23.800>of <00:27:23.939>like, <00:27:24.080>uh, <00:27:24.219>see <00:27:24.360>where <00:27:24.500>your,

395
00:27:26.950 --> 00:27:29.160
<00:27:26.950>like <00:27:27.150>where <00:27:27.350>the <00:27:27.550>note <00:27:27.750>starts <00:27:27.950>in <00:27:28.150>your <00:27:28.350>cloud.

396
00:27:30.100 --> 00:27:34.480
<00:27:30.100>And <00:27:30.274>two <00:27:30.449>is <00:27:30.625>the <00:27:30.800>expression <00:27:30.975>meta <00:27:31.149>two <00:27:31.324>plus <00:27:31.500>one,

397
00:27:34.480 --> 00:27:37.280
<00:27:34.480>because <00:27:34.680>we <00:27:34.880>are <00:27:35.080>adding <00:27:35.280>the, <00:27:35.480>uh, <00:27:35.680>question <00:27:35.880>mark.

398
00:27:38.140 --> 00:27:41.560
<00:27:38.140>And <00:27:38.340>we're <00:27:38.540>going <00:27:38.740>to <00:27:38.940>close <00:27:39.140>all <00:27:39.340>the <00:27:39.540>brackets,

399
00:27:42.050 --> 00:27:45.280
<00:27:42.050>which <00:27:42.205>is <00:27:42.361>usually <00:27:42.516>the <00:27:42.672>hardest <00:27:42.827>part <00:27:42.983>during <00:27:43.138>a <00:27:43.294>live <00:27:43.450>coding.

400
00:27:47.050 --> 00:27:50.670
<00:27:47.050>Did <00:27:47.190>we <00:27:47.330>get <00:27:47.470>it <00:27:47.610>right? <00:27:47.750>Yep, <00:27:47.889>we <00:27:48.030>did <00:27:48.169>get <00:27:48.310>it <00:27:48.450>right.

401
00:27:51.450 --> 00:27:56.030
<00:27:51.450>So <00:27:51.566>if <00:27:51.683>I'm <00:27:51.800>not <00:27:51.916>wrong, <00:27:52.033>now, <00:27:52.150>if <00:27:52.266>we <00:27:52.383>go <00:27:52.500>here, <00:27:52.616>let <00:27:52.733>me, <00:27:52.850>uh,

402
00:27:59.650 --> 00:28:00.483
uh,

403
00:28:02.190 --> 00:28:04.930
<00:28:02.190>now <00:28:02.345>it <00:28:02.501>doesn't <00:28:02.656>know <00:28:02.812>that <00:28:02.967>this <00:28:03.123>is <00:28:03.278>a <00:28:03.434>print <00:28:03.590>expression.

404
00:28:08.020 --> 00:28:11.120
<00:28:08.020>Oh <00:28:08.253>yeah, <00:28:08.486>because <00:28:08.720>we <00:28:08.953>added <00:28:09.186>those <00:28:09.420>rules,

405
00:28:11.220 --> 00:28:14.960
<00:28:11.220>but <00:28:11.375>we <00:28:11.531>didn't <00:28:11.686>say <00:28:11.842>anywhere <00:28:11.997>like <00:28:12.153>where <00:28:12.308>print <00:28:12.464>expression <00:28:12.620>lies.

406
00:28:15.150 --> 00:28:18.760
<00:28:15.150>Like <00:28:15.277>what <00:28:15.404>was <00:28:15.531>the, <00:28:15.659>uh, <00:28:15.786>how <00:28:15.913>does <00:28:16.040>it <00:28:16.168>correspond <00:28:16.295>to <00:28:16.422>the <00:28:16.550>program?

407
00:28:19.180 --> 00:28:22.560
<00:28:19.180>So <00:28:19.380>we're <00:28:19.580>also <00:28:19.780>gonna <00:28:19.980>say <00:28:20.180>that <00:28:20.380>expression, <00:28:20.580>uh,

408
00:28:22.650 --> 00:28:26.360
<00:28:22.650>expression <00:28:22.825>is <00:28:23.000>al <00:28:23.175>alternative. <00:28:23.350>It's <00:28:23.525>either <00:28:23.700>a <00:28:23.875>function <00:28:24.050>expression,

409
00:28:26.400 --> 00:28:29.080
<00:28:26.400>a <00:28:26.750>variable <00:28:27.100>declaration <00:28:27.450>assignment <00:28:27.800>expression.

410
00:28:29.100 --> 00:28:31.360
<00:28:29.100>And <00:28:29.274>now <00:28:29.449>we're <00:28:29.625>going <00:28:29.800>to <00:28:29.975>also <00:28:30.149>say <00:28:30.324>that <00:28:30.500>print

411
00:28:32.890 --> 00:28:36.280
<00:28:32.890>print <00:28:33.123>expression <00:28:33.356>is <00:28:33.590>also <00:28:33.823>a <00:28:34.056>valid <00:28:34.290>expression.

412
00:28:37.680 --> 00:28:41.460
<00:28:37.680>Uh, <00:28:37.807>but <00:28:37.934>first <00:28:38.061>I <00:28:38.189>guess <00:28:38.316>we're <00:28:38.443>also <00:28:38.570>need <00:28:38.698>to <00:28:38.825>update <00:28:38.952>the <00:28:39.080>type.

413
00:28:42.400 --> 00:28:46.980
<00:28:42.400>So <00:28:42.540>here <00:28:42.680>we're <00:28:42.820>gonna <00:28:42.960>have <00:28:43.100>the <00:28:43.240>print <00:28:43.380>expression, <00:28:43.520>and <00:28:43.660>if <00:28:43.800>we,

414
00:28:47.160 --> 00:28:52.020
<00:28:47.160>oh <00:28:47.276>yeah, <00:28:47.393>it <00:28:47.510>works. <00:28:47.626>So <00:28:47.743>now <00:28:47.860>we <00:28:47.976>know <00:28:48.093>that <00:28:48.210>the <00:28:48.326>print <00:28:48.443>expression, <00:28:48.560>uh,

415
00:28:52.560 --> 00:28:56.820
<00:28:52.560>inside <00:28:52.676>there's <00:28:52.793>a <00:28:52.909>numeric <00:28:53.026>literal. <00:28:53.143>So <00:28:53.260>if <00:28:53.376>you <00:28:53.493>go <00:28:53.610>back <00:28:53.726>to <00:28:53.843>this <00:28:53.960>example,

416
00:28:57.140 --> 00:29:02.140
<00:28:57.140>I <00:28:57.267>can <00:28:57.394>add <00:28:57.521>those <00:28:57.649>question <00:28:57.776>marks <00:28:57.903>in <00:28:58.030>different <00:28:58.158>places. <00:28:58.285>And <00:28:58.412>then, <00:28:58.540>uh,

417
00:29:02.240 --> 00:29:05.780
<00:29:02.240>our <00:29:02.415>program <00:29:02.590>has <00:29:02.765>two <00:29:02.940>statements, <00:29:03.115>variable <00:29:03.290>declaration <00:29:03.465>and <00:29:03.640>print,

418
00:29:05.870 --> 00:29:06.940
<00:29:05.870>print <00:29:06.833>expression,

419
00:29:07.630 --> 00:29:12.500
<00:29:07.630>which <00:29:07.757>inside <00:29:07.884>has <00:29:08.011>a <00:29:08.139>function <00:29:08.266>call <00:29:08.393>and <00:29:08.520>it's <00:29:08.648>gonna <00:29:08.775>return <00:29:08.902>dysfunction <00:29:09.030>call

420
00:29:12.500 --> 00:29:15.900
<00:29:12.500>like <00:29:12.780>its <00:29:13.060>result. <00:29:13.340>So <00:29:13.620>now, <00:29:13.900>uh,

421
00:29:16.120 --> 00:29:18.580
<00:29:16.120>the <00:29:16.399>last <00:29:16.679>part <00:29:16.959>is <00:29:17.239>the <00:29:17.520>interpreter.

422
00:29:18.960 --> 00:29:23.060
<00:29:18.960>So <00:29:19.115>we <00:29:19.271>actually <00:29:19.426>have <00:29:19.582>to <00:29:19.737>cover <00:29:19.893>it <00:29:20.048>in <00:29:20.204>our <00:29:20.360>evaluate,

423
00:29:23.800 --> 00:29:26.780
<00:29:23.800>uh, <00:29:23.975>switch <00:29:24.149>because <00:29:24.325>now, <00:29:24.500>like <00:29:24.675>even <00:29:24.850>types <00:29:25.024>drop <00:29:25.200>complaints,

424
00:29:26.780 --> 00:29:29.300
<00:29:26.780>that <00:29:26.980>not <00:29:27.180>all <00:29:27.379>code <00:29:27.580>paths <00:29:27.780>return <00:29:27.980>a <00:29:28.180>value.

425
00:29:29.440 --> 00:29:32.540
<00:29:29.440>So <00:29:29.640>we're <00:29:29.840>going <00:29:30.040>to <00:29:30.240>add <00:29:30.440>case <00:29:30.640>print <00:29:30.840>expression.

426
00:29:36.410 --> 00:29:40.710
<00:29:36.410>And <00:29:36.537>what <00:29:36.664>we <00:29:36.791>have <00:29:36.919>to <00:29:37.046>do <00:29:37.173>is <00:29:37.300>first <00:29:37.428>we <00:29:37.555>need <00:29:37.682>to, <00:29:37.810>uh,

427
00:29:40.930 --> 00:29:44.600
<00:29:40.930>color <00:29:41.396>cons <00:29:41.863>print <00:29:42.330>expression

428
00:29:45.980 --> 00:29:48.200
<00:29:45.980>result. <00:29:46.213>We <00:29:46.446>have <00:29:46.680>to <00:29:46.913>evaluate <00:29:47.146>the <00:29:47.380>results.

429
00:29:49.030 --> 00:29:53.480
<00:29:49.030>Then <00:29:49.205>since <00:29:49.379>this <00:29:49.555>is <00:29:49.730>something <00:29:49.905>written <00:29:50.080>in, <00:29:50.254>uh, <00:29:50.430>JavaScript,

430
00:29:53.620 --> 00:29:58.310
<00:29:53.620>I'm <00:29:53.747>just <00:29:53.874>gonna <00:29:54.001>console <00:29:54.129>log <00:29:54.256>this, <00:29:54.383>but <00:29:54.510>we'll <00:29:54.638>make <00:29:54.765>it <00:29:54.892>slightly <00:29:55.020>nicer.

431
00:29:58.930 --> 00:30:02.950
<00:29:58.930>So <00:29:59.130>we're <00:29:59.330>going <00:29:59.530>to <00:29:59.730>do <00:29:59.930>print <00:30:00.130>expression <00:30:00.330>result,

432
00:30:02.970 --> 00:30:06.990
<00:30:02.970>but <00:30:03.097>we're <00:30:03.224>also <00:30:03.351>going <00:30:03.479>to <00:30:03.606>show <00:30:03.733>like <00:30:03.860>where <00:30:03.988>is <00:30:04.115>it <00:30:04.242>coming <00:30:04.370>from.

433
00:30:07.130 --> 00:30:10.750
<00:30:07.130>So <00:30:07.285>we're <00:30:07.441>going <00:30:07.596>to <00:30:07.752>do <00:30:07.907>print <00:30:08.063>a <00:30:08.218>s <00:30:08.374>t <00:30:08.530>note,

434
00:30:11.530 --> 00:30:14.430
<00:30:11.530>and <00:30:11.670>at <00:30:11.810>the <00:30:11.950>end <00:30:12.090>we're <00:30:12.230>still <00:30:12.370>going <00:30:12.510>to <00:30:12.649>return <00:30:12.790>the <00:30:12.930>print,

435
00:30:18.120 --> 00:30:22.270
<00:30:18.120>print <00:30:18.294>expression <00:30:18.469>result. <00:30:18.645>So <00:30:18.820>I <00:30:18.995>think <00:30:19.169>we're <00:30:19.344>almost <00:30:19.520>done.

436
00:30:22.330 --> 00:30:26.430
<00:30:22.330>We <00:30:22.485>just <00:30:22.641>have <00:30:22.796>to <00:30:22.952>update <00:30:23.107>this <00:30:23.263>a <00:30:23.418>little <00:30:23.574>utility <00:30:23.730>print,

437
00:30:26.830 --> 00:30:31.310
<00:30:26.830>a <00:30:26.985>s <00:30:27.141>t <00:30:27.296>print <00:30:27.452>expression, <00:30:27.607>and <00:30:27.763>we're <00:30:27.918>just <00:30:28.074>going <00:30:28.230>return,

438
00:30:32.620 --> 00:30:37.040
<00:30:32.620>uh, <00:30:32.853>not <00:30:33.086>even <00:30:33.320>like <00:30:33.553>that, <00:30:33.786>just <00:30:34.020>going,

439
00:30:37.580 --> 00:30:40.320
<00:30:37.580>yep, <00:30:37.860>to <00:30:38.139>return <00:30:38.419>this <00:30:38.699>function. <00:30:38.980>Okay?

440
00:30:40.380 --> 00:30:45.080
<00:30:40.380>So <00:30:40.462>now <00:30:40.544>if <00:30:40.627>I <00:30:40.709>go <00:30:40.791>to <00:30:40.874>this <00:30:40.956>code <00:30:41.038>and <00:30:41.121>I <00:30:41.203>go <00:30:41.285>to <00:30:41.368>the <00:30:41.450>interpreter, <00:30:41.532>I <00:30:41.615>still <00:30:41.697>have <00:30:41.780>free.

441
00:30:45.140 --> 00:30:49.640
<00:30:45.140>And <00:30:45.233>if <00:30:45.326>I <00:30:45.420>open <00:30:45.513>my <00:30:45.606>console, <00:30:45.700>which <00:30:45.793>is <00:30:45.886>very, <00:30:45.980>very <00:30:46.073>small, <00:30:46.166>let <00:30:46.260>me <00:30:46.353>make <00:30:46.446>it <00:30:46.540>bigger.

442
00:30:54.950 --> 00:30:59.040
<00:30:54.950>Yeah, <00:30:55.090>we <00:30:55.230>can <00:30:55.370>see <00:30:55.510>that <00:30:55.650>it's <00:30:55.790>been, <00:30:55.930>it's <00:30:56.070>printing <00:30:56.210>the <00:30:56.350>results.

443
00:30:59.100 --> 00:31:03.810
<00:30:59.100>So <00:30:59.255>if <00:30:59.411>we <00:30:59.566>add <00:30:59.722>the <00:30:59.877>question <00:31:00.033>marks <00:31:00.188>in <00:31:00.344>different <00:31:00.500>places,

444
00:31:04.150 --> 00:31:06.920
<00:31:04.150>we <00:31:04.500>can <00:31:04.850>see <00:31:05.200>that, <00:31:05.550>uh,

445
00:31:07.090 --> 00:31:10.080
<00:31:07.090>let's <00:31:07.370>say <00:31:07.649>let's <00:31:07.929>a <00:31:08.209>SQL <00:31:08.490>one,

446
00:31:11.350 --> 00:31:14.270
<00:31:11.350>we <00:31:11.629>see <00:31:11.909>that <00:31:12.189>A <00:31:12.469>is <00:31:12.750>one.

447
00:31:15.130 --> 00:31:19.950
<00:31:15.130>So <00:31:15.230>that <00:31:15.330>was <00:31:15.430>the <00:31:15.530>demo <00:31:15.630>part. <00:31:15.730>I <00:31:15.830>will <00:31:15.930>go <00:31:16.030>back <00:31:16.130>to <00:31:16.230>the <00:31:16.330>slides <00:31:16.430>Now. <00:31:16.530>Uh,

448
00:31:20.220 --> 00:31:24.630
<00:31:20.220>this <00:31:20.336>language <00:31:20.453>is <00:31:20.570>open <00:31:20.686>source <00:31:20.803>of <00:31:20.920>course, <00:31:21.036>so <00:31:21.153>if <00:31:21.270>you <00:31:21.386>want <00:31:21.503>to <00:31:21.620>contribute,

449
00:31:24.630 --> 00:31:26.790
<00:31:24.630>if <00:31:24.785>you <00:31:24.941>want <00:31:25.096>to <00:31:25.252>play <00:31:25.407>with <00:31:25.563>that, <00:31:25.718>please <00:31:25.874>go <00:31:26.030>ahead.

450
00:31:26.790 --> 00:31:28.430
<00:31:26.790>There <00:31:26.945>are <00:31:27.101>a <00:31:27.256>lot <00:31:27.412>of <00:31:27.567>things <00:31:27.723>that <00:31:27.878>could <00:31:28.034>be <00:31:28.190>added.

451
00:31:28.870 --> 00:31:33.110
<00:31:28.870>I <00:31:28.963>thought <00:31:29.056>I <00:31:29.149>would <00:31:29.243>have <00:31:29.336>more <00:31:29.429>time <00:31:29.523>and <00:31:29.616>I <00:31:29.709>was <00:31:29.803>also <00:31:29.896>going <00:31:29.989>to <00:31:30.083>cover <00:31:30.176>array. <00:31:30.270>Uh,

452
00:31:33.410 --> 00:31:36.070
<00:31:33.410>but <00:31:33.550>maybe <00:31:33.690>you <00:31:33.830>can <00:31:33.970>do <00:31:34.110>this <00:31:34.250>in <00:31:34.390>your <00:31:34.530>free <00:31:34.670>time. <00:31:34.810>Uh,

453
00:31:36.150 --> 00:31:40.110
<00:31:36.150>I <00:31:36.250>would <00:31:36.350>be <00:31:36.450>happy <00:31:36.550>to <00:31:36.650>talk <00:31:36.750>to <00:31:36.850>you <00:31:36.950>about <00:31:37.050>that. <00:31:37.150>And <00:31:37.250>thank <00:31:37.350>you <00:31:37.450>very <00:31:37.550>much.

454
00:31:40.450 --> 00:31:45.110
<00:31:40.450>You <00:31:40.557>can <00:31:40.665>scan <00:31:40.773>this <00:31:40.880>QR <00:31:40.988>code <00:31:41.096>to <00:31:41.203>have <00:31:41.311>access <00:31:41.419>to <00:31:41.526>the <00:31:41.634>slides <00:31:41.742>and <00:31:41.850>my

455
00:31:45.500 --> 00:31:47.430
<00:31:45.500>website. <00:31:45.780>Thank <00:31:46.060>you <00:31:46.340>all <00:31:46.620>for <00:31:46.900>coming.