How do computers read code?

2024 ж. 18 Мам.
3 070 793 Рет қаралды

When you first learned to write code, you probably realized that computers don't really have any common sense. You need to tell a computer exactly what you want. But do you know about all the work the computer does to understand what you mean?
0:00 Intro - Where You've Seen Compilers
1:25 Source Code vs. Machine Code
3:38 Translating Source Code to Machine Code
9:05 How Compilers Make Things Easier
10:39 Outro - The Story of Automation
Twitter: / frameofessence
Facebook: / frameofessence
KZhead: / frameofessence
Video links:
Crash Course Computer Science:
• Computer Science
Building the Bits and Qubits
• Building the Bits and ...
Tools used:
gdb
gcc
Monospaced font:
Menlo-Regular
Images and other visuals:
The IDE in the intro:
Eclipse
Python scripting:
IDLE
Source code distribution example:
Apache httpd on GitHub
Executable distribution examples:
Audacity
VLC media player
Blender
Punch cards:
en.wikipedia.org/wiki/File:Fo...
commons.wikimedia.org/wiki/Fi...
Early computers:
en.wikipedia.org/wiki/File:BR...
en.wikipedia.org/wiki/File:IB...
Complex history of computer languages:
en.wikipedia.org/wiki/Generat...
Montage:
Sublime Text
IntelliJ IDEA
www.haskell.org/
IntelliJ IDEA again...
Print "Hello, world!" command:
Python shell
Music:
KZhead audio library:
Sunflower
Incompetech:
Call to Adventure
If I Had a Chicken
Premium Beat:
Cutting Edge Technology
Second Time Around
Swoosh 1 sound effect came from here:
soundbible.com/682-Swoosh-1.html
...and is under this license:
creativecommons.org/licenses/...

Пікірлер
  • Whoever writes the compilers are absolute beasts

    @burntpotatoes999@burntpotatoes9996 жыл бұрын
    • nah compilers are simple

      @hausemester7386@hausemester73865 жыл бұрын
    • @@hausemester7386 Writing GCC, LLVM is indeed "rocket-science".

      @immadmir@immadmir5 жыл бұрын
    • simple? where is your complier?@@hausemester7386

      @MygenteTV@MygenteTV5 жыл бұрын
    • @ well if you really did that then you are a genius

      @MygenteTV@MygenteTV5 жыл бұрын
    • @@MygenteTV Nice logical fallacy.

      @Dennis19901@Dennis199015 жыл бұрын
  • Mad respect to all the engineers behind compilers.

    @Insignia_@Insignia_ Жыл бұрын
    • IT feels almost like something they would find inside of a crashed alien ship! xD

      @Maltebyte2@Maltebyte2 Жыл бұрын
    • its not that difficult really. once you build one, its really consistent. its a really fun project tbh. i built an interpter so. which is like a compiler with out the code gen.

      @theowillis6870@theowillis6870 Жыл бұрын
    • shout out to my boy terry, the mad fella actually made an entire os (temple OS) from scratch, running on its own language (Holy C)

      @stinkyyy2k@stinkyyy2k Жыл бұрын
    • @@stinkyyy2k yea terry was amazing RIP

      @salutboss3008@salutboss3008 Жыл бұрын
    • ​@@theowillis6870 that's not really the same as compiling. Also, while it's true that the basics of compiling is easy..... The sheer amount of optimising you have to do to make the compiler even remotely give a decently sized executable file is unreal That's why most people have their language compile into something like LLVM, for example

      @RenderingUser@RenderingUser Жыл бұрын
  • my man just quit after making the best video about compilers, what a legend

    @janek4024@janek4024 Жыл бұрын
    • I miss him.

      @oompalumpus699@oompalumpus699Ай бұрын
    • What happened to him?

      @lucasoliarovera9549@lucasoliarovera954923 күн бұрын
    • Giga chad move if he is alive. He prolly making agi. He so smart

      @amankishore3512@amankishore35125 күн бұрын
  • How tf did humans figure out how to do this lmao

    @IAmNumber4000@IAmNumber40002 жыл бұрын
    • 100 billion people * 40 years of thinking = quite a bit of progress 😅

      @TheInterestingInformer@TheInterestingInformerАй бұрын
    • My brain is getting roasted in a corner thinking the same....While I just completed watching this video.

      @tgsvampire@tgsvampireАй бұрын
    • ​@@TheInterestingInformerThat's not really just, quite a bit of progress TBH...💀

      @tgsvampire@tgsvampireАй бұрын
    • It took us approximately 300K years to figure this out(since homo sapiens spawned 😂)

      @user-mf8nn3tl5w@user-mf8nn3tl5w24 күн бұрын
    • Aliens 👽

      @johngeiger3770@johngeiger377017 күн бұрын
  • When I started to learn how to write code years ago I was told "the computer is one of the dumbest machines, it only follows orders even if they are wrong", it really helped me shape my mind to understand the logic of many programs

    @SergioEduP@SergioEduP4 жыл бұрын
    • Agreed

      @willd0g@willd0g4 жыл бұрын
    • Self aware AI will remember this

      @ybr8192@ybr81924 жыл бұрын
    • "it only follows orders even if they are wrong" humans don't?

      @onlyme0349@onlyme03494 жыл бұрын
    • M.L. and A.I. - Am I a joke to you 😂😂

      @DamnBoii123@DamnBoii1233 жыл бұрын
    • @Nebula no, Human only use them for tedious tasks lmao

      @theshermantanker7043@theshermantanker70433 жыл бұрын
  • When you know how computers work exactly, how the internet works and all that stuff, you get fascinated a lot.

    @Cyber_One@Cyber_One5 жыл бұрын
    • Opposite. Once you understand how it all works, it stops being "some magic".

      @NikkiCRMP@NikkiCRMP5 жыл бұрын
    • Nikki yes, I mean you get fascinated about how humans made this and you start appreciating technology

      @Cyber_One@Cyber_One5 жыл бұрын
    • @@Cyber_One Which is why i hate the technology these days, we went from changing humanity to wifi salt shakers.

      @randomthings5383@randomthings53834 жыл бұрын
    • @Vseslav Levchenko prove me wrong

      @randomthings5383@randomthings53834 жыл бұрын
    • @Yann cedric Totsingan im 22yo and studying CS lol your guess was off by a lot

      @randomthings5383@randomthings53834 жыл бұрын
  • I remember watching this video a few years back and fascinated. Now I'm more than capable of creating my own programming language.

    @dynpallomah5918@dynpallomah5918 Жыл бұрын
    • It's probably going to be exciting seeing the next generation jumping directly into Quantum Computing... I see a lot of confusion, flat lies and etc... but they will figure it out. what is possible, what is not and what is Politically Correct.

      @rgloria40@rgloria403 ай бұрын
  • I think my university did it pretty well, first semester you take a class called "Computer Systems, Architecture, Networking and Security", and in that class you work with manually compiling written code to objects and then linking them in assembly then you also covert them to binary aswell, you also cover logic gates and in it some optimization compilers do to your code. It cover os architecture and network protocols and cryptography but I think it's important to understand object linking and compiling otherwise you'll get very confused when you start trying to use cmake and get 20 linking errora haha.

    @jadedplover1851@jadedplover18512 жыл бұрын
    • Jesus you must have gotten extremely lucky to have a CS track that was that exhaustive and explanatory, even sounds like it was using linux from the start too. I've been to a few different university CS courses and they've all been nothing like that. Maybe it's a culture thing but I WISH I got that sort of introduction to programming.

      @robonator2945@robonator2945 Жыл бұрын
    • Where did you study?

      @kornelijussliubauskas8299@kornelijussliubauskas8299 Жыл бұрын
    • I’m also curious what uni you’re talking about as this sounds lovely for a 1st semester class

      @essayedgar@essayedgar Жыл бұрын
    • @@essayedgar Monash University in Melbourne, AUS. The unit itself isn't exhaustive in any of these topics by any means, however most of these topics are often fundamental to many career paths despite being overlooked in favour of more specialized practical work. But the relative broad coverage of many of these topics helps give a lot of context and elevates students' understanding of other units substantially. Often a lack of these fundamentals leads to elusive higher level problems the person is likely to struggle to identify and often results in trial and error learning of these concepts, or even worse where the student fails to learn these concepts completely which I see all too often result in zero-day security flaws in software they later release in their career.

      @jadedplover1851@jadedplover1851 Жыл бұрын
    • damn lucky you..I'm doing btech CSE and all I got in first year was a lot of chemistry, physics, civil engineering and whatnot..literally wasted a year imo

      @mridhulml3269@mridhulml3269 Жыл бұрын
  • "So our program is pretty boring right now, let's add a line to increment x by 1" Hold up dude, you can't go that fast to such levels of complexity

    @coffeedude@coffeedude5 жыл бұрын
    • hahaha holy shit im dyying

      @mexicanlucky@mexicanlucky4 жыл бұрын
    • not even X++;

      @yakinthebox@yakinthebox4 жыл бұрын
    • It was boring but now it is starting to get interesting baby.

      @Norogoth@Norogoth4 жыл бұрын
    • @@yakinthebox not even x = 4;

      @equenos@equenos4 жыл бұрын
    • @tutacat No

      @yakinthebox@yakinthebox4 жыл бұрын
  • I remember this quote from the programming classes I took while getting my EE degree. I don't remember who it was attributed to, but... "Computers always do what you tell them to do, and rarely what you want them to do."

    @theonionpirate1076@theonionpirate10764 жыл бұрын
    • Thanks for that amazing quote! Ill share the one I liked: There are 10 types of people in the world, The ones that understand binary and those who don't

      @MauritsWilke@MauritsWilke4 жыл бұрын
    • @@MauritsWilke you bitch

      @theguywhodoes6790@theguywhodoes67904 жыл бұрын
    • @@theguywhodoes6790?

      @pootzeketzi1233@pootzeketzi12334 жыл бұрын
    • @@pootzeketzi1233 he made a pun with binary

      @theguywhodoes6790@theguywhodoes67904 жыл бұрын
    • so true

      @isaaclaughton7591@isaaclaughton75914 жыл бұрын
  • the fact you explained it to us in such a detail just tells that you either had a very good experiecne with writing a compiler, or you had an experienced person check/write your text, or

    @vadiks20032@vadiks20032 Жыл бұрын
  • Thank you for putting EVERY tool and programming language you used in the Description!!! Sometimes I'm so confused on which programms were used in a video!

    @pptide@pptide3 жыл бұрын
  • In a push of a button... no.. nope.. wait..... -Programmer life story

    @momomi104@momomi1045 жыл бұрын
    • A push of a button. *Realizes he actually runs Python 3 instead of Python 2* There we go. A push of a button.

      @zucc4764@zucc47645 жыл бұрын
    • 50 errors laters, there are now 60 errors...

      @sublime_tv@sublime_tv4 жыл бұрын
    • @@sublime_tv SO TRUE

      @Hangyeol97@Hangyeol974 жыл бұрын
    • I genuinely laughed out loud at that part, and I'm dead inside.

      @manonthedollar@manonthedollar4 жыл бұрын
    • unexpected indent, syntax error, index out of range 😂

      @liamtaylor3576@liamtaylor35764 жыл бұрын
  • "Source code is made only to be understandable to humans" My brain cells: Ight imma head out

    @hamadmohammed7645@hamadmohammed76454 жыл бұрын
    • lol

      @ExtremusStupidus@ExtremusStupidus4 жыл бұрын
    • Source code is sometimes only readable by its creator. I know my code falls victim to this

      @half-qilin@half-qilin4 жыл бұрын
    • @@half-qilin exactly, reading people's code is a pain in a$$.

      @atastypineapple9296@atastypineapple92964 жыл бұрын
    • @@half-qilin well, on the bright side it could be more difficult for hackers.

      @KoolMonkE@KoolMonkE4 жыл бұрын
    • Fortran: Hold my code

      @ErrorNoInternet@ErrorNoInternet3 жыл бұрын
  • This cleared so many of my doubts and made me take up computer engineering more passionately , thanks for changing my life

    @choicefive9761@choicefive97612 жыл бұрын
  • Compilers aren't actually as complicated as people tend to think. They can be, and the industry grade ones like gcc really are, but the core idea is really simple. Most people who know programming can write one (not without extensive googling of course), no cs/math degree is required for that. I'm speaking from experience as I've written a few of these things myself back in high school. In fact, I believe that everyone who considers themself a programmer should write a compiler to properly understand how it actually works, as in, "I don't understand it if I can't do it myself".

    @ex-xg5hh@ex-xg5hh2 жыл бұрын
    • Yeah, like from what I heard almost half of gcc is just the optimization passes where they pull off some freaky shit. The actual translation and ast isn't that complicated.

      @usrnewxnew5227@usrnewxnew5227 Жыл бұрын
    • @@usrnewxnew5227one quarter is parsing cause c++ is a very hard language to parse, the next is then optimization… witchcraft

      @snesmocha@snesmocha9 ай бұрын
    • @ex-xg5hh hope you're still acrive... may i ask what did you write in assembly? what was the purpose of the code? was it like some simple thing or a complex code like rollercoaster tycoon type of stuff

      @gesoocreesto6374@gesoocreesto63749 ай бұрын
    • I remember writing a brainfuck compiler back when I was beginning C programming. It was fairly simple (brainfuck is literally designed to have a small compiler) but it helped me understand a bit about how compilers work.

      @mohammednajl5950@mohammednajl59508 ай бұрын
    • Interpreters are probably easier to write tho since you can just run the code in the language of the interpreter instead of generating machine code

      @pixelstriko1642@pixelstriko16427 ай бұрын
  • "How do computers read code?" _by running code_

    @OonHan@OonHan4 жыл бұрын
    • Yeah.. I was expecting him to talk about transistors and what actually makes up a cpu. That's what reads it. I had to design one from scratch in one of my electrical eng classes

      @arithedotanewb9126@arithedotanewb91264 жыл бұрын
    • Ever wondered how a computer compares to a human brain?

      @johneygd@johneygd4 жыл бұрын
    • ​@Chris Russell They aren't building simple circuits using Ohm's Law (not electricians), electrical engineers learn the why and how of circuits using fourier, vector, and complex analysis. They don't just learn circuitry either, the 'weed out' classes constitute three semesters of physics, and four of calculus (if you count differential equations), next comes electrodynamics, thermodynamics, quantum mechanics, classical electromagnetics, the whole nine yards and more. It is extremely over the top conceptual and recognized as one of the harder engineering courses. So ya it's not just some piece of paper that the "HR people" give credence to. Electrical engineer is a set of tools used in almost any industry that uses electricity.

      @GamerTheTurtle@GamerTheTurtle4 жыл бұрын
    • @Chris Russell I like how you so pompously tout your knowledge of elastance but brush off thermo. This comment is absolutely sceaming at me that you fancy yourself some tragic savant, doomed to mediocrity by the system that lets youngsters with a an embossed plaque to go on to bigger and better things. Save your schtick buddy, you just sound haughty and maybe a little jealous, else why are you even giving this spiel in the first place but to call yourself a gifted little star.

      @GamerTheTurtle@GamerTheTurtle4 жыл бұрын
    • Can I throw some Lua in here?

      @Luka-he5mr@Luka-he5mr4 жыл бұрын
  • "What you've only done python scripting!?" *started on C++ and moved to java* *sweating bullets from dodging a bullet*

    @quack3891@quack38914 жыл бұрын
    • you just dodged a bullet by jumping into a bigger and worse bullet

      @glzr_io@glzr_io4 жыл бұрын
    • i started on Java and am now learning C++ :D

      @rorymax@rorymax4 жыл бұрын
    • @@glzr_io python's syntax sucks and is slow

      @andrewdaniels5043@andrewdaniels50434 жыл бұрын
    • @@andrewdaniels5043 no

      @pepperoniboy57@pepperoniboy574 жыл бұрын
    • @@pepperoniboy57 yeah lol Java is better

      @andrewdaniels5043@andrewdaniels50434 жыл бұрын
  • This is an amazing video, you really have a gift for explaining complex matters in a clear way, shame this channel stopped uploading. Hope you are well!

    @Moe5Tavern@Moe5Tavern3 ай бұрын
  • This video perfectly answers all of the questions I had as a teenager twenty years ago. All the way up to "but how would the first compiler be written?" Thank you for introducing others to these questions. 😄

    @DaVince21@DaVince212 жыл бұрын
  • lol that python 2/3 joke at the end edit: didnt realize this is just released 18 minutes ago, nice

    @5up3rp3rs0n@5up3rp3rs0n6 жыл бұрын
    • Likewise the one at 1:08.

      @bit2shift@bit2shift6 жыл бұрын
    • Nice easter-egg

      @manuelisaiaspenapujols4451@manuelisaiaspenapujols44516 жыл бұрын
    • Yatta Sovr That really doesnt have anything to do with the joke though.

      @xetera@xetera6 жыл бұрын
    • HAHA! I was just going to comment the same thing! That is why I still program in python 2

      @KingJellyfishII@KingJellyfishII6 жыл бұрын
    • @@KingJellyfishII well you can convert python 3 to 2 and 2 to 3

      @alice_in_wonderland42@alice_in_wonderland425 жыл бұрын
  • This video managed to take a complex idea and compile it down in a form understandable to our human brains. Funny that :)

    @exquisite7416@exquisite74166 жыл бұрын
    • @Niepowtarzalny Użytkownik "decompilation" of how compilers work

      @skorpius2029@skorpius20295 жыл бұрын
    • Maybe .. but it also presented more unanswered questions :(

      @johnpro2847@johnpro28475 жыл бұрын
    • Me: "Computers work by doing magic." Frame of Essence: "Here's how they actually work." Me: "Computers work by doing 50x more magic than I thought they did."

      @SomeYouTubeTraveler@SomeYouTubeTraveler Жыл бұрын
    • Four years later this comment still deserves a like.

      @dianathomas2674@dianathomas2674 Жыл бұрын
  • Honestly, the most interesting part was your description of how machine codd works. From the machine code to the output felt always like magic to me, and this starts to give meaning to what is really happening

    @JonathanMandrake@JonathanMandrake2 жыл бұрын
  • I have been wondering about this for so long, not knowing was always a stone in my shoe, a disturbance in the force, it was. I knew the code had to be transferred into binary, but how? And, "Compiling the compiler with a previous version of itself", the sweetest poem I've heard in a long time. Thank you so much for this.

    @dianathomas2674@dianathomas2674 Жыл бұрын
  • Imagine doing all the holes for old computer programs and then you realize you forgot a semicolon....

    @tremon3688@tremon36884 жыл бұрын
    • you didn't need semicolons back then semicolons are just to allow the programmer to set the end of an instruction in a high level language rather than having the compiler rely on line breaks so you can break it up into multiple lines for binaries, semicolons leave basically nothing behind unless it's a lone semicolon, which compiles into a nop, which is the only exception

      @TorutheRedFox@TorutheRedFox3 жыл бұрын
    • @@TorutheRedFox it's a joke duh

      @gianmarcoproia5855@gianmarcoproia58553 жыл бұрын
    • @@gianmarcoproia5855 I know

      @TorutheRedFox@TorutheRedFox3 жыл бұрын
    • Everybody: wow you write code that’s really hard Me: you should see the people who write compilers

      @cosmic4297@cosmic42973 жыл бұрын
    • Everybody: What’s a compiler? Me: its a program that turns source code into machine code Everybody: whats source code and machine code?

      @Luka-he5mr@Luka-he5mr3 жыл бұрын
  • >Programming isn't so hard... *calls quit()*

    @MSDOS128@MSDOS1285 жыл бұрын
    • Python's is exit()... lol

      @maybelbdidit@maybelbdidit5 жыл бұрын
    • @@maybelbdidit In python you could use: exit() quit() or if you import sys sys.exit() All these work.

      @anteconfig5391@anteconfig53914 жыл бұрын
    • Lolz

      @Miko-hw1ft@Miko-hw1ft4 жыл бұрын
    • @@maybelbdidit Just try plugging out the power source. Works with every language.

      @abbyboing@abbyboing4 жыл бұрын
    • @Irritating Would have been funnier if there was a single frame with an error.

      @Sparkette@Sparkette4 жыл бұрын
  • When I read about compilers, it all start with lexical analysis, parsing, tokens, etc. But, you just built up an intuition. I got what you gave. Thanks!

    @rajesh_404@rajesh_404 Жыл бұрын
  • Faster info: Compiler takes what you write and turns it into optimised assembly code -> object code -> links the objects etc etc and spits out a machine code executable. Also, some languages like Python, Java are interpreted at execution time thus making them slower.

    @syntaxed2@syntaxed23 жыл бұрын
    • java is closer to being JITed than intepreted, same with C#

      @krejman@krejman3 жыл бұрын
    • Java source code is compiled to platform-agnostic bytecode, and then run in a virtual machine that will usually compile it to actual machine code on the fly nowadays, so dumping it alongside Python is just wrong. Python is a scripting language, while Java is not. It would be easier to compare Python to the likes of JavaScript and PHP since those are interpreted scripting languages too, although even those two languages have started to be used in tandem with Just-In-Time compilation in order to speed them up when needed.

      @TheDragShot@TheDragShot2 жыл бұрын
  • KZheadr: "you've only been using python!?" Me, who uses scratch: "uh, sure"

    @shybound7571@shybound75714 жыл бұрын
    • Rabot Carol

      @t07minas@t07minas4 жыл бұрын
    • Web languages gang here

      @PhoenixStudios147@PhoenixStudios1474 жыл бұрын
    • People less than 13 year old aren't allowed on KZhead

      @gamermapper@gamermapper4 жыл бұрын
    • @@gamermapper what

      @shwabbaa5728@shwabbaa57284 жыл бұрын
    • JS gang rise up

      @couldntsetpass2901@couldntsetpass29014 жыл бұрын
  • This is a damn near perfect video

    @swedneck@swedneck6 жыл бұрын
  • Bro just casually dropped a banger and randomly vanished from KZhead 😢

    @sritimanadak3937@sritimanadak3937Ай бұрын
  • This has to be the funniest and one of the most engaging explanations I have seen on KZhead😂😂

    @kanayocopy9876@kanayocopy98763 жыл бұрын
  • When I was teen (15 years ago), I was fascinated in programming. I remember spend a lot of hours on the computer trying to figure out how it works and why a code like "print("Hello world")" works in a machine level, but in that time internet didn't have this kind of videos (in fact, youtube was just beginning). Nowadays with this kind of videos it's really easy learning about everything and I am still fascinated with computer (but now approaching it from neuroscience) and your skills to transmit this information, however are awesome. Thanks a lot !

    @Neurofilia@Neurofilia3 жыл бұрын
    • @killmoo almost, I'm 29 😅

      @Neurofilia@Neurofilia3 жыл бұрын
    • ouuch that was hard understanding things like puts() in c because it use the system c lib (libc/glibc/musl on linux and msvcrt on windows

      @xephobia795@xephobia7953 жыл бұрын
    • it just show picture not found thingy

      @rithvikkona8922@rithvikkona89223 жыл бұрын
    • @@Neurofilia right now I am 15 and learning this programming stuff

      @thisisfaiaz@thisisfaiaz3 жыл бұрын
    • Even with rhe Internet it's still extrenely difficult to understand, if at all. Processors are insanely complicated nowadays including how they execute instructions

      @Dennis19901@Dennis19901 Жыл бұрын
  • This is so mindblowing how this swaps the values, I have never seen this before: x = x + y; y = x - y; x = x - y;

    @whythosenames@whythosenames4 жыл бұрын
    • So x and y are 0...?

      @thegreatzoom5073@thegreatzoom50733 жыл бұрын
    • The Great Zoom no = in programming means "assignment". You assign the value on the right to the variable on the left. Even equations like x = x + 1 are possible. This would not work in mathematics for example, there = is a "comparison". In most programming languages comparison is defined as "==" which is not the same as "="

      @whythosenames@whythosenames3 жыл бұрын
    • this would immediately cause a compile error because Y is undefined when you're initially assigning X using Y

      @TorutheRedFox@TorutheRedFox3 жыл бұрын
    • @@TorutheRedFox yeah you have to define them otherwise the swapping would not even make sense

      @whythosenames@whythosenames3 жыл бұрын
    • In Python, you could actually write it in one line as x, y = y, x which is a direct consequence of Python's unpacking. It is fundamentally different from the C-style approach though (as I understand it) because firstly, names in Python don't correspond directly to a location in memory and the y, x on the right is actually a tuple, more explicitly written as (y, x).

      @ninesquared81@ninesquared813 жыл бұрын
  • high quality content thats taken for granted

    @khalidsaad9452@khalidsaad9452 Жыл бұрын
  • I wish you will come back any time.. this videos are filled with lots of information and are quite funny so I wanted to watch the entire channel on one evening .. well.. it’s 12:30AM and I’m still watching 😅 Nice job!

    @christianriekert2908@christianriekert29082 жыл бұрын
  • Bootstrapping (pull yourself up by your bootstraps / an impossible action) is to compile a compiler from its own source. It's a chicken and egg situation. Which came first? The compiler? Or its self source? The compiler, born from another language. The first C++ compiler originated from C. (Bjarne used C to create a C with Classes preprocessor. He used his C with classes language extension to create Cfront. Cfront compiled his C++ language into C. And that's why C and C++ mix together.) The first C compiler originated from B. (B was first written for the PDP-7 minicomputer. (Programmed Data Processor) It evolved into NB (New B) to support the PDP-11. C was written in NB.) The first B compiler was written in TMG. (TransMoGrifier) The first TMG compiler was written in PDP-7 assembly language. Assembly is machine code made readable. (directly from the opcodes. (operation codes)) Before Assembly, people would've likely used some form of custom assembly code on paper to translate into machine code.

    @DlcEnergy@DlcEnergy5 жыл бұрын
    • Whoah, untold history, thanks now i can sleep in peace

      @zeozeto5457@zeozeto54574 жыл бұрын
    • It's not impossible though to write a compiler without using another high level language. Most early compilers and interpreters were written in assembly (for Fortran, Algol, Simula, Lisp, Basic, and so on). Some of them first wrote a simple compiler for a subset of the language in assembly and used it to compile a more advanced compiler (written in that subset, but implementing more of the language).

      @herrbonk3635@herrbonk36354 жыл бұрын
    • ​@@herrbonk3635 of course, but it wouldn't be worth it. the compiler will do the same exact translation you program it to do. the only difference would be how fast those compilers are at doing that. i think we'd take slightly slower compilations, for more well managed and developed compilers. that's the whole reason for higher level languages to begin with. to make development easier and more time efficient. hence why AAA games are written in C/C++, not assembly. we don't need the utmost potential possible out of most stuff. we'd rather have the darn thing finished already. and better compilers means better compiled code.

      @DlcEnergy@DlcEnergy4 жыл бұрын
    • @@DlcEnergy Hmm, I wasn't discussing efficiency here, but rather principles from an historical perspective. I was under the impression that you did too. However, you somehow seem to miss my point about that interesting middle way between assembly coded and self hosting compilers, using a subset of the HLL implemented. It has been used also for relatively "modern" (at least when you are 50+) languages like Pascal and Modula. I sure agree that compilation speed is much less important today, when everybody has "super computers" (in a very real mening, compared to the situation in the 1960s, or even the early 1990s). I personally love interpreted languages for their great flexiblity and security (checking array accesses, stack overflow, and so on). And my own design of a HLL language happens to be a pretty slow(!) compiler with some aspects of typical interpreters that I find useful. It produces quick and efficient code though. (All statements and their syntax are implemented as fully redefinable operator functions in this language, with pre-, post- or infix syntax, hence its relatively slow parsing speed.)

      @herrbonk3635@herrbonk36354 жыл бұрын
    • @@herrbonk3635 That's why i'm bringing efficiency up. Obviously a lower level language can achieve the same. But there's a reason for higher level languages.

      @DlcEnergy@DlcEnergy4 жыл бұрын
  • Instead of IDEs saying "EOS : End of expression expected at line : 40" They should just say "Add a semicolon at the end of line 40 ya dummy" Life would be easier this way.

    @viharcontractor1679@viharcontractor16796 жыл бұрын
    • Well, eventually your human brain will learn to compile that error message into an instruction to add a semicolon somewhere xD

      @son_guhun@son_guhun6 жыл бұрын
    • or just use a a decent modern IDE that will underscore that missing semi-colon. less wasted energy and time.

      @ArchHeretic1@ArchHeretic16 жыл бұрын
    • Nor saying: "Semicolon Warning: Please put semicolon at the end of the line 40", or just adding a semicolon when running or the IDE finds the error. Dumb IDE Developers... Oh wait, I'm a IDE Developer.

      @macstevins@macstevins6 жыл бұрын
    • And then python coders will be like, "what the f is the semicolon?"

      @dennielluissadian5026@dennielluissadian50265 жыл бұрын
    • @@spidercubed9718 notepad?! Pfft amateur. Real pros use punch cards

      @ArchHeretic1@ArchHeretic15 жыл бұрын
  • Just got past the intro and somehow I'm subscribed. Presentation so good it's an automatic yes

    @jiffylou98@jiffylou9810 ай бұрын
  • Thank you for such a creative and clear explanation of such tough things!

    @Estrav.Krastvich@Estrav.Krastvich2 жыл бұрын
  • I was kind of lucky with my instructor. He's an old veteran who goes on rants of his experiences with writing in c and dealing with UNIX mainframes and talks a lot about all this underlying stuff which makes programs work.

    @hikerwolfspaine8200@hikerwolfspaine82006 жыл бұрын
  • As a language geek and conlanger, I'm so glad that I now know how compilers work. It inspires me.

    @blerst7066@blerst70664 жыл бұрын
    • As an AI Language Model.....

      @gdtutorial@gdtutorial Жыл бұрын
  • this is now, by far my favorite CS channel, good stuff!

    @tylerornelas9552@tylerornelas95522 жыл бұрын
  • IDK how man, but this video suddenly popped on my face after may 2 years when I know a bit more about computers and programming and I am able to comprehend more of what is going in this video.... And I just realiesed, This man is creating some real value dude....🔥

    @tgsvampire@tgsvampireАй бұрын
  • That ending 😂 Pain of people who change from Py2 to py3

    @minibun04@minibun045 жыл бұрын
    • I try to avoid Python, it’s complicated to figure out after learning other languages. I prefer C over Python.

      @half-qilin@half-qilin4 жыл бұрын
    • @@half-qilin Python is very inefficient too, and is only a scripting language, plus it also requires the user to have all of the required libraries and the same major Python release installed, while a binary only requires the user to have the same OS, and potentially a few dynamic libraries, which in the case of Windows and Visual C++ (which also tends to apply to C if you use functions included in VCPP DLLs), the user very likely has them anyways, and with Linux and macOS it tends to be a little more complicated at times, but things generally are more backwards compatible than Python

      @TorutheRedFox@TorutheRedFox3 жыл бұрын
    • @@TorutheRedFox I develop for MacOS or game consoles like the 3DS (when I’m not using Unity). I might consider using Java at some point, but IDK on that one.

      @half-qilin@half-qilin3 жыл бұрын
    • ​@@half-qilin ​good job comparing a complied language to an interpreted language guys. it's not the case of different languages for different uses, it's definitely the case of one being better than the other. jeez better call all these research facilities and let them know they are using the wrong language.

      @RaLo4@RaLo43 жыл бұрын
  • This video should be the mandatory pre-requisite for any and every concept of computer Science henceforth :) Amazing , So Thankful for you

    @pooja05rejoice@pooja05rejoice5 жыл бұрын
    • @@ithaca2076 means worship on Hindi.

      @anuragmishra3227@anuragmishra32274 жыл бұрын
    • I absolutely agree! And to think it's only 12 minutes long!!! Why is this not shown to everyone who is learning to code?!

      @abcd123906@abcd1239064 жыл бұрын
    • @@abcd123906 This is on YT. So, they will co e to know that they can basically learn all sorts of things on internet. And? college gone broke.

      @supreetkumar7604@supreetkumar76044 жыл бұрын
  • This video is amazing! You explained everything in such an easy and fun way.

    @filipavieira8794@filipavieira87942 жыл бұрын
  • i found this video, and than i went to check out the cccs. a week later, i am here now again to say thank u - this video is a really good complementation to the cc. this is insane and mind blowing.

    @janek4024@janek4024 Жыл бұрын
  • I know you probably won't read this but still, I want to say this is my favourite computer science video on youtube. You explained things in such a clear manner and also not boring one bit. What's really special about your video is how you explain some of the concepts lecturers and others never teach. for eg the part where you talked about how compilers themselves are created. Thank You for the video

    @ranijoy7630@ranijoy76303 жыл бұрын
    • he hasn't posted anything for 4 fucking years, and your comment was like 1 year ago

      @kakyoindonut3213@kakyoindonut32132 жыл бұрын
    • @@kakyoindonut3213 yeah. these videos are amazing but the channel is dead innit?

      @imibuks-replit@imibuks-replit2 жыл бұрын
    • @@imibuks-replit maybe, 4 years is a really long time

      @kakyoindonut3213@kakyoindonut32132 жыл бұрын
    • @@kakyoindonut3213 yeah... for a few months yeah but almost half a decade....

      @imibuks-replit@imibuks-replit2 жыл бұрын
    • I feel the same and I hope he gets back to KZhead again!!

      @shivamxtras@shivamxtras Жыл бұрын
  • I wish I didn’t wait until I was 18 to learn programming. I could’ve learned this shit easily at the age of 10. I think most people could.

    @ultravidz@ultravidz6 жыл бұрын
    • AlphaOmega my thought exactly!

      @reyariass@reyariass6 жыл бұрын
    • Well I did try when I was 12 and I was able to write HTML and CSS with ease but VB and C I just could not grasp. I stopped trying to program and stuck with the hardware side as a net admin and then later tried to pick up programming again. It does seam WAYYYYY easier than it was 18 years ago.

      @MakinBacon0651@MakinBacon06516 жыл бұрын
    • I had a similar experience at 12, with html and css, mainly for building out my old myspace page. Regretfully I didn’t revisit the subject for years to come.

      @ultravidz@ultravidz6 жыл бұрын
    • Ya know, I am just a freshmen, and Java is quite nice to use. Not saying the same for JavaScript, but I am saying that about Java itself.

      @TheNathanDrawdy@TheNathanDrawdy6 жыл бұрын
    • I used to teach a programming class to 7-12 year olds. It's definitely a thing.

      @RandumStuffRandumnes@RandumStuffRandumnes6 жыл бұрын
  • I love this video, I never get bored watching it over and over

    @EngMoGo2010@EngMoGo20102 жыл бұрын
  • How to create your own compiler program: Tokenize code, parse tokens into words, apply syntax rules (errors) by creating tree blocks, apply semantic rules (warnings), match instruction to library (compile time exceptions), convert instruction to assembly then binary, run or interpret (runtime exceptions). First compiler written in binary as part of computer. Second was assembly can be portable to same processors. Third was high level can be used by different processors as long as computer has matching high to specific processor assembly compiler.

    @johnsindayen8684@johnsindayen868411 ай бұрын
  • I have always been fascinated with compilers and how they work ever since I started to teach myself to write code. I teach myself out of hobby and to use my brain since I'm a bit older. Awesome video.

    @nikm2089@nikm20893 жыл бұрын
  • Man please keep making videos. You are the only chanel that answered all my questions in such a clear way without being afraid to go into a bit of math. And your humor is awesome as well. You are literally the best computer science chanel I found, it would be a shame to stop making such awesome videos. Hope we hear from you soon.

    @panoskotoulas759@panoskotoulas7594 жыл бұрын
  • hats off to those who made compilers,struggeling behind the scene for making programming world so simple!

    @shehab976@shehab9763 жыл бұрын
  • This video is so creative and understandable the deep part of how the program works JUST MINDBLOWING

    @aatifakhan1653@aatifakhan16532 жыл бұрын
  • 10:40 I was so excited when I heard this. That's the exact question I've been wondering ever since I learned about compilers! Thanks for clearing it up, keep up the great work!

    @arcsexpedition2406@arcsexpedition24063 жыл бұрын
  • wow better than most classes I took in college hahaha

    @richarddoci@richarddoci5 жыл бұрын
    • The dead inside laugh "hahaha"

      @watchingpassive9485@watchingpassive94854 жыл бұрын
  • I loved this, this was so clarifying and it helped me out with to taking me through new programming skills. Thank u

    @BorisNVM@BorisNVM2 жыл бұрын
  • This was one of the very few times I learnt while having fun! Thanks for this amazing lesson

    @ammyvarela598@ammyvarela598 Жыл бұрын
  • the best video ever seen in my life about programming. you've done a wonderful job.

    @jeremyrodriguez9815@jeremyrodriguez98154 жыл бұрын
  • I first learned about all this 54 years ago. The knowledge served me well over the years.

    @OldDogNewTrick@OldDogNewTrick4 жыл бұрын
    • tf?

      @sujeewarathnaweera@sujeewarathnaweera2 жыл бұрын
  • Feel like the best video I’ve ever seen on KZhead, nd trust me ive seen many. He-like a brilliant teacher-addresses all queries after inducing them in the righteous way! And gives an absolute flawless understanding, giving the complete picture. Also this is a topic giving the complete picture, nd the video has done justice to it! This was so much of a mystery to me, for which I cudnt find the explanation/solution anywhere for soo long!!!! Thankyou so much 🙏🙏

    @lumbiniashutoshtambat5871@lumbiniashutoshtambat58719 ай бұрын
  • Excellent. The way you explain it is a gift you have. Thank you!

    @georgiosrigas8094@georgiosrigas80942 жыл бұрын
  • Psychologically, if students start learning assembly language first, then they're exposed to high level language, they would grasp the concepts like super quick.

    @binmosa@binmosa4 жыл бұрын
    • That’s not really true it’s easier to learn high level stuff first, and then to go under the hood

      @jaredvec5737@jaredvec57372 жыл бұрын
    • @@jaredvec5737 Yeah

      @ggsap@ggsap2 жыл бұрын
    • @@jaredvec5737 I think the best way to learn is to start low, but high enough, but not so high. That's why college usually starts with c/c++

      @Changecangs@Changecangs2 жыл бұрын
    • The thing about learning high level programming languages before lear ning things under the hood is that you dont understand why certain things dont make logical sense. For example why .1 +.2 is not equal to 3. This has nothing to do with the high level language itself but rather how math works with binary language.

      @mk17173n@mk17173n2 жыл бұрын
    • Attrition would be way to high. There’s simply too many hurdles to learn low level and less intuitive languages for a beginner. Psychologically, it’s better to be able to start practicing very soon, like with python, rather than have to learn a ton before starting. I agree that starting from the bottom gives a better understanding, but I think beginners need to be able to have an easy way in. If you learn assembly or whatever first that’s good, but I don’t think it should be universal.

      @calebgoodfellowcg@calebgoodfellowcg2 жыл бұрын
  • Oh god! The ending! I was eating goddammit! I nearly spat potato chips all over my keyboard!

    @MrRolnicek@MrRolnicek6 жыл бұрын
    • lololololol hope you learned your lesson! :)

      @neilbalch@neilbalch6 жыл бұрын
    • I didnt get it please explain

      @neeeeeck9005@neeeeeck90056 жыл бұрын
    • I mean ... I lived through this many times. The amazement at how simple Python is, just print "This" and it works! No wait, that's the old python, the new one needs brackets.

      @MrRolnicek@MrRolnicek6 жыл бұрын
    • You should eat more healthy

      @bithon5242@bithon52425 жыл бұрын
    • @@potato_x69 Let's call the whole thing off

      @marcfoster715@marcfoster7155 жыл бұрын
  • I do genuinely appreciate. Your video quality. It's awesome man, Keep it up.

    @kartikeymishra5398@kartikeymishra53982 жыл бұрын
  • My day is going much better now that I've seen this video and understand compilers better ;) .. thank you for making this!

    @brian_kirk@brian_kirk2 жыл бұрын
  • Beautiful video content and editing. Thank you for your efforts. ♥

    @NinaTheLudaca@NinaTheLudaca6 жыл бұрын
  • 11:33 programming in a nutshell

    @Nick-lx4fo@Nick-lx4fo4 жыл бұрын
    • When you accidentally mix up the programming languages (or versions in this case) (I once tried to print to Serial Out in Java. Didn't work for some reason)

      @fisch37@fisch372 жыл бұрын
  • So easy to understand on the outside but too hard inside. Thanks for your creativity.

    @Ya_Semyon@Ya_Semyon3 жыл бұрын
  • your presentation is truly amazing dude . "showmanship"

    @youcefkel4743@youcefkel47432 жыл бұрын
  • "The difference between an amateur and a professional is you write your own compiler."

    @badcholesterol@badcholesterol3 жыл бұрын
  • Damn, i thought this channel was over, I'm so happy he's back!!

    @shubhamshinde3593@shubhamshinde35936 жыл бұрын
    • aaaand he's dead

      @Nae_Ayy@Nae_Ayy6 жыл бұрын
    • coming back soon!

      @frameofessence@frameofessence5 жыл бұрын
    • @@frameofessence still waiting lol

      @SKO_PL@SKO_PL5 жыл бұрын
    • @@frameofessence we miss u

      @prakharsinha4822@prakharsinha48225 жыл бұрын
  • In simple programs like the one in the video, the compiler will usually optimize to minimize the number of stack pushes and pops. So in this example, with optimization, "x" would actually end up being a register with 3 being pushed into it, but without optimization, you would expect this.

    @thedigitalodyssey1103@thedigitalodyssey11032 жыл бұрын
  • I like how Crash Course computer Science was mentioned, you are not mistaking dear sir, such as yourself they are very good at explaining.

    @eddybobea6709@eddybobea67093 жыл бұрын
  • I can't even imagine myself ever making a compiler for an programming language! That's like an Avenger-level shit

    @Skulltroxx@Skulltroxx4 жыл бұрын
    • am going to make one. still learning. its a huge task but its not very difficult

      @JoshuaKisb@JoshuaKisb4 жыл бұрын
    • Imagine that Bill Gates did so: He wrote the BASIC compiler...

      @toniodotcom@toniodotcom4 жыл бұрын
    • @@JoshuaKisb did any of you make one already ?

      @boulahchichenadir9075@boulahchichenadir90754 жыл бұрын
    • @@boulahchichenadir9075 yeah sort of

      @JoshuaKisb@JoshuaKisb4 жыл бұрын
    • @@JoshuaKisb sort of is still an improvement i geusse

      @boulahchichenadir9075@boulahchichenadir90754 жыл бұрын
  • 10:30 caught me off guard but I LOVE IT!

    @drlogiq1494@drlogiq14945 жыл бұрын
  • one of the best videos i have seen . . . excellent work !

    @darrenlefcoe@darrenlefcoe22 күн бұрын
  • As a maths person and someone who's never done any coding, seeing "X = X + 1" pained me to read.

    @LunizIsGlacey@LunizIsGlacey3 жыл бұрын
    • X-x = 1 0=1😂😂*just joking*

      @rohanrajshrestha940@rohanrajshrestha9402 жыл бұрын
    • @Sam Erens The difference is basically that in mathematics every statement has to apply at the same time (unless specified otherwise) while in programming every statement only applies *once* (unless used multiple times [e.g. loops]).

      @fisch37@fisch372 жыл бұрын
    • Yeah, it's more like a X(n+1) = X(n) +1 situation.

      @FilmscoreMetaler@FilmscoreMetaler2 ай бұрын
  • For someone who has zero experience in programming and interested in the field. This video was incredible helpful in understanding the origins of code and made a lot of sense. I can see why there are only linux and it's many distributions as the only real alternative in operating systems. It would take a lot of work and know how to reinvent the wheel. Great video.

    @KarmelAbufarha@KarmelAbufarha4 жыл бұрын
    • If you got zero experience about programming you wont understand what is being talked about in this video specially in the comments section!!!

      @petefrancisco3267@petefrancisco32677 ай бұрын
  • I just found this channel, it’s awesome!

    @samburnes9389@samburnes93896 жыл бұрын
  • great video, thanks for sharing your knowledge !

    @anpawo13@anpawo135 ай бұрын
  • 5:18 ah yes, finally some readable code

    @mitchluscombe1071@mitchluscombe10713 жыл бұрын
  • I enjoyed watching this. Good sense of humour

    @gbenga9811@gbenga98115 жыл бұрын
  • Just one word : Amazing!!!

    @ashismandal7776@ashismandal77765 жыл бұрын
  • the best video i have ever seen about programming

    @GKNaidu-hb5zv@GKNaidu-hb5zv3 жыл бұрын
  • Such a good teacher may good bless you 🙏

    @MariemMili@MariemMili3 ай бұрын
  • Damn that ending... 3 > 2.7 :D

    @Khaktos@Khaktos6 жыл бұрын
    • I concur, Python is just the worst.

      @renxula@renxula6 жыл бұрын
    • hahah same here.

      @syedanoorumar1419@syedanoorumar14196 жыл бұрын
    • @@renxula why

      @omertrnk5397@omertrnk53975 жыл бұрын
    • @@omertrnk5397 it makes no sense for me

      @tunis4@tunis45 жыл бұрын
    • @@tunis4 He's talking about python versions. The code `print "hello"` used to be correct in python version 2.7 but when python updated to version 3, they removed the feature. Although it's not as pretty, I agree with Python's decision to be more consistent with syntax. Another thing that changed was `/` being sometimes an integer devision and sometimes a float division (classic division like java), to `/` being only floating point division (true division). Now only `//` is used for integer division. (floor division)

      @funnygeeks8126@funnygeeks81265 жыл бұрын
  • I think it is cool to add that high-level or low-level are both relative to a specific machine, so Python is high-level to an Intel processor, but somewhat lower-level to the Python VM. Also note that there exists compilers that translate a high-level language to a language that would look like it is high-level comparing to an Intel processor. Also, JVM execution is more the complex then a "interpreter". Code is initially interpreted, but most used functions are compiled to native code on-the-fly and executed natively.

    @brunozimmermann8017@brunozimmermann80174 жыл бұрын
  • Clear and fluid presentation. Thanks a lot!

    @gemmagemma9726@gemmagemma9726 Жыл бұрын
  • Thank you for this beautiful video!

    @nicolastelfyr6792@nicolastelfyr6792 Жыл бұрын
  • Thank you! That's the content I've been looking for ...

    @FelipeMaffezzolli@FelipeMaffezzolli5 жыл бұрын
    • Really

      @AmazeAngeloGames@AmazeAngeloGames3 жыл бұрын
  • Ah. The wait was worth it!

    @benjaminbrady2385@benjaminbrady23856 жыл бұрын
  • Please come back and explain more. I'm addicted to your videos 😉

    @electricz3045@electricz30452 жыл бұрын
  • This was very well-made. Thank you

    @lowerbound4803@lowerbound48032 жыл бұрын
  • "You only did python scripting?!" me, trying to teach myself python:

    @scptime1188@scptime11884 жыл бұрын
  • Thank God You're back...now dont go on long vacations...

    @bhs_742@bhs_7426 жыл бұрын
  • Thanks, clear and kind description❤️

    @olhalinevych6588@olhalinevych6588 Жыл бұрын
  • I almost never comment on videos, but I'm here to say that this explanation was just amazing

    @rubio.laureano@rubio.laureano2 жыл бұрын
KZhead