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