761
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1 |
1
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2 |
00:00:16,280 --> 00:00:18,330
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
3 |
A warm welcome to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
4 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
5 |
2
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
6 |
00:00:18,330 --> 00:00:20,820
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
7 |
the compilers and formal
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
8 |
languages module?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
9 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
10 |
3
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
11 |
00:00:20,820 --> 00:00:24,390
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
12 |
My name is Christian Urban.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
13 |
Thank you for coming.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
14 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
15 |
4
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
16 |
00:00:24,390 --> 00:00:27,644
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
17 |
Compilers. I guess
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
18 |
you use compilers
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
19 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
20 |
5
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
21 |
00:00:27,644 --> 00:00:31,680
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
22 |
in your daily work, be it
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
23 |
the C or Java compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
24 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
25 |
6
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
26 |
00:00:31,680 --> 00:00:34,245
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
27 |
And you might be curious
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
28 |
in what they do.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
29 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
30 |
7
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
31 |
00:00:34,245 --> 00:00:35,700
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
32 |
But you might also be
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
33 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
34 |
8
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
35 |
00:00:35,700 --> 00:00:38,130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
36 |
intimidated to look
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
37 |
what they do underneath
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
38 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
39 |
9
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
40 |
00:00:38,130 --> 00:00:39,900
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
41 |
the bonnet because they are
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
42 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
43 |
10
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
44 |
00:00:39,900 --> 00:00:42,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
45 |
quite large software systems.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
46 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
47 |
11
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
48 |
00:00:42,520 --> 00:00:46,130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
49 |
What I like to show you in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
50 |
this module is that you
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
51 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
52 |
12
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
53 |
00:00:46,130 --> 00:00:49,310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
54 |
do not need to be an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
55 |
Über hacker to implement your own
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
56 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
57 |
13
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
58 |
00:00:49,310 --> 00:00:51,305
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
59 |
compiler for your
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
60 |
own language, say.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
61 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
62 |
14
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
63 |
00:00:51,305 --> 00:00:54,155
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
64 |
So that will be the main
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
65 |
goal of this module.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
66 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
67 |
15
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
68 |
00:00:54,155 --> 00:00:56,210
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
69 |
You will implement
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
70 |
your own compiler,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
71 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
72 |
16
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
73 |
00:00:56,210 --> 00:00:58,310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
74 |
of course with my help.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
75 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
76 |
17
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
77 |
00:00:58,310 --> 00:01:02,360
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
78 |
What I personally like
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
79 |
about compilers is that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
80 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
81 |
18
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
82 |
00:01:02,360 --> 00:01:04,580
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
83 |
the subject is a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
84 |
perfect combination
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
85 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
86 |
19
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
87 |
00:01:04,580 --> 00:01:06,350
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
88 |
of theory and practice.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
89 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
90 |
20
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
91 |
00:01:06,350 --> 00:01:07,790
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
92 |
I like to hack things,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
93 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
94 |
21
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
95 |
00:01:07,790 --> 00:01:10,595
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
96 |
writing actual code,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
97 |
but I also like theory.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
98 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
99 |
22
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
100 |
00:01:10,595 --> 00:01:13,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
101 |
I want to understand what
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
102 |
my code actually does.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
103 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
104 |
23
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
105 |
00:01:13,040 --> 00:01:17,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
106 |
So compilers are the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
107 |
perfect subject for me.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
108 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
109 |
24
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
110 |
00:01:18,040 --> 00:01:20,809
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
111 |
Let's have a look at the details.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
112 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
113 |
25
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
114 |
00:01:20,809 --> 00:01:23,779
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
115 |
Here's an airplane
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
116 |
view of a compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
117 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
118 |
26
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
119 |
00:01:23,779 --> 00:01:25,850
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
120 |
On the left-hand side you can see
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
121 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
122 |
27
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
123 |
00:01:25,850 --> 00:01:28,745
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
124 |
the input program a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
125 |
developer would write.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
126 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
127 |
28
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
128 |
00:01:28,745 --> 00:01:31,955
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
129 |
And on the right-hand side is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
130 |
the output of the compiler,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
131 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
132 |
29
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
133 |
00:01:31,955 --> 00:01:36,360
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
134 |
the binary code the developer
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
135 |
wants to actually run.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
136 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
137 |
30
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
138 |
00:01:36,370 --> 00:01:40,340
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
139 |
What makes such a project
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
140 |
actually feasible is that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
141 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
142 |
31
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
143 |
00:01:40,340 --> 00:01:44,165
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
144 |
compilers fall neatly into
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
145 |
separate components.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
146 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
147 |
32
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
148 |
00:01:44,165 --> 00:01:47,210
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
149 |
So you can see the lexer and the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
150 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
151 |
33
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
152 |
00:01:47,210 --> 00:01:48,860
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
153 |
parser, which are often called the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
154 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
155 |
34
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
156 |
00:01:48,860 --> 00:01:50,990
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
157 |
front end of the compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
158 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
159 |
35
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
160 |
00:01:50,990 --> 00:01:53,000
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
161 |
And the code generation is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
162 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
163 |
36
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
164 |
00:01:53,000 --> 00:01:55,700
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
165 |
called the backend
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
166 |
of the compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
167 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
168 |
37
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
169 |
00:01:55,700 --> 00:01:57,620
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
170 |
And it so happens
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
171 |
that we will spend
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
172 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
173 |
38
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
174 |
00:01:57,620 --> 00:01:59,930
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
175 |
the first five weeks
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
176 |
on the lexer and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
177 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
178 |
39
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
179 |
00:01:59,930 --> 00:02:04,970
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
180 |
the parser, and the next five
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
181 |
weeks on the code generator.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
182 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
183 |
40
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
184 |
00:02:04,970 --> 00:02:09,575
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
185 |
The first component of the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
186 |
compiler is the lexer.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
187 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
188 |
41
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
189 |
00:02:09,575 --> 00:02:14,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
190 |
The purpose of the lexer
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
191 |
is to scan a flat
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
192 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
193 |
42
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
194 |
00:02:14,480 --> 00:02:16,610
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
195 |
string, which the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
196 |
input program is at
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
197 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
198 |
43
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
199 |
00:02:16,610 --> 00:02:19,145
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
200 |
the beginning and separate out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
201 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
202 |
44
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
203 |
00:02:19,145 --> 00:02:21,275
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
204 |
where are the words?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
205 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
206 |
45
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
207 |
00:02:21,275 --> 00:02:23,600
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
208 |
You might think
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
209 |
in Western languages,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
210 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
211 |
46
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
212 |
00:02:23,600 --> 00:02:24,920
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
213 |
that is very easy:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
214 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
215 |
47
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
216 |
00:02:24,920 --> 00:02:26,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
217 |
you just try to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
218 |
find out where are
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
219 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
220 |
48
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
221 |
00:02:26,690 --> 00:02:28,580
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
222 |
the whitespaces
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
223 |
and then you know,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
224 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
225 |
49
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
226 |
00:02:28,580 --> 00:02:31,955
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
227 |
where one word stops and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
228 |
where the next word begins.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
229 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
230 |
50
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
231 |
00:02:31,955 --> 00:02:35,300
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
232 |
But, actually, computer
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
233 |
languages are more
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
234 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
235 |
51
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
236 |
00:02:35,300 --> 00:02:38,180
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
237 |
like ancient languages
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
238 |
that you see here.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
239 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
240 |
52
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
241 |
00:02:38,180 --> 00:02:39,860
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
242 |
For example, ancient Greek.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
243 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
244 |
53
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
245 |
00:02:39,860 --> 00:02:42,065
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
246 |
The writer wrote one word
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
247 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
248 |
54
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
249 |
00:02:42,065 --> 00:02:44,915
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
250 |
after the next and not
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
251 |
leaving any space.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
252 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
253 |
55
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
254 |
00:02:44,915 --> 00:02:47,930
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
255 |
So for example, in this
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
256 |
very simple string here
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
257 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
258 |
56
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
259 |
00:02:47,930 --> 00:02:50,960
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
260 |
read n, there is no space at all.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
261 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
262 |
57
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
263 |
00:02:50,960 --> 00:02:53,540
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
264 |
But the purpose of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
265 |
the lexer is to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
266 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
267 |
58
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
268 |
00:02:53,540 --> 00:02:56,570
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
269 |
separate it into five
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
270 |
different components.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
271 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
272 |
59
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
273 |
00:02:56,570 --> 00:02:59,450
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
274 |
It has to first say,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
275 |
well there is a read,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
276 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
277 |
60
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
278 |
00:02:59,450 --> 00:03:01,595
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
279 |
then there is a left parenthesis,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
280 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
281 |
61
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
282 |
00:03:01,595 --> 00:03:04,025
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
283 |
then there's an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
284 |
identifier called n,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
285 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
286 |
62
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
287 |
00:03:04,025 --> 00:03:07,715
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
288 |
then there's a right parenthesis,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
289 |
and finally a semicolon.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
290 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
291 |
63
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
292 |
00:03:07,715 --> 00:03:11,345
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
293 |
And as you can see, there
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
294 |
is no space here at all.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
295 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
296 |
64
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
297 |
00:03:11,345 --> 00:03:14,150
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
298 |
And so the task of finding where
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
299 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
300 |
65
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
301 |
00:03:14,150 --> 00:03:17,705
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
302 |
are the words is actually
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
303 |
quite involved.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
304 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
305 |
66
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
306 |
00:03:17,705 --> 00:03:19,460
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
307 |
Also the classification is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
308 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
309 |
67
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
310 |
00:03:19,460 --> 00:03:22,055
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
311 |
sometimes not so straightforward.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
312 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
313 |
68
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
314 |
00:03:22,055 --> 00:03:24,350
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
315 |
If, for example, a writer
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
316 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
317 |
69
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
318 |
00:03:24,350 --> 00:03:26,360
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
319 |
wrote "if" on its own,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
320 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
321 |
70
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
322 |
00:03:26,360 --> 00:03:29,000
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
323 |
then this should be a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
324 |
keyword classified as
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
325 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
326 |
71
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
327 |
00:03:29,000 --> 00:03:32,615
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
328 |
a keyword because it's
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
329 |
from the if-then-else.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
330 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
331 |
72
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
332 |
00:03:32,615 --> 00:03:36,800
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
333 |
But if the developer wrote
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
334 |
something longer like "iffoo",
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
335 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
336 |
73
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
337 |
00:03:36,800 --> 00:03:38,030
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
338 |
then this might just be
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
339 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
340 |
74
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
341 |
00:03:38,030 --> 00:03:39,860
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
342 |
a strange variable name
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
343 |
and he needs to be
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
344 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
345 |
75
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
346 |
00:03:39,860 --> 00:03:44,250
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
347 |
classified as a variable name.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
348 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
349 |
76
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
350 |
00:03:45,220 --> 00:03:50,720
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
351 |
The output of the lexer
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
352 |
is a sequence of tokens.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
353 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
354 |
77
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
355 |
00:03:50,720 --> 00:03:53,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
356 |
These are essentially the words in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
357 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
358 |
78
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
359 |
00:03:53,480 --> 00:03:56,405
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
360 |
a sentence and their
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
361 |
classification:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
362 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
363 |
79
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
364 |
00:03:56,405 --> 00:03:59,540
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
365 |
they are nouns,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
366 |
verbs or adjectives.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
367 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
368 |
80
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
369 |
00:03:59,540 --> 00:04:02,885
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
370 |
For us, of course, the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
371 |
classification would be keywords,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
372 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
373 |
81
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
374 |
00:04:02,885 --> 00:04:06,005
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
375 |
identifiers,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
376 |
operators, and so on.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
377 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
378 |
82
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
379 |
00:04:06,005 --> 00:04:11,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
380 |
And these tokens are the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
381 |
input for the parser,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
382 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
383 |
83
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
384 |
00:04:11,480 --> 00:04:13,085
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
385 |
the next component in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
386 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
387 |
84
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
388 |
00:04:13,085 --> 00:04:17,240
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
389 |
our compiler. The parser
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
390 |
essentially takes this list
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
391 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
392 |
85
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
393 |
00:04:17,240 --> 00:04:23,300
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
394 |
of tokens and transforms it
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
395 |
into a abstract syntax tree.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
396 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
397 |
86
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
398 |
00:04:23,300 --> 00:04:27,230
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
399 |
That means we have now the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
400 |
sentence, we have the words.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
401 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
402 |
87
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
403 |
00:04:27,230 --> 00:04:30,275
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
404 |
We have to relate
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
405 |
the words to each other
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
406 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
407 |
88
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
408 |
00:04:30,275 --> 00:04:33,680
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
409 |
in order to find out what
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
410 |
this sentence actually means.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
411 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
412 |
89
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
413 |
00:04:33,680 --> 00:04:35,405
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
414 |
In this case here,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
415 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
416 |
90
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
417 |
00:04:35,405 --> 00:04:38,595
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
418 |
we have to do a read...which
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
419 |
variable is affected?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
420 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
421 |
91
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
422 |
00:04:38,595 --> 00:04:45,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
423 |
The variable n. Once we have
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
424 |
the abstract syntax tree,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
425 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
426 |
92
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
427 |
00:04:45,040 --> 00:04:49,225
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
428 |
it can go to the next component,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
429 |
to the code generator.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
430 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
431 |
93
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
432 |
00:04:49,225 --> 00:04:52,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
433 |
Whilst it doesn't look
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
434 |
like this in this picture,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
435 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
436 |
94
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
437 |
00:04:52,480 --> 00:04:54,100
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
438 |
the code generators is usually the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
439 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
440 |
95
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
441 |
00:04:54,100 --> 00:04:56,080
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
442 |
biggest part in a compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
443 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
444 |
96
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
445 |
00:04:56,080 --> 00:04:58,720
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
446 |
And here we actually
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
447 |
have to cut corners.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
448 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
449 |
97
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
450 |
00:04:58,720 --> 00:05:02,470
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
451 |
Instead of producing binary
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
452 |
code, which can be run
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
453 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
454 |
98
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
455 |
00:05:02,470 --> 00:05:06,820
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
456 |
directly on a CPU, like X86 or ARM,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
457 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
458 |
99
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
459 |
00:05:06,820 --> 00:05:11,035
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
460 |
we actually target the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
461 |
Java Virtual Machine, the JVM.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
462 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
463 |
100
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
464 |
00:05:11,035 --> 00:05:13,600
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
465 |
This is very similar
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
466 |
to the Scala compiler,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
467 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
468 |
101
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
469 |
00:05:13,600 --> 00:05:16,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
470 |
for example, which
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
471 |
produces JVM code.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
472 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
473 |
102
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
474 |
00:05:16,480 --> 00:05:18,940
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
475 |
Or, of course, also
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
476 |
the Java compiler,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
477 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
478 |
103
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
479 |
00:05:18,940 --> 00:05:20,845
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
480 |
which produces JVM code.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
481 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
482 |
104
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
483 |
00:05:20,845 --> 00:05:23,900
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
484 |
So here's a typical
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
485 |
example code which we're
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
486 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
487 |
105
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
488 |
00:05:23,900 --> 00:05:27,305
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
489 |
going to produce: Something
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
490 |
like variable 2
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
491 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
492 |
106
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
493 |
00:05:27,305 --> 00:05:30,545
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
494 |
gets allocated in the stack.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
495 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
496 |
107
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
497 |
00:05:30,545 --> 00:05:32,390
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
498 |
You subtract ten from it.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
499 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
500 |
108
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
501 |
00:05:32,390 --> 00:05:36,050
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
502 |
You test whether the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
503 |
variable is 0 and if yes,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
504 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
505 |
109
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
506 |
00:05:36,050 --> 00:05:40,170
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
507 |
you jump somewhere and otherwise
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
508 |
you reload the variable.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
509 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
510 |
110
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
511 |
00:05:41,560 --> 00:05:45,935
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
512 |
Even though we cut corners
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
513 |
into could generate apart.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
514 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
515 |
111
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
516 |
00:05:45,935 --> 00:05:48,575
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
517 |
By producing code for the JVM,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
518 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
519 |
112
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
520 |
00:05:48,575 --> 00:05:51,710
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
521 |
we can still obtain quite
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
522 |
impressive results.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
523 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
524 |
113
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
525 |
00:05:51,710 --> 00:05:56,225
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
526 |
Here's a program with
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
527 |
a cubic runtime behaviour.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
528 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
529 |
114
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
530 |
00:05:56,225 --> 00:05:59,525
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
531 |
When it has to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
532 |
calculate with 400 units,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
533 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
534 |
115
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
535 |
00:05:59,525 --> 00:06:02,165
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
536 |
it might need five
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
537 |
seconds to calculate.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
538 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
539 |
116
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
540 |
00:06:02,165 --> 00:06:05,345
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
541 |
But if it has to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
542 |
calculate with 1200 units,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
543 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
544 |
117
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
545 |
00:06:05,345 --> 00:06:08,165
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
546 |
it already needs more
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
547 |
than two minutes.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
548 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
549 |
118
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
550 |
00:06:08,165 --> 00:06:10,940
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
551 |
Now these timings,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
552 |
the blue timings
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
553 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
554 |
119
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
555 |
00:06:10,940 --> 00:06:13,910
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
556 |
are obtained with an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
557 |
interpreter of that program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
558 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
559 |
120
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
560 |
00:06:13,910 --> 00:06:16,265
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
561 |
And you can see
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
562 |
just next to it,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
563 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
564 |
121
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
565 |
00:06:16,265 --> 00:06:18,050
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
566 |
the red times.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
567 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
568 |
122
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
569 |
00:06:18,050 --> 00:06:20,359
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
570 |
They are obtained
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
571 |
with the compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
572 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
573 |
123
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
574 |
00:06:20,359 --> 00:06:23,135
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
575 |
we're going to write
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
576 |
in this module.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
577 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
578 |
124
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
579 |
00:06:23,135 --> 00:06:25,100
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
580 |
And there you can see, even
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
581 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
582 |
125
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
583 |
00:06:25,100 --> 00:06:29,000
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
584 |
with 1200, the times get
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
585 |
hardly off the x-axis.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
586 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
587 |
126
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
588 |
00:06:29,000 --> 00:06:30,485
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
589 |
So in this instance,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
590 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
591 |
127
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
592 |
00:06:30,485 --> 00:06:32,630
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
593 |
our compiler will
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
594 |
have a speed up from
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
595 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
596 |
128
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
597 |
00:06:32,630 --> 00:06:37,589
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
598 |
approximately 1 million in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
599 |
comparison to the interpreter.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
600 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
601 |
129
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
602 |
00:06:38,350 --> 00:06:42,020
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
603 |
This might be a fun task
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
604 |
for your spare time.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
605 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
606 |
130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
607 |
00:06:42,020 --> 00:06:44,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
608 |
This is a compiler explorer,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
609 |
which allows you to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
610 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
611 |
131
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
612 |
00:06:44,480 --> 00:06:47,060
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
613 |
write C code on the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
614 |
left-hand side.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
615 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
616 |
132
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
617 |
00:06:47,060 --> 00:06:49,115
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
618 |
It shows you on the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
619 |
right-hand side
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
620 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
621 |
133
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
622 |
00:06:49,115 --> 00:06:53,270
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
623 |
the machine code an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
624 |
X86 CPU can run.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
625 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
626 |
134
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
627 |
00:06:53,270 --> 00:06:56,060
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
628 |
For example, it gives
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
629 |
you these color scheme and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
630 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
631 |
135
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
632 |
00:06:56,060 --> 00:06:59,000
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
633 |
says that this addition
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
634 |
in the num + num in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
635 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
636 |
136
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
637 |
00:06:59,000 --> 00:07:01,580
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
638 |
the return statement,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
639 |
translates to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
640 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
641 |
137
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
642 |
00:07:01,580 --> 00:07:02,960
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
643 |
essentially an addition of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
644 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
645 |
138
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
646 |
00:07:02,960 --> 00:07:05,930
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
647 |
an register in the machine code.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
648 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
649 |
139
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
650 |
00:07:05,930 --> 00:07:08,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
651 |
I think this compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
652 |
explorer also works for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
653 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
654 |
140
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
655 |
00:07:08,480 --> 00:07:11,495
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
656 |
the Haskell language and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
657 |
also produces ARM code,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
658 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
659 |
141
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
660 |
00:07:11,495 --> 00:07:15,245
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
661 |
not just code for the X86 CPUs.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
662 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
663 |
142
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
664 |
00:07:15,245 --> 00:07:18,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
665 |
As an aside, I also recommend
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
666 |
to watch the movie of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
667 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
668 |
143
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
669 |
00:07:18,950 --> 00:07:20,870
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
670 |
this guy because that is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
671 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
672 |
144
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
673 |
00:07:20,870 --> 00:07:22,940
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
674 |
very much like how I worked
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
675 |
at the beginning
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
676 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
677 |
145
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
678 |
00:07:22,940 --> 00:07:25,355
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
679 |
when implementing our compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
680 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
681 |
146
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
682 |
00:07:25,355 --> 00:07:29,300
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
683 |
I wrote some code which I
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
684 |
knew how it should behave.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
685 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
686 |
147
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
687 |
00:07:29,300 --> 00:07:30,725
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
688 |
And then I just had a look
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
689 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
690 |
148
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
691 |
00:07:30,725 --> 00:07:32,900
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
692 |
what another compiler produces.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
693 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
694 |
149
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
695 |
00:07:32,900 --> 00:07:37,190
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
696 |
And I imitated that code
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
697 |
as much as I could.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
698 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
699 |
150
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
700 |
00:07:37,190 --> 00:07:39,380
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
701 |
Such a compiler explorer
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
702 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
703 |
151
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
704 |
00:07:39,380 --> 00:07:41,375
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
705 |
also exists for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
706 |
the Java language.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
707 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
708 |
152
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
709 |
00:07:41,375 --> 00:07:42,935
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
710 |
Here's one where you can write
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
711 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
712 |
153
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
713 |
00:07:42,935 --> 00:07:44,915
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
714 |
Java code on the left-hand side,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
715 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
716 |
154
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
717 |
00:07:44,915 --> 00:07:47,930
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
718 |
and on the right-hand
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
719 |
side you get JVM code.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
720 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
721 |
155
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
722 |
00:07:47,930 --> 00:07:50,255
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
723 |
JVM code is a byte code
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
724 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
725 |
156
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
726 |
00:07:50,255 --> 00:07:53,405
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
727 |
which cannot be run
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
728 |
directly by the CPU,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
729 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
730 |
157
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
731 |
00:07:53,405 --> 00:07:55,220
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
732 |
but needs the Java
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
733 |
Virtual Machine
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
734 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
735 |
158
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
736 |
00:07:55,220 --> 00:07:57,170
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
737 |
to essentially interpret that.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
738 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
739 |
159
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
740 |
00:07:57,170 --> 00:07:58,760
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
741 |
This means it's not
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
742 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
743 |
160
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
744 |
00:07:58,760 --> 00:08:01,235
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
745 |
the most efficient way
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
746 |
how to run programs -
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
747 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
748 |
161
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
749 |
00:08:01,235 --> 00:08:02,780
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
750 |
it would be much faster to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
751 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
752 |
162
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
753 |
00:08:02,780 --> 00:08:05,285
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
754 |
generate direct
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
755 |
code for the CPU.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
756 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
757 |
163
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
758 |
00:08:05,285 --> 00:08:07,700
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
759 |
But by producing bytecode,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
760 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
761 |
164
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
762 |
00:08:07,700 --> 00:08:11,435
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
763 |
we still run the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
764 |
programs quite fast
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
765 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
766 |
165
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
767 |
00:08:11,435 --> 00:08:13,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
768 |
and it also simplifies
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
769 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
770 |
166
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
771 |
00:08:13,520 --> 00:08:16,280
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
772 |
a number of issues
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
773 |
in our compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
774 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
775 |
167
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
776 |
00:08:16,280 --> 00:08:18,980
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
777 |
One issue is about
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
778 |
memory management.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
779 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
780 |
168
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
781 |
00:08:18,980 --> 00:08:22,055
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
782 |
We don't have to be concerned
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
783 |
about register allocation,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
784 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
785 |
169
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
786 |
00:08:22,055 --> 00:08:25,505
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
787 |
which we would need
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
788 |
to do in a real CPU.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
789 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
790 |
170
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
791 |
00:08:25,505 --> 00:08:27,680
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
792 |
This will be done by the JVM.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
793 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
794 |
171
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
795 |
00:08:27,680 --> 00:08:29,750
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
796 |
It's also much easier to produce
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
797 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
798 |
172
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
799 |
00:08:29,750 --> 00:08:33,635
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
800 |
this bytecode rather than
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
801 |
actual machine code.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
802 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
803 |
173
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
804 |
00:08:33,635 --> 00:08:37,385
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
805 |
I think it's now a good time
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
806 |
to come to the question,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
807 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
808 |
174
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
809 |
00:08:37,385 --> 00:08:39,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
810 |
why on Earth studying compilers.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
811 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
812 |
175
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
813 |
00:08:39,950 --> 00:08:42,650
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
814 |
Compilers are such an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
815 |
established subject
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
816 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
817 |
176
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
818 |
00:08:42,650 --> 00:08:43,985
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
819 |
in computer science.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
820 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
821 |
177
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
822 |
00:08:43,985 --> 00:08:46,100
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
823 |
Compilers do what they do.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
824 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
825 |
178
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
826 |
00:08:46,100 --> 00:08:48,410
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
827 |
Probably forrests have
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
828 |
been killed by
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
829 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
830 |
179
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
831 |
00:08:48,410 --> 00:08:52,190
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
832 |
all the books that have been
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
833 |
published on compilers.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
834 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
835 |
180
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
836 |
00:08:52,190 --> 00:08:56,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
837 |
Why on Earth studying
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
838 |
compilers in 2020? And even worse
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
839 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
840 |
181
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
841 |
00:08:56,690 --> 00:08:59,659
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
842 |
why implementing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
843 |
your own compiler?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
844 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
845 |
182
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
846 |
00:08:59,659 --> 00:09:02,720
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
847 |
Well, a slightly humorous take on
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
848 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
849 |
183
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
850 |
00:09:02,720 --> 00:09:05,105
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
851 |
that question is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
852 |
given by John Regehr,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
853 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
854 |
184
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
855 |
00:09:05,105 --> 00:09:08,375
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
856 |
who is a compiler hacker
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
857 |
from the University of Utah.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
858 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
859 |
185
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
860 |
00:09:08,375 --> 00:09:09,770
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
861 |
Essentially what he says,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
862 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
863 |
186
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
864 |
00:09:09,770 --> 00:09:12,110
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
865 |
if you're a good compiler hacker,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
866 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
867 |
187
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
868 |
00:09:12,110 --> 00:09:14,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
869 |
you have no problems
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
870 |
of finding a job.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
871 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
872 |
188
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
873 |
00:09:14,690 --> 00:09:17,210
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
874 |
He puts it as: It's effectively
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
875 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
876 |
189
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
877 |
00:09:17,210 --> 00:09:22,320
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
878 |
a "Perpetual Employment Act"
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
879 |
for solid compiler hackers.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
880 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
881 |
190
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
882 |
00:09:22,990 --> 00:09:27,380
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
883 |
Regehr gives two justifications
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
884 |
for that statement.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
885 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
886 |
191
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
887 |
00:09:27,380 --> 00:09:29,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
888 |
First, he says
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
889 |
hardware is getting
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
890 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
891 |
192
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
892 |
00:09:29,690 --> 00:09:32,585
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
893 |
wierder, rather than
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
894 |
getting clocked faster.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
895 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
896 |
193
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
897 |
00:09:32,585 --> 00:09:34,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
898 |
And that's definitely true.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
899 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
900 |
194
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
901 |
00:09:34,520 --> 00:09:36,590
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
902 |
My first computer many, many,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
903 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
904 |
195
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
905 |
00:09:36,590 --> 00:09:40,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
906 |
many years ago contained
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
907 |
only a single core CPU.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
908 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
909 |
196
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
910 |
00:09:40,040 --> 00:09:44,030
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
911 |
And it was such a simple CPU
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
912 |
that we wrote machine code
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
913 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
914 |
197
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
915 |
00:09:44,030 --> 00:09:46,220
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
916 |
directly for that CPU in order to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
917 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
918 |
198
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
919 |
00:09:46,220 --> 00:09:49,740
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
920 |
run our programs as
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
921 |
fast as possible.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
922 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
923 |
199
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
924 |
00:09:50,260 --> 00:09:53,600
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
925 |
In contrast, today, Regehr writes,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
926 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
927 |
200
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
928 |
00:09:53,600 --> 00:09:57,005
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
929 |
almost all processors are
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
930 |
multi-core nowadays.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
931 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
932 |
201
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
933 |
00:09:57,005 --> 00:09:59,870
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
934 |
And it looks like there's
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
935 |
an increasing asymmetry
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
936 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
937 |
202
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
938 |
00:09:59,870 --> 00:10:02,015
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
939 |
in resources across cores.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
940 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
941 |
203
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
942 |
00:10:02,015 --> 00:10:04,445
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
943 |
Processors come
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
944 |
with vector units,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
945 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
946 |
204
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
947 |
00:10:04,445 --> 00:10:07,189
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
948 |
crypto accelerators, etc.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
949 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
950 |
205
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
951 |
00:10:07,189 --> 00:10:11,930
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
952 |
We have TSPs, GPUs, ARM
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
953 |
big,little, Xeon Phis,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
954 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
955 |
206
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
956 |
00:10:11,930 --> 00:10:14,630
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
957 |
and this only scratches the surface.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
958 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
959 |
207
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
960 |
00:10:14,630 --> 00:10:17,255
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
961 |
And that is really a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
962 |
problem for compilers,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
963 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
964 |
208
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
965 |
00:10:17,255 --> 00:10:20,495
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
966 |
because if we now
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
967 |
have multi-core CPUs,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
968 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
969 |
209
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
970 |
00:10:20,495 --> 00:10:23,180
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
971 |
that means our programs need
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
972 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
973 |
210
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
974 |
00:10:23,180 --> 00:10:26,075
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
975 |
to be scheduled
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
976 |
over several CPUs.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
977 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
978 |
211
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
979 |
00:10:26,075 --> 00:10:28,220
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
980 |
But the developer, of course,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
981 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
982 |
212
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
983 |
00:10:28,220 --> 00:10:30,545
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
984 |
doesn't want to know
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
985 |
anything about that.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
986 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
987 |
213
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
988 |
00:10:30,545 --> 00:10:34,655
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
989 |
Also, now we have more
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
990 |
CPUs in a computer,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
991 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
992 |
214
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
993 |
00:10:34,655 --> 00:10:37,400
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
994 |
but they seem to also come
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
995 |
with different resources.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
996 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
997 |
215
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
998 |
00:10:37,400 --> 00:10:40,310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
999 |
So certain tasks in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1000 |
a program need to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1001 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1002 |
216
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1003 |
00:10:40,310 --> 00:10:43,460
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1004 |
be scheduled on some
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1005 |
cores, but not on others.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1006 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1007 |
217
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1008 |
00:10:43,460 --> 00:10:46,685
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1009 |
We also have for a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1010 |
long time already GPUs,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1011 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1012 |
218
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1013 |
00:10:46,685 --> 00:10:49,025
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1014 |
which are highly specialized for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1015 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1016 |
219
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1017 |
00:10:49,025 --> 00:10:53,240
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1018 |
very parallel computations
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1019 |
to do with graphics.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1020 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1021 |
220
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1022 |
00:10:53,240 --> 00:10:56,015
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1023 |
They at least in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1024 |
the past few years,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1025 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1026 |
221
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1027 |
00:10:56,015 --> 00:10:59,360
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1028 |
they could only do very
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1029 |
special computations,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1030 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1031 |
222
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1032 |
00:10:59,360 --> 00:11:02,255
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1033 |
but very, very fast
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1034 |
and highly parallel.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1035 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1036 |
223
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1037 |
00:11:02,255 --> 00:11:05,539
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1038 |
You couldn't use them for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1039 |
general-purpose calculations,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1040 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1041 |
224
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1042 |
00:11:05,539 --> 00:11:10,205
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1043 |
which you would usually
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1044 |
use CPUs. Similarly, DSPs.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1045 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1046 |
225
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1047 |
00:11:10,205 --> 00:11:14,075
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1048 |
They are needed for all
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1049 |
the signal processing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1050 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1051 |
226
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1052 |
00:11:14,075 --> 00:11:16,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1053 |
in mobile phones.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1054 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1055 |
227
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1056 |
00:11:16,040 --> 00:11:20,780
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1057 |
Without them, we just
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1058 |
wouldn't have mobile phones.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1059 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1060 |
228
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1061 |
00:11:20,780 --> 00:11:23,525
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1062 |
The second reason Regehr gives is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1063 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1064 |
229
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1065 |
00:11:23,525 --> 00:11:25,550
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1066 |
that we are getting tired of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1067 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1068 |
230
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1069 |
00:11:25,550 --> 00:11:27,620
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1070 |
low-level languages and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1071 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1072 |
231
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1073 |
00:11:27,620 --> 00:11:30,335
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1074 |
their associated
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1075 |
security disasters.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1076 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1077 |
232
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1078 |
00:11:30,335 --> 00:11:32,435
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1079 |
While at the beginning
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1080 |
we were still
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1081 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1082 |
233
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1083 |
00:11:32,435 --> 00:11:34,760
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1084 |
happy to write machine
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1085 |
code directly,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1086 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1087 |
234
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1088 |
00:11:34,760 --> 00:11:37,175
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1089 |
nobody wants to do this nowadays.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1090 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1091 |
235
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1092 |
00:11:37,175 --> 00:11:39,515
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1093 |
He writes: :We want
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1094 |
to write new code
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1095 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1096 |
236
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1097 |
00:11:39,515 --> 00:11:44,120
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1098 |
to whatever extent possible in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1099 |
safer high-level languages.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1100 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1101 |
237
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1102 |
00:11:44,120 --> 00:11:46,130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1103 |
Compilers are caught right
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1104 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1105 |
238
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1106 |
00:11:46,130 --> 00:11:48,365
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1107 |
in the middle of these
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1108 |
opposing trends:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1109 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1110 |
239
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1111 |
00:11:48,365 --> 00:11:50,765
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1112 |
one of their main jobs
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1113 |
is to have bridged
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1114 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1115 |
240
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1116 |
00:11:50,765 --> 00:11:53,240
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1117 |
the large and growing gap between
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1118 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1119 |
241
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1120 |
00:11:53,240 --> 00:11:55,460
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1121 |
increasingly high-level languages
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1122 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1123 |
242
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1124 |
00:11:55,460 --> 00:11:58,565
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1125 |
and increasingly
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1126 |
wacky platforms.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1127 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1128 |
243
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1129 |
00:11:58,565 --> 00:12:00,320
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1130 |
So here you have it:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1131 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1132 |
244
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1133 |
00:12:00,320 --> 00:12:02,750
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1134 |
It's still interesting to study
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1135 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1136 |
245
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1137 |
00:12:02,750 --> 00:12:06,244
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1138 |
compilers nowadays,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1139 |
especially nowadays.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1140 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1141 |
246
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1142 |
00:12:06,244 --> 00:12:09,875
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1143 |
Well, if you want to work
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1144 |
on interesting problems,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1145 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1146 |
247
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1147 |
00:12:09,875 --> 00:12:14,570
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1148 |
then very often you have to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1149 |
know compilers. Here's one:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1150 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1151 |
248
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1152 |
00:12:14,570 --> 00:12:16,940
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1153 |
In the good old
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1154 |
times when we were
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1155 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1156 |
249
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1157 |
00:12:16,940 --> 00:12:19,310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1158 |
still able to fly on holidays,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1159 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1160 |
250
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1161 |
00:12:19,310 --> 00:12:23,300
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1162 |
I'm sure you flew in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1163 |
a 777 Boeing airplane.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1164 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1165 |
251
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1166 |
00:12:23,300 --> 00:12:25,850
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1167 |
It's actually already
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1168 |
a quite old airplane.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1169 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1170 |
252
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1171 |
00:12:25,850 --> 00:12:28,295
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1172 |
But they had the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1173 |
following problem.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1174 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1175 |
253
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1176 |
00:12:28,295 --> 00:12:33,020
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1177 |
What happens if a CPU
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1178 |
calculates the wrong result?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1179 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1180 |
254
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1181 |
00:12:33,020 --> 00:12:36,065
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1182 |
And that's actually not
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1183 |
such a hypothetical problem
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1184 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1185 |
255
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1186 |
00:12:36,065 --> 00:12:40,295
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1187 |
because you remember
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1188 |
the Pentium CPU
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1189 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1190 |
256
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1191 |
00:12:40,295 --> 00:12:43,655
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1192 |
in around 2000
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1193 |
contained a bug and it cost
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1194 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1195 |
257
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1196 |
00:12:43,655 --> 00:12:48,140
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1197 |
a lot of money for Intel
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1198 |
to replace this CPU.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1199 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1200 |
258
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1201 |
00:12:48,140 --> 00:12:51,470
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1202 |
What happens if an CPU calculates
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1203 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1204 |
259
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1205 |
00:12:51,470 --> 00:12:56,105
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1206 |
the wrong result in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1207 |
some navigation data?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1208 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1209 |
260
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1210 |
00:12:56,105 --> 00:12:58,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1211 |
Do you just let the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1212 |
airplane crash?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1213 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1214 |
261
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1215 |
00:12:58,520 --> 00:13:00,650
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1216 |
Well, the engineers at Boeing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1217 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1218 |
262
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1219 |
00:13:00,650 --> 00:13:02,675
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1220 |
came up with the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1221 |
following solution:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1222 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1223 |
263
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1224 |
00:13:02,675 --> 00:13:05,055
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1225 |
They writing one program that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1226 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1227 |
264
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1228 |
00:13:05,055 --> 00:13:08,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1229 |
essentially controls
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1230 |
how their airplane
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1231 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1232 |
265
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1233 |
00:13:08,690 --> 00:13:10,295
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1234 |
is supposed to fly.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1235 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1236 |
266
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1237 |
00:13:10,295 --> 00:13:13,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1238 |
In a programming language
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1239 |
called Ada that is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1240 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1241 |
267
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1242 |
00:13:13,040 --> 00:13:15,770
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1243 |
slightly obscure
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1244 |
programming language
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1245 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1246 |
268
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1247 |
00:13:15,770 --> 00:13:18,650
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1248 |
bat is very well-known in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1249 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1250 |
269
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1251 |
00:13:18,650 --> 00:13:22,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1252 |
areas where safety
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1253 |
is really paramount.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1254 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1255 |
270
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1256 |
00:13:22,040 --> 00:13:25,010
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1257 |
And what they did is they
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1258 |
took this one Ada program
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1259 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1260 |
271
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1261 |
00:13:25,010 --> 00:13:28,010
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1262 |
and they essentially
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1263 |
took three compilers,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1264 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1265 |
272
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1266 |
00:13:28,010 --> 00:13:29,435
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1267 |
independent compilers,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1268 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1269 |
273
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1270 |
00:13:29,435 --> 00:13:32,045
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1271 |
which compiled the program
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1272 |
to different CPUs.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1273 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1274 |
274
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1275 |
00:13:32,045 --> 00:13:33,815
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1276 |
One CPU from Intel,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1277 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1278 |
275
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1279 |
00:13:33,815 --> 00:13:37,235
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1280 |
one CPU for Motorola,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1281 |
and one from AMD.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1282 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1283 |
276
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1284 |
00:13:37,235 --> 00:13:38,930
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1285 |
And these are quite different
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1286 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1287 |
277
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1288 |
00:13:38,930 --> 00:13:40,955
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1289 |
CPUs. Also some of them
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1290 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1291 |
278
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1292 |
00:13:40,955 --> 00:13:42,755
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1293 |
have quite different philosophies
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1294 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1295 |
279
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1296 |
00:13:42,755 --> 00:13:45,245
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1297 |
on how they do their calculations.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1298 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1299 |
280
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1300 |
00:13:45,245 --> 00:13:47,330
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1301 |
Now what they could do is, they
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1302 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1303 |
281
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1304 |
00:13:47,330 --> 00:13:50,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1305 |
could put these three computers
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1306 |
on a single board and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1307 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1308 |
282
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1309 |
00:13:50,690 --> 00:13:54,335
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1310 |
could now run all their
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1311 |
calculations in parallel.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1312 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1313 |
283
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1314 |
00:13:54,335 --> 00:13:56,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1315 |
One with an Intel
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1316 |
CPU, one with
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1317 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1318 |
284
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1319 |
00:13:56,690 --> 00:14:00,245
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1320 |
Motorola, and one with a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1321 |
Risc computers say.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1322 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1323 |
285
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1324 |
00:14:00,245 --> 00:14:02,795
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1325 |
And then they could
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1326 |
compare the results.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1327 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1328 |
286
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1329 |
00:14:02,795 --> 00:14:05,030
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1330 |
And if these results differed,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1331 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1332 |
287
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1333 |
00:14:05,030 --> 00:14:07,940
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1334 |
then they knew one CPU must have
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1335 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1336 |
288
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1337 |
00:14:07,940 --> 00:14:11,600
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1338 |
calculated the wrong result
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1339 |
and probably told the pilot,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1340 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1341 |
289
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1342 |
00:14:11,600 --> 00:14:14,850
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1343 |
please don't let
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1344 |
that airplane crash.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1345 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1346 |
290
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1347 |
00:14:14,950 --> 00:14:17,270
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1348 |
Not just Boeing is doing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1349 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1350 |
291
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1351 |
00:14:17,270 --> 00:14:19,355
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1352 |
interesting things
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1353 |
with compilers.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1354 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1355 |
292
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1356 |
00:14:19,355 --> 00:14:22,640
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1357 |
Also, Airbus in a completely
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1358 |
different setting
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1359 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1360 |
293
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1361 |
00:14:22,640 --> 00:14:24,260
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1362 |
is using compilers in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1363 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1364 |
294
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1365 |
00:14:24,260 --> 00:14:26,420
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1366 |
a interesting way to get
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1367 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1368 |
295
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1369 |
00:14:26,420 --> 00:14:30,195
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1370 |
their airplanes up in the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1371 |
air and let them not crush.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1372 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1373 |
296
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1374 |
00:14:30,195 --> 00:14:33,010
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1375 |
In another example, I
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1376 |
have friends working
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1377 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1378 |
297
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1379 |
00:14:33,010 --> 00:14:35,350
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1380 |
at Facebook who work on
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1381 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1382 |
298
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1383 |
00:14:35,350 --> 00:14:37,900
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1384 |
compilers to make sense
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1385 |
are they are heaps
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1386 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1387 |
299
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1388 |
00:14:37,900 --> 00:14:41,470
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1389 |
and heaps and heaps of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1390 |
code written in PHP,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1391 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1392 |
300
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1393 |
00:14:41,470 --> 00:14:42,880
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1394 |
which is one of the most
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1395 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1396 |
301
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1397 |
00:14:42,880 --> 00:14:44,920
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1398 |
horrible languages on the planet.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1399 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1400 |
302
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1401 |
00:14:44,920 --> 00:14:46,630
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1402 |
The bottom line is,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1403 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1404 |
303
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1405 |
00:14:46,630 --> 00:14:50,499
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1406 |
compilers are still very,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1407 |
very important nowadays.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1408 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1409 |
304
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1410 |
00:14:50,499 --> 00:14:52,810
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1411 |
And for the foreseeable future,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1412 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1413 |
305
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1414 |
00:14:52,810 --> 00:14:56,150
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1415 |
compilers still need
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1416 |
to be developed.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1417 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1418 |
306
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1419 |
00:14:57,270 --> 00:15:00,235
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1420 |
When one talks about
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1421 |
compilers then
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1422 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1423 |
307
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1424 |
00:15:00,235 --> 00:15:01,630
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1425 |
there is, of course,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1426 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1427 |
308
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1428 |
00:15:01,630 --> 00:15:05,395
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1429 |
a magic element involved. They're
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1430 |
large software systems.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1431 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1432 |
309
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1433 |
00:15:05,395 --> 00:15:07,750
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1434 |
And yes, they're supposed to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1435 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1436 |
310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1437 |
00:15:07,750 --> 00:15:10,525
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1438 |
generate a runnable binary for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1439 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1440 |
311
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1441 |
00:15:10,525 --> 00:15:12,105
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1442 |
a high-level program,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1443 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1444 |
312
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1445 |
00:15:12,105 --> 00:15:15,230
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1446 |
but they are also supposed
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1447 |
to make our programs better.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1448 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1449 |
313
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1450 |
00:15:15,230 --> 00:15:18,920
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1451 |
They optimize our
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1452 |
programs to run faster.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1453 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1454 |
314
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1455 |
00:15:18,920 --> 00:15:22,610
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1456 |
And there's a lot of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1457 |
"magic" involved in that.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1458 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1459 |
315
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1460 |
00:15:22,610 --> 00:15:24,890
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1461 |
Magic in inverted quotes.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1462 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1463 |
316
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1464 |
00:15:24,890 --> 00:15:26,480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1465 |
I would like to show you one of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1466 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1467 |
317
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1468 |
00:15:26,480 --> 00:15:29,340
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1469 |
this magic in one example.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1470 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1471 |
318
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1472 |
00:15:31,090 --> 00:15:33,110
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1473 |
I hope you still have
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1474 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1475 |
319
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1476 |
00:15:33,110 --> 00:15:36,485
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1477 |
fond memories of the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1478 |
PEP module last year.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1479 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1480 |
320
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1481 |
00:15:36,485 --> 00:15:40,280
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1482 |
And you might remember BF
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1483 |
language, we had to look at.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1484 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1485 |
321
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1486 |
00:15:40,280 --> 00:15:43,670
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1487 |
This BF language contains
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1488 |
the kind of memory and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1489 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1490 |
322
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1491 |
00:15:43,670 --> 00:15:45,680
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1492 |
the memory pointer which can
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1493 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1494 |
323
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1495 |
00:15:45,680 --> 00:15:48,140
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1496 |
be moved to the left
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1497 |
or to the right,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1498 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1499 |
324
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1500 |
00:15:48,140 --> 00:15:50,270
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1501 |
where an integer in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1502 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1503 |
325
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1504 |
00:15:50,270 --> 00:15:52,925
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1505 |
the memory can be either
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1506 |
increased or decreased.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1507 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1508 |
326
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1509 |
00:15:52,925 --> 00:15:55,730
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1510 |
We can print
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1511 |
out the content of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1512 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1513 |
327
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1514 |
00:15:55,730 --> 00:15:59,645
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1515 |
the current cell or input
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1516 |
something into a cell.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1517 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1518 |
328
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1519 |
00:15:59,645 --> 00:16:01,850
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1520 |
And we have loops, and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1521 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1522 |
329
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1523 |
00:16:01,850 --> 00:16:04,220
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1524 |
everything else is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1525 |
considered a comment.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1526 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1527 |
330
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1528 |
00:16:04,220 --> 00:16:06,290
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1529 |
What's good about
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1530 |
this BF language is that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1531 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1532 |
331
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1533 |
00:16:06,290 --> 00:16:08,180
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1534 |
we don't even need a front end.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1535 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1536 |
332
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1537 |
00:16:08,180 --> 00:16:09,920
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1538 |
We can immediately start writing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1539 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1540 |
333
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1541 |
00:16:09,920 --> 00:16:13,529
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1542 |
an interpreter or a compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1543 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1544 |
334
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1545 |
00:16:15,850 --> 00:16:18,155
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1546 |
Okay, I have here
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1547 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1548 |
335
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1549 |
00:16:18,155 --> 00:16:20,600
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1550 |
a very straightforward
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1551 |
interpreter for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1552 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1553 |
336
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1554 |
00:16:20,600 --> 00:16:22,865
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1555 |
the BF language. You
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1556 |
might recognize it.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1557 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1558 |
337
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1559 |
00:16:22,865 --> 00:16:27,120
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1560 |
And I run it with a
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1561 |
benchmark program, which
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1562 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1563 |
338
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1564 |
00:16:27,760 --> 00:16:30,960
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1565 |
might also recognize.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1566 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1567 |
339
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1568 |
00:16:31,560 --> 00:16:36,835
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1569 |
And this will now take
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1570 |
approximately ten minutes.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1571 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1572 |
340
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1573 |
00:16:36,835 --> 00:16:39,920
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1574 |
So see you in a bit.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1575 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1576 |
341
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1577 |
00:16:40,710 --> 00:16:43,660
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1578 |
Okay, this has finished now.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1579 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1580 |
342
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1581 |
00:16:43,660 --> 00:16:45,925
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1582 |
Almost took 11 minutes.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1583 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1584 |
343
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1585 |
00:16:45,925 --> 00:16:47,410
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1586 |
The question now is,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1587 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1588 |
344
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1589 |
00:16:47,410 --> 00:16:51,820
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1590 |
can we to better?
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1591 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1592 |
345
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1593 |
00:16:51,820 --> 00:16:53,260
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1594 |
Actually, it is not difficult
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1595 |
to do better
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1596 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1597 |
346
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1598 |
00:16:53,260 --> 00:16:54,970
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1599 |
than this simple-minded
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1600 |
interpreter.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1601 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1602 |
347
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1603 |
00:16:54,970 --> 00:16:58,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1604 |
It is relatively
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1605 |
straightforward to take
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1606 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1607 |
348
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1608 |
00:16:58,690 --> 00:17:03,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1609 |
a BF program and generate equivalent C code.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1610 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1611 |
349
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1612 |
00:17:03,520 --> 00:17:06,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1613 |
This can be easily
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1614 |
done by somehow
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1615 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1616 |
350
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1617 |
00:17:06,520 --> 00:17:09,490
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1618 |
representing the BF memory in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1619 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1620 |
351
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1621 |
00:17:09,490 --> 00:17:12,310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1622 |
C. We can do this
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1623 |
by just an array of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1624 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1625 |
352
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1626 |
00:17:12,310 --> 00:17:15,380
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1627 |
characters and a memory pointer,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1628 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1629 |
353
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1630 |
00:17:15,380 --> 00:17:19,265
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1631 |
which points, in this case
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1632 |
in the middle of this array.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1633 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1634 |
354
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1635 |
00:17:19,265 --> 00:17:21,800
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1636 |
Then it's very easy to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1637 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1638 |
355
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1639 |
00:17:21,800 --> 00:17:24,275
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1640 |
translate the movement
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1641 |
of the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1642 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1643 |
356
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1644 |
00:17:24,275 --> 00:17:28,610
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1645 |
BF memory pointer into increments
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1646 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1647 |
357
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1648 |
00:17:28,610 --> 00:17:31,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1649 |
and decrements of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1650 |
the C pointer.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1651 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1652 |
358
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1653 |
00:17:31,520 --> 00:17:33,050
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1654 |
Similarly, if you want to increment or
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1655 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1656 |
359
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1657 |
00:17:33,050 --> 00:17:35,915
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1658 |
decrement an element
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1659 |
in this array,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1660 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1661 |
360
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1662 |
00:17:35,915 --> 00:17:38,975
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1663 |
you just have to look up what
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1664 |
the pointer is and increment
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1665 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1666 |
361
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1667 |
00:17:38,975 --> 00:17:42,140
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1668 |
and decrement what's
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1669 |
under the pointer. Similarly
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1670 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1671 |
362
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1672 |
00:17:42,140 --> 00:17:43,790
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1673 |
we can print out something from
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1674 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1675 |
363
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1676 |
00:17:43,790 --> 00:17:47,450
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1677 |
this array and we can put
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1678 |
something into this array.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1679 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1680 |
364
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1681 |
00:17:47,450 --> 00:17:49,610
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1682 |
What is great is that the loops
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1683 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1684 |
365
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1685 |
00:17:49,610 --> 00:17:51,530
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1686 |
from the BF language directly
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1687 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1688 |
366
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1689 |
00:17:51,530 --> 00:17:55,580
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1690 |
translate into while
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1691 |
loops of the C language.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1692 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1693 |
367
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1694 |
00:17:55,580 --> 00:17:58,100
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1695 |
We essentially have to check is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1696 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1697 |
368
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1698 |
00:17:58,100 --> 00:18:02,450
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1699 |
the memory pointer pointing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1700 |
to a field that is 0.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1701 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1702 |
369
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1703 |
00:18:02,450 --> 00:18:03,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1704 |
Then we exit the loop,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1705 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1706 |
370
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1707 |
00:18:03,950 --> 00:18:05,719
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1708 |
and otherwise we continue.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1709 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1710 |
371
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1711 |
00:18:05,719 --> 00:18:09,575
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1712 |
And that can be done
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1713 |
nicely in C, like so.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1714 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1715 |
372
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1716 |
00:18:09,575 --> 00:18:12,995
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1717 |
And everything else is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1718 |
again, just a comment.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1719 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1720 |
373
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1721 |
00:18:12,995 --> 00:18:16,445
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1722 |
So I have implemented
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1723 |
this translation for you.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1724 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1725 |
374
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1726 |
00:18:16,445 --> 00:18:19,700
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1727 |
Remember this was the BF
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1728 |
program for the Mandelbrot Set.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1729 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1730 |
375
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1731 |
00:18:19,700 --> 00:18:23,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1732 |
The equivalent C code
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1733 |
would look like this.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1734 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1735 |
376
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1736 |
00:18:23,690 --> 00:18:27,110
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1737 |
So you can see at the beginning
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1738 |
is this generation of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1739 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1740 |
377
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1741 |
00:18:27,110 --> 00:18:30,140
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1742 |
the BF memory represented
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1743 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1744 |
378
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1745 |
00:18:30,140 --> 00:18:32,345
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1746 |
as an array and the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1747 |
memory pointer.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1748 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1749 |
379
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1750 |
00:18:32,345 --> 00:18:34,550
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1751 |
And then inside there are lots
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1752 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1753 |
380
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1754 |
00:18:34,550 --> 00:18:36,770
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1755 |
of increments and decrements
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1756 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1757 |
381
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1758 |
00:18:36,770 --> 00:18:41,915
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1759 |
of pointers and also
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1760 |
contents of this array.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1761 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1762 |
382
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1763 |
00:18:41,915 --> 00:18:45,199
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1764 |
Now fingers crossed that this
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1765 |
is the correct translation.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1766 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1767 |
383
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1768 |
00:18:45,199 --> 00:18:48,125
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1769 |
And I can also run this
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1770 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1771 |
384
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1772 |
00:18:48,125 --> 00:18:52,805
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1773 |
and you should see that it runs
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1774 |
substantially faster.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1775 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1776 |
385
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1777 |
00:18:52,805 --> 00:18:55,880
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1778 |
I'm using now my GCC on
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1779 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1780 |
386
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1781 |
00:18:55,880 --> 00:19:01,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1782 |
my computer to generate an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1783 |
executable for the C program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1784 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1785 |
387
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1786 |
00:19:01,040 --> 00:19:04,295
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1787 |
And it should run for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1788 |
approximately 20 seconds.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1789 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1790 |
388
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1791 |
00:19:04,295 --> 00:19:07,620
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1792 |
So let's just wait for that.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1793 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1794 |
389
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1795 |
00:19:11,430 --> 00:19:14,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1796 |
Okay. What is important to note
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1797 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1798 |
390
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1799 |
00:19:14,950 --> 00:19:19,885
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1800 |
here is that I'm running GCC,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1801 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1802 |
391
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1803 |
00:19:19,885 --> 00:19:22,450
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1804 |
this the option -O0.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1805 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1806 |
392
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1807 |
00:19:22,450 --> 00:19:25,600
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1808 |
That means I tell GCC to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1809 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1810 |
393
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1811 |
00:19:25,600 --> 00:19:28,840
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1812 |
generate a binary which I
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1813 |
can run as you can see.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1814 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1815 |
394
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1816 |
00:19:28,840 --> 00:19:31,810
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1817 |
But don't apply any optimization.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1818 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1819 |
395
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1820 |
00:19:31,810 --> 00:19:38,395
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1821 |
Keep this in mind.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1822 |
As a second try,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1823 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1824 |
396
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1825 |
00:19:38,395 --> 00:19:42,595
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1826 |
of course, I can try to now
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1827 |
generate a better C program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1828 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1829 |
397
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1830 |
00:19:42,595 --> 00:19:46,060
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1831 |
And as you'll remember from
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1832 |
the PEP course, it can,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1833 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1834 |
398
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1835 |
00:19:46,060 --> 00:19:50,095
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1836 |
for example, combine
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1837 |
several steps
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1838 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1839 |
399
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1840 |
00:19:50,095 --> 00:19:51,670
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1841 |
going to the right of the memory
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1842 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1843 |
400
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1844 |
00:19:51,670 --> 00:19:53,310
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1845 |
pointer or to the left.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1846 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1847 |
401
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1848 |
00:19:53,310 --> 00:19:55,280
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1849 |
We can combine that into
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1850 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1851 |
402
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1852 |
00:19:55,280 --> 00:19:58,760
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1853 |
one single increment or
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1854 |
decrement of not just one,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1855 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1856 |
403
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1857 |
00:19:58,760 --> 00:20:00,050
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1858 |
but of like n,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1859 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1860 |
404
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1861 |
00:20:00,050 --> 00:20:02,570
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1862 |
where n is greater
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1863 |
than 1. Similarly,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1864 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1865 |
405
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1866 |
00:20:02,570 --> 00:20:06,980
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1867 |
if we increment or decrement
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1868 |
the content of this array,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1869 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1870 |
406
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1871 |
00:20:06,980 --> 00:20:09,740
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1872 |
we can do this in one
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1873 |
big step by incrementing
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1874 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1875 |
407
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1876 |
00:20:09,740 --> 00:20:12,710
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1877 |
that by not just one
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1878 |
and increment by one,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1879 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1880 |
408
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1881 |
00:20:12,710 --> 00:20:15,635
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1882 |
but increment and decrement
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1883 |
by bigger numbers.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1884 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1885 |
409
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1886 |
00:20:15,635 --> 00:20:18,870
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1887 |
Everything else stays the same.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1888 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1889 |
410
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1890 |
00:20:20,830 --> 00:20:23,270
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1891 |
Again, I have implemented that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1892 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1893 |
411
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1894 |
00:20:23,270 --> 00:20:24,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1895 |
for you and you can see now
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1896 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1897 |
412
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1898 |
00:20:24,950 --> 00:20:26,835
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1899 |
the C program moves
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1900 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1901 |
413
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1902 |
00:20:26,835 --> 00:20:30,455
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1903 |
the memory pointer and bigger
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1904 |
chunks and also increases,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1905 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1906 |
414
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1907 |
00:20:30,455 --> 00:20:32,810
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1908 |
for example, here, memory content
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1909 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1910 |
415
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1911 |
00:20:32,810 --> 00:20:35,555
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1912 |
by 15 than just by 1.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1913 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1914 |
416
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1915 |
00:20:35,555 --> 00:20:38,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1916 |
Now let's run this program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1917 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1918 |
417
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1919 |
00:20:38,530 --> 00:20:40,760
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1920 |
Again, I use GCC
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1921 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1922 |
418
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1923 |
00:20:40,760 --> 00:20:45,350
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1924 |
to compile the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1925 |
C program and run it.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1926 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1927 |
419
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1928 |
00:20:45,350 --> 00:20:49,025
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1929 |
And again, I made sure
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1930 |
that it only runs this with
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1931 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1932 |
420
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1933 |
00:20:49,025 --> 00:20:51,530
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1934 |
no optimizations switched on.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1935 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1936 |
421
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1937 |
00:20:51,530 --> 00:20:54,050
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1938 |
So there's minus O0.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1939 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1940 |
422
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1941 |
00:20:54,050 --> 00:20:56,090
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1942 |
And you can see
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1943 |
it's now down from
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1944 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1945 |
423
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1946 |
00:20:56,090 --> 00:20:59,990
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1947 |
20 seconds to just 6 seconds.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1948 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1949 |
424
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1950 |
00:20:59,990 --> 00:21:06,065
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1951 |
I show you, the GCC is
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1952 |
called with -O0.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1953 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1954 |
425
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1955 |
00:21:06,065 --> 00:21:08,990
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1956 |
So this reduction
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1957 |
in time is purely
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1958 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1959 |
426
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1960 |
00:21:08,990 --> 00:21:12,755
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1961 |
because I produced better C code,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1962 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1963 |
427
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1964 |
00:21:12,755 --> 00:21:17,220
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1965 |
which the compiler then just
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1966 |
transformed into a binary.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1967 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1968 |
428
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1969 |
00:21:18,910 --> 00:21:22,055
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1970 |
So far there's
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1971 |
nothing interesting.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1972 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1973 |
429
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1974 |
00:21:22,055 --> 00:21:25,385
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1975 |
We used in the first instance
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1976 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1977 |
430
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1978 |
00:21:25,385 --> 00:21:29,240
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1979 |
single increments and use GCC with
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1980 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1981 |
431
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1982 |
00:21:29,240 --> 00:21:31,700
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1983 |
O0 to not introduce
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1984 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1985 |
432
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1986 |
00:21:31,700 --> 00:21:35,255
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1987 |
any optimizations and run
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1988 |
essentially 20 seconds.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1989 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1990 |
433
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1991 |
00:21:35,255 --> 00:21:37,880
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1992 |
If we then increment
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1993 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1994 |
434
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1995 |
00:21:37,880 --> 00:21:40,895
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1996 |
in bigger chunks or
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1997 |
decrement in bigger chunks,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1998 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
1999 |
435
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2000 |
00:21:40,895 --> 00:21:45,380
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2001 |
use again GCC with -O0,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2002 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2003 |
436
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2004 |
00:21:45,380 --> 00:21:50,030
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2005 |
then it runs in approximately
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2006 |
five to six seconds.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2007 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2008 |
437
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2009 |
00:21:50,030 --> 00:21:51,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2010 |
Now let me do the following:
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2011 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2012 |
438
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2013 |
00:21:51,950 --> 00:21:55,430
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2014 |
I take the first program which
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2015 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2016 |
439
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2017 |
00:21:55,430 --> 00:21:58,070
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2018 |
increments everything
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2019 |
in a single steps
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2020 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2021 |
440
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2022 |
00:21:58,070 --> 00:22:00,185
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2023 |
or decremented in single steps.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2024 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2025 |
441
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2026 |
00:22:00,185 --> 00:22:04,835
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2027 |
But now I use the full
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2028 |
capacity of the GCC compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2029 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2030 |
442
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2031 |
00:22:04,835 --> 00:22:06,560
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2032 |
and I tell it,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2033 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2034 |
443
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2035 |
00:22:06,560 --> 00:22:11,370
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2036 |
please do introduce some
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2037 |
optimizations as you want.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2038 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2039 |
444
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2040 |
00:22:11,590 --> 00:22:15,799
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2041 |
And I'm now running
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2042 |
exactly the same program...
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2043 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2044 |
445
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2045 |
00:22:15,799 --> 00:22:17,870
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2046 |
just the GCC compiler will
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2047 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2048 |
446
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2049 |
00:22:17,870 --> 00:22:22,325
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2050 |
now have the optimizations
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2051 |
switched on.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2052 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2053 |
447
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2054 |
00:22:22,325 --> 00:22:24,380
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2055 |
Let's see what happens.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2056 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2057 |
448
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2058 |
00:22:24,380 --> 00:22:27,320
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2059 |
One first needs to compile it.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2060 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2061 |
449
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2062 |
00:22:27,320 --> 00:22:29,795
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2063 |
And that takes a little while.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2064 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2065 |
450
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2066 |
00:22:29,795 --> 00:22:32,000
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2067 |
Okay, this has now
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2068 |
finished and also
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2069 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2070 |
451
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2071 |
00:22:32,000 --> 00:22:34,115
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2072 |
the calculation of the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2073 |
picture has finished.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2074 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2075 |
452
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2076 |
00:22:34,115 --> 00:22:35,960
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2077 |
And as you can see, it took
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2078 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2079 |
453
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2080 |
00:22:35,960 --> 00:22:38,510
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2081 |
approximately eight
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2082 |
seconds to calculate.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2083 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2084 |
454
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2085 |
00:22:38,510 --> 00:22:41,645
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2086 |
That is down from
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2087 |
approximately 20 seconds.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2088 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2089 |
455
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2090 |
00:22:41,645 --> 00:22:46,040
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2091 |
So the difference from
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2092 |
switching from -O0 to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2093 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2094 |
456
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2095 |
00:22:46,040 --> 00:22:51,935
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2096 |
-O3 meant that now
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2097 |
the program runs almost as
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2098 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2099 |
457
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2100 |
00:22:51,935 --> 00:22:54,800
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2101 |
fast as where I by hand
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2102 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2103 |
458
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2104 |
00:22:54,800 --> 00:22:58,610
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2105 |
combined several steps
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2106 |
into a big chunk.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2107 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2108 |
459
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2109 |
00:22:58,610 --> 00:23:00,170
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2110 |
That is essentially what
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2111 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2112 |
460
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2113 |
00:23:00,170 --> 00:23:03,485
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2114 |
the GCC compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2115 |
found out on its own.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2116 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2117 |
461
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2118 |
00:23:03,485 --> 00:23:05,840
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2119 |
That rather than jumping
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2120 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2121 |
462
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2122 |
00:23:05,840 --> 00:23:08,465
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2123 |
in just single increments by one,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2124 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2125 |
463
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2126 |
00:23:08,465 --> 00:23:11,510
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2127 |
they can be all combined
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2128 |
into bigger chunks.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2129 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2130 |
464
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2131 |
00:23:11,510 --> 00:23:16,595
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2132 |
It hasn't been as successful
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2133 |
as if I do this explicitly.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2134 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2135 |
465
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2136 |
00:23:16,595 --> 00:23:18,620
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2137 |
But that is the magic that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2138 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2139 |
466
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2140 |
00:23:18,620 --> 00:23:22,560
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2141 |
the compiler essentially found
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2142 |
out, that this can be done.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2143 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2144 |
467
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2145 |
00:23:22,960 --> 00:23:25,700
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2146 |
Just a quick recap of what I did.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2147 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2148 |
468
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2149 |
00:23:25,700 --> 00:23:28,160
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2150 |
I first run the program with
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2151 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2152 |
469
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2153 |
00:23:28,160 --> 00:23:31,730
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2154 |
an interpreter and it took
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2155 |
approximately 11 minutes.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2156 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2157 |
470
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2158 |
00:23:31,730 --> 00:23:36,559
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2159 |
Then I had a simple compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2160 |
generating a C program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2161 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2162 |
471
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2163 |
00:23:36,559 --> 00:23:40,880
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2164 |
And the C compiler then had
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2165 |
no optimization switched on.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2166 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2167 |
472
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2168 |
00:23:40,880 --> 00:23:44,645
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2169 |
In the C program had only
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2170 |
small single increments and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2171 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2172 |
473
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2173 |
00:23:44,645 --> 00:23:46,820
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2174 |
small jumps. Then it took
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2175 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2176 |
474
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2177 |
00:23:46,820 --> 00:23:49,775
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2178 |
approximately 20 seconds for
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2179 |
to same program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2180 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2181 |
475
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2182 |
00:23:49,775 --> 00:23:52,460
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2183 |
Then I had a more advanced
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2184 |
compiler which does
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2185 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2186 |
476
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2187 |
00:23:52,460 --> 00:23:55,730
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2188 |
big increments and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2189 |
also big jumps.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2190 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2191 |
477
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2192 |
00:23:55,730 --> 00:23:57,470
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2193 |
But again, the compiler didn't
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2194 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2195 |
478
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2196 |
00:23:57,470 --> 00:23:59,210
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2197 |
introduce any optimization on its
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2198 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2199 |
479
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2200 |
00:23:59,210 --> 00:24:02,915
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2201 |
own. Then it took
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2202 |
approximately five seconds.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2203 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2204 |
480
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2205 |
00:24:02,915 --> 00:24:05,210
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2206 |
Then I went back to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2207 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2208 |
481
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2209 |
00:24:05,210 --> 00:24:08,465
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2210 |
the simple compiler with
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2211 |
only small steps.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2212 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2213 |
482
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2214 |
00:24:08,465 --> 00:24:10,400
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2215 |
But then told the C compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2216 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2217 |
483
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2218 |
00:24:10,400 --> 00:24:12,950
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2219 |
to fully optimize this program.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2220 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2221 |
484
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2222 |
00:24:12,950 --> 00:24:14,690
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2223 |
And then it took more
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2224 |
or less the same
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2225 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2226 |
485
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2227 |
00:24:14,690 --> 00:24:17,465
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2228 |
time as the more advanced compiler.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2229 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2230 |
486
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2231 |
00:24:17,465 --> 00:24:20,465
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2232 |
I encourage you to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2233 |
look at this yourself.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2234 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2235 |
487
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2236 |
00:24:20,465 --> 00:24:24,240
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2237 |
As usual, all the programs
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2238 |
are uploaded on KEATS.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2239 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2240 |
488
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2241 |
00:24:25,090 --> 00:24:27,590
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2242 |
To finish this
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2243 |
introduction video,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2244 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2245 |
489
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2246 |
00:24:27,590 --> 00:24:30,170
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2247 |
let me give you an
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2248 |
extremely brief overview
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2249 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2250 |
490
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2251 |
00:24:30,170 --> 00:24:32,855
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2252 |
over the history of compilers.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2253 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2254 |
491
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2255 |
00:24:32,855 --> 00:24:35,450
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2256 |
While I argued at the beginning
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2257 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2258 |
492
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2259 |
00:24:35,450 --> 00:24:38,915
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2260 |
that it's interesting to
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2261 |
study compilers nowadays,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2262 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2263 |
493
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2264 |
00:24:38,915 --> 00:24:40,400
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2265 |
obviously in this field,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2266 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2267 |
494
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2268 |
00:24:40,400 --> 00:24:43,295
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2269 |
we are standing on the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2270 |
shoulders of giants.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2271 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2272 |
495
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2273 |
00:24:43,295 --> 00:24:46,520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2274 |
The field started with Turing and
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2275 |
Turing machines,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2276 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2277 |
496
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2278 |
00:24:46,520 --> 00:24:49,130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2279 |
which were introduced in 1936.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2280 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2281 |
497
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2282 |
00:24:49,130 --> 00:24:52,175
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2283 |
Turing machines already had
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2284 |
this concept of memory
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2285 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2286 |
498
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2287 |
00:24:52,175 --> 00:24:55,190
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2288 |
and also programs
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2289 |
of Turing machines
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2290 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2291 |
499
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2292 |
00:24:55,190 --> 00:24:58,775
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2293 |
needed to be translated
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2294 |
between different formalisms.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2295 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2296 |
500
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2297 |
00:24:58,775 --> 00:25:01,100
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2298 |
Regular expressions,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2299 |
which will play
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2300 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2301 |
501
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2302 |
00:25:01,100 --> 00:25:03,905
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2303 |
an important role in our
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2304 |
lexer of our compiler,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2305 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2306 |
502
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2307 |
00:25:03,905 --> 00:25:06,800
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2308 |
were introduced in 1956.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2309 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2310 |
503
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2311 |
00:25:06,800 --> 00:25:10,370
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2312 |
Arguably the first compiler
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2313 |
was introduced in
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2314 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2315 |
504
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2316 |
00:25:10,370 --> 00:25:13,850
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2317 |
1957 for a language called COBOL.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2318 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2319 |
505
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2320 |
00:25:13,850 --> 00:25:16,550
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2321 |
This was done by Grace Hopper.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2322 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2323 |
506
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2324 |
00:25:16,550 --> 00:25:18,770
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2325 |
And I recommend that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2326 |
you have and look
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2327 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2328 |
507
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2329 |
00:25:18,770 --> 00:25:20,900
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2330 |
at this interview
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2331 |
of Grace Hopper,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2332 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2333 |
508
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2334 |
00:25:20,900 --> 00:25:22,130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2335 |
which shows she must have been
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2336 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2337 |
509
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2338 |
00:25:22,130 --> 00:25:24,424
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2339 |
a very interesting personality.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2340 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2341 |
510
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2342 |
00:25:24,424 --> 00:25:27,770
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2343 |
But despite the
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2344 |
maturity of this field,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2345 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2346 |
511
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2347 |
00:25:27,770 --> 00:25:29,465
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2348 |
it might be surprising that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2349 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2350 |
512
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2351 |
00:25:29,465 --> 00:25:31,505
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2352 |
research papers are
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2353 |
still published.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2354 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2355 |
513
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2356 |
00:25:31,505 --> 00:25:34,835
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2357 |
And we will find that
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2358 |
out in the module.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2359 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2360 |
514
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2361 |
00:25:34,835 --> 00:25:37,760
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2362 |
And a number of
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2363 |
problems which we would
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2364 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2365 |
515
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2366 |
00:25:37,760 --> 00:25:41,270
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2367 |
assume are already solved by now,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2368 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2369 |
516
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2370 |
00:25:41,270 --> 00:25:43,730
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2371 |
actually turning out
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2372 |
that they are not solved.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2373 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2374 |
517
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2375 |
00:25:43,730 --> 00:25:45,620
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2376 |
Here in this blog post,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2377 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2378 |
518
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2379 |
00:25:45,620 --> 00:25:47,825
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2380 |
for example, Laurie Tratt
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2381 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2382 |
519
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2383 |
00:25:47,825 --> 00:25:49,550
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2384 |
who is also from this department,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2385 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2386 |
520
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2387 |
00:25:49,550 --> 00:25:51,740
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2388 |
argued that parsing, for example,
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2389 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2390 |
521
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2391 |
00:25:51,740 --> 00:25:54,035
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2392 |
isn't a solved problem yet.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2393 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2394 |
522
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2395 |
00:25:54,035 --> 00:25:56,300
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2396 |
I hope you will have as much fun
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2397 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2398 |
523
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2399 |
00:25:56,300 --> 00:25:58,130
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2400 |
with this module as I have.
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2401 |
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2402 |
524
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2403 |
00:25:58,130 --> 00:26:00,750
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2404 |
Thank you very much
|
Christian Urban <christian.urban@kcl.ac.uk>
parents:
diff
changeset
|
2405 |
for listening.
|