How does a compiler work?

preview_player
Показать описание
In this video we'll take a look at how compilers work and the process they take to turn code into something a computer can execute

0:00 Intro
1:04 Stage 1
1:42 Stage 2
2:22 Stage 3
2:40 Stage 4

Links
========================================================
Lexer output:

Parser output:

Code gen output:

💭 All views are my own 💭

Kit
========================================================

Books
========================================================

Music
========================================================

License ID: ab7ZXzLZ4lX
Рекомендации по теме
Комментарии
Автор

Your production and editing is getting better! Honestly your videos deserve a lot more views. Thanks a lot for teaching us how a compiler works!

carecoable
Автор

Dude, I am so happy I came across your channel. I am equally impressed between your depth of knowledge, presentation and pedagogy. Subbed & liked!

JakeJJKs
Автор

I love the production value!!! The sound effects and random bits and bobs flying around are meme-worthy.

AntonDelgadoACA
Автор

You hand movements are very distracting. But I learn a lot from your videos. Thanks for the videos!

mlindroth
Автор

Hilarious Anamorphs thumbnail! 10/10 made me lol

lelsewherelelsewhere
Автор

Well, I fiddled around with TCC, modifying it, and that helps you understand how it works(tokens, optimization and assembly)

georgecop
Автор

Love your presentation. Can you make a video on full bootstrapping too? The first time I have heard about the trusting trust issue it blew my mind. Its the elephant in the room that nobody ever talks about. I think everyone should at least know about it.

edwin
Автор

A visualisation of the AST would be nice (not used by clang but ANTLR has nice tools for this) as would you moving your arms slightly less - it's a little distracting.

Overall another great video.

TeslaPixel
Автор

Hello, i have a question i know how computer add and substract by binary but i don't know how it convert the results to things that i can read and understand for an example comuter added 2 and 5 the result is 7 how computer shows me specific pixels on 7 shape which i can read ?

مجهولالهوية-يون
Автор

What you're saying is valuable. With that said, invest in a microphone that does a better job of picking up your voice! Was it just me or was the volume of Nathan's narration really low?

garyhartwelldinmore
Автор

Yeah that’s cool but the actual magic happens where the assembly turns into binary right? Where does this happen?

dehrk
Автор

For me the compiling process is:
Syntax scanning
Semantic analysis
Code optimization
Code generation
Is correct?

higiniofuentes
Автор

amazing well explain just subscribe, though i will recomend to increase the volume

menachemlevi
Автор

Please, can you tell me what is the stage4?

higiniofuentes
Автор

Geeky too lost in the trees to see the forest. As if an alien asked a human what "breakfast" was, and the human handed them a recipe for an omelet. What a person wants to know when asking what a compiler is, isn't how it does what it does, but why it does what it does. The first thing to explain would be that computer chips process linear streams of ones and zeros, what is called binary code.So, something must happen to the text written in a computer language to transform it into a binary sequence of ones and zeros. But it's more than that of course, as a computer chip can only handle binary sequences where the ones and the zeros are organized in one particular way. Computer chips are extremely even terminally intolerant of sequences nor ordered in particular patterns. A compiler is a translation layer that converts a program wittten as text in one particular programming language, into the exact binary sequence structure that a given processing chip can execute, can process, can transform into some desired output. Yes, this video explains how most current compilers go about doing that translation, but the really interesting part of all of this is that compilers have become sophisticated in ways that make them the essential core base component of the evolution of computers and computing. Compilers are written as manifestations of compiler theory, and this theory is general enough to drive the design of computer chips on one end, and programming languages on the other end. A compiler is something akin to theoretical physics, describing and formalizing the structure and behavior of computation itself. This should not be surprising, people who translate text from one language to another often understand language better than those who only speak one language. When Einstein eloquently related energy, time, mass, and velocity, he made us more able to understand any one of these factors better even when isolated. Interestingly, one can write faster compilers or one can write compilers that expose their own process for examination. You can't have booth. On another axis, you can write a more efficient compiler if it only translates from one programming language to one processing chip architecture. If you want a compiler to work between any programming language and any chip architecture, your compiler will be larger and slower. Or, you can make your chips simple, building them up as grids of a great many self same units, and you can create compilers that convert any type of processing problem into units that can be processed on a grid of self same processing units, you can make the computational topology flat, and fast, by slowing down the translation process, the compiler, even though doing sow will result in longer binary compiled code, the chip may at times process the compiled code faster. There are chips that look ahead at the incoming stream of binary and reconfigure themselves optimally for that particular stream of compiled binary. There are language/compiler pairs written to particular types of problems, to math heavy problems, to text heavy problems, to spacial geometry problems, to machine language AI problems, to pattern recognition, to prediction problems, etc etc etc.

RandallLeeReetz
Автор

the hand gestures are way too fast and your avatar is in the middle of the screen which adds no value, please edit that out to make your video more effective.

RusticaBeachHouse-TortugaPrope
Автор

Your Bitcoin transfer has been processed successfully—congratulations!

William_v
Автор

You probably are British or my listening skills are so pity... (English is not my native)

mournful_m