Porting Compilers - Computerphile
Vložit
- čas přidán 9. 10. 2019
- Concluding his series on compilers and porting, Professor Brailsford takes the plunge and "T-Diagrams" his way over to a new machine.
Previous Video: • Improving Intermediate...
/ computerphile
/ computer_phile
This video was filmed and edited by Sean Riley.
Computer Science at the University of Nottingham: bit.ly/nottscomputer
Computerphile is a sister project to Brady Haran's Numberphile. More at www.bradyharan.com
I love Brailsford, he’s like the Attenborough of computers.
More! More! More Computerphile!
"The pope hasn't even written a compiler." -Terry A. Davis
Wiser words were never spoken. All praise God's chosen programmer!
St. IGNUcius has written a compiler.
Brailsford seriously need to record some audiobooks. C for dummies, or Harry Potter would be a start ♥️
definitely
Very different genres, but both could work very well. I'd like the Harry Potter one the most as I don't need the C one, plus I don't think technical books work so well in audio form compared to written
This guy would make it work. Trust
He should launch a tv show for kids teaching them computer science
I maintain several legacy applications that run on embedded 68k systems. The code is written in C and we use an antiquated (1994) compiler that runs on Solaris. I've built a gcc 68k cross-compiler on Linux with interesting results, but haven't convinced my boss to pursue it further.
The boxes in question have ADSP-2181s in them as well, programmed in assembler.
What is the field of these legacy applications?
Oh, wow. Old factory equipment perhaps?
Paging systems. Yes, they still exist. :-)
@@marsgal42 still much cheaper and more reliable for places like hospitals, from what I understand.
Our target market is first responders, including hospitals. A niche product in 2019, but a good niche product has always been a license to print money. :-)
This is a wonderful series!
It really takes me back to my compiler course, but in a good way.
Absolutely fascinating. Thank you very much.
The thing to remember is that the trick relies on the assumption that high level code designed for one machine can be directly compiled on another one. Generally it is not the case because of different incompatiable environments and hardware features available on different platforms. So in practice porting tends to get a bit more complex and messy than described here.
Every video I become more convinced that C has taken on the role of uncol or intermediary code.
Not quite. C is kind of like the standard language to create other languages and stuff. The real universal intermediate language is C's intermediary, LLVM.
@@allenjunge4127 LLVM is a compiler, it has an IR, as does gcc, and most other compilers. The IRs are not the same.
@@allenjunge4127 LLVM isn't the intermediate for every C compiler; the GNU Compiler Collection for example uses RTL
@@v4lgrind LLVM itself isn't a compiler, Clang is. LLVM is more so a framework for compilers.
It's not surprising given what C was intended for, and what it commonly gets used for.
C is the language of Unix, originally.
But you can see that the majority of operating systems (aside from those written wholly or partly in assembly for various reasons) were written in C (maybe C++)
Most of the Api's related to those operating systems were also written in C, and most high performance applications (again, aside from ones written in Assembly) tended to be written in C or C++ as well.
Linux, like most unix-likes is mostly built on C, and even has C-like shell scripting languages.
Windows has diversified over time due to Microsoft's .net system...
But you'll still find the standard Api's are written with the assumption that C/C++ is in use, and access to these api's through other methods typically results from a wrapper that was written in C/C++
The DDK (driver development kit) tends to discourage the use of C++, but it does mostly use C...
Whether this is due to something specific about the language (perhaps it's relatively low level, high performance features, that closely approximate assembly while being slightly easier to work with and vastly more portable), or just a quirk of history...
Who can say.
But yes, C is a pretty central language to many things, and quite a few other languages have been implemented in C, rely on C for supporting functionality, or similar.
(python is written in C/C++ and can interface with modules written in C. Java similarly largely depends on modules written in C/C++ for access to hardware features it doesn't natively support, such as advanced graphics handling...)
It'd be nice to have the previous video linked!
Done - and for good measure: czcams.com/video/TiJn9D6lZ-Y/video.html >Sean
Great Video
YAY! We finally did it!!
@MichaelKingsfordGray Ok, boomer
I would love if you guys could make a video on Hoares Triples!
If any viewer knows if they already have touched the topic, please let me know.
Agreed. The more formal the more better!
So we’re porting the assembler one step at a time right? Write the assembler for new computer as B’ outputting B’’ then feed it the assembler code, which gives us a B’’ which is then fed everything else?
Could you do a video on finding the Horadric Staff?
9:30 , Chillin in the corridor?
The Rubik's Cube in the background is finally solved - OCD-plagued can finally get some reilef. :)
...and here I was thinking all you needed was a new back end, I'll have to recall all of my ports now.
Compiling...
I tried writing a compiler. I regret it. I started over and made a simple desugarer to desugar to a known language so it can be compiled.
Teddy😺
do more videos about AI please!
More on compilers u mean?
Can we please get a comment from some of the old boys on what is going on with webassembly with system integration (WASI) and how it let us run any code on any machine. Like: what would technology like this have meant for their profissional life if this was available when they started programming.
Why? Webassembly tries to do exactly the same thing as Java, and they already mentioned Java and Java bytecode (as a type of intermediate code). Of course, WA has an advantage over Java in that unlike Java, there's not some big company trying to control how people use it and suing people that do things they don't like, which has limited Java's usefulness as a universal platform, but that's not a technical issue.
Brailsford looks older than before.
i think it is the lighting, in his other videos he was filme with the liight shining through the window behind
this tude has the same chair as me lloool :D
First Kappa
Second!
Pie!
First Delta
Couldn't the compiler be simpler if the editor checked and signed the code? If the editor is trustworthy, the compiler wouldn't need to check the syntax. The editor could even be much more restrictive than a standard compiler for this language. If the editor could do the type checking, it should do it.
Somethings only compile at run time though.
@@nosuchthing8 Every piece of code should be checked, and signed if it passes the test, and only signed pieces of code should be compiled. If the programm should read keyboard inputs, they should be checked before the program sees the correct inputs. Every input should be checked before the programm sees it and accepts the signed inputs.
@@Hofer2304 I admit to being a user of compilers. I don't know enough to comment on your proposal.
Prechecking would hardly help at all. Syntax or type checking isn't something a compiler does separately just to verify correctness. The compiler needs to make sense of the syntax and types in a program in order to create a correct program, it can't just choose not do it. Errors appear if the compiler can't make sense of it, thus, the error checking is pretty much free. Or at least the easiest part of it. Besides, such checks are done in the frontend (the H to I part), not in the backend part (the I to B part) this video focuses on. That's one of the advantages of the two-stage process he discussed: if don't need to rewrite the frontend, you don't need to reimplement the error checking.