Compilers, How They Work, And Writing Them From Scratch

  Рет қаралды 221,391

Adam McDaniel (kiwi)

Adam McDaniel (kiwi)

Күн бұрын

Пікірлер: 426
@Conman9310
@Conman9310 5 ай бұрын
ITS MY SLEEPOVER AND I GET TO PICK THE MOVIE
@CppExpedition
@CppExpedition 2 ай бұрын
please invite me to all your parties! 🎈
@neithsan5110
@neithsan5110 15 күн бұрын
so u pick how to write compilers from scratch? 😹
@dragonfiregaming4427
@dragonfiregaming4427 4 ай бұрын
Opened with Brainfuck, compared caveman speak to the x64 instruction set, and created a language even simpler than Python. My god, the steel balls and genius of this man are insane. Good things ahead for you. As an aspiring 17 year old programmer this vid makes me so happy.
@Scudmaster11
@Scudmaster11 2 ай бұрын
FALSE is better
@ethanly1720
@ethanly1720 5 ай бұрын
Yooo, you were my TA. Quality content and super clear way of explaining!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Hahaha great to see you here! Thanks so much!
@tom901ful
@tom901ful 5 ай бұрын
This dude casually demonstrates how he programmed a language, a compiler and a OS. He has Terry Davis levels of genius (Strictly talking about programming of course).
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much!!! Terry Davis was certainly one of my heroes in highschool; he's God's chosen programmer after all!!!
@horrorhotel1999
@horrorhotel1999 5 ай бұрын
I'd say that makes this video blasphemy and you a heretic - but in a good way
@terminallychill8029
@terminallychill8029 5 ай бұрын
What other kinds of genius did Terry Davis have 🤔
@tom901ful
@tom901ful 5 ай бұрын
@@terminallychill8029 I mean, he said a couple of things that resonate with Diogenes philosophy from time to time. But what I meant it's that he's like Terry Davis without having to bring the other stuff he had.
@akashchandra2223
@akashchandra2223 5 ай бұрын
@@adammcdaniel536 how were you brought up when young? How did you know you were interested in this stuff and how did you get so motivated in this industry?
@divy1211
@divy1211 5 ай бұрын
As a fellow programming language and compiler/program analysis enthusiast, I find your work very inspiring. I've only recently discovered that this is one of my favourite areas of swdev, and I'm very pleased to see someone else out there with the same passion!
@fangbozhu7379
@fangbozhu7379 5 күн бұрын
Finished a Masters at 22, and producing such neatly commentated videos... you're spectacular
@adammcdaniel536
@adammcdaniel536 4 күн бұрын
@@fangbozhu7379 Thank you so much!
@therealestsnake
@therealestsnake Ай бұрын
I love your use of Manim! I've always been a fan of PL theory + Compilers, so videos like this are always great to see!
@Neel631
@Neel631 5 ай бұрын
The breadth and depth of this video is blowing my mind. I work in storage, and I find working on the data path challenging. I envy you Adam. Very nice video!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much, that's super kind!! I'm glad you liked it, I worked hard on it!! Hahaha
@kr8432
@kr8432 27 күн бұрын
Even though I knew basically how it works, the animation at around 4:00 gave me an intuitive understanding about how from binary information and simple register commands complex programs can emerge. I took me a real long time but I think this gave me kind of a breakthrough. Nice..
@vanadium6021
@vanadium6021 5 ай бұрын
this was such a good video, you explained these concepts really well and I think you made great choices about what to include/not include. I hope to see more videos in the future but for now I will check out your blog!
@vikaspoddar001
@vikaspoddar001 3 ай бұрын
You are great, we want a full series on the compiler, language design, type system 😅😅😅
@steveclancy6474
@steveclancy6474 3 ай бұрын
Really enjoying your output. The music is very complimentary. Now I won't deny it, I do learn but it's also great to listen to to go to sleep.
@oli111222
@oli111222 3 ай бұрын
Where were you when I was in school? Real talk, huge respect for your work and your way of presenting and explaining stuff :) Keep up the good work!
@JackieJKENVtuber
@JackieJKENVtuber 5 ай бұрын
A cool way I've found to visualise what a compiler does goes as follows: When I tell you "the apple fell from the tree", we both imagine the same thing. However, our brain learned each of those concepts - apple, fall, origin, tree - and the relationships between them - "from" is synonymous with "origin" - through different ways. Therefore, no two brains are the same, even if they hear the same words and imagine the same concepts. Two computers with different architectures are like two different brains: the words (source code) are the same, and so are the results (the concepts and the relationships between them, the machine code is the neurons interacting to make what the end user sees), but the interpretation of the words into those concepts is different for every one (compiler).
@uncleswell
@uncleswell 5 ай бұрын
So we're all imagining that one picture of Newton, right?
@unnoticedspacegoat8537
@unnoticedspacegoat8537 5 ай бұрын
I use a similar analogy to differentiate between interpreters and compilers. If we both know english, then i can give you instructions while you’re doing them like teaching you to cook a particular meal. But if i only know german and you know only english, i need a translator(a compiler) to do translate german to english. In this scenario you are the interpreter, you give meaning to combinations of sounds and the translator is the compiler.
@casev799
@casev799 5 ай бұрын
​@@uncleswell ... I wasn't at first but now I wonder how many different images of Newton there are
@edmunns8825
@edmunns8825 4 ай бұрын
@@casev799 7
@iammichaeldavis
@iammichaeldavis 3 ай бұрын
@@uncleswellwell, I am **now**
@abrianabir7127
@abrianabir7127 19 күн бұрын
Awesome video and narration! finally got the time to sit down and watch. very informative!
@adammcdaniel536
@adammcdaniel536 19 күн бұрын
@@abrianabir7127 Thanks so much, Im glad you liked it! :D
@meronamsamho9410
@meronamsamho9410 4 ай бұрын
5 seconds in and i get the best definition of what a computer is in my years of CE
@aymenbelghoul2713
@aymenbelghoul2713 4 ай бұрын
This is one of those guys that appear from nowhere , drop a banger, then vanish forever
@oglothenerd
@oglothenerd 3 ай бұрын
Brainfuck mentioned, let's go! I actually started writing a compiler for (human readable to) Brainfuck a little while ago!
@Stella-se1lg
@Stella-se1lg 3 ай бұрын
I have 7 years of software development experience and recently get exposed to compiler, low level representation and type inference 😊. Your demo is clear and easy to follow!
@toby9999
@toby9999 3 ай бұрын
I started coding in the 70s. There were no available languages, just machine code, all hex. That's how my journey started. I eventually went back to university , took a computer science degree, and learned a lot of this kind of stuff. Lots of theory and low-level concepts. I then worked for a company developing its own scripting language and compiler. This was my passion. I feel there are too many programming courses nowadays that focus heavily on web design, client server, Java and Python, etc. And miss out on the beauty hidden behind the scenes.
@kamalacharya4608
@kamalacharya4608 5 ай бұрын
The video is really high quality. Keep making more.
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much, I really appreciate the kind words!!!
@tgrey_shift..mp334
@tgrey_shift..mp334 11 күн бұрын
I absolutely adore this video! Hope to see more soon! On a more personal note, I really admire your passion for theoretical CS being taught in an applied manner! Hope we can chat and be friends someday! Would love to read a paper/book with you and discuss to your hearts content! You rock!!! :)
@adammcdaniel536
@adammcdaniel536 10 күн бұрын
@tgrey_shift..mp334 Wow, thank you so much for the kind words! If you want to hang out with our community, you can join the Sage discord! I'm frequently there talking with others about type system things and off topic subjects! Hopefully I'll be making a new video relatively soon based on a new project I'm working on, which will likely be built on top of Sage's infrastructure!👀
@gottagofast0077
@gottagofast0077 5 ай бұрын
Nice video. I do have to mention that not every compiler needs an IR. In fact, many early C compilers translated directly to machine code. IR does make value tracking much easier which is very important to modern optimizations. Also, not every compiler compiles to machine code. Some compilers compile to bytecode, and others compile to different source code. I would like to see you go over the frontend of a compiler more indepth. Parsing and building the AST and IR is something that can be very interesting.
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
If you don't use an intermediate representation, you need M * N backends for the compiler, while it's only M + N for those with intermediate representations. This is why GCC, Clang, Rust, Fortran, Haskell, and tons of others use IRs before compiling to machine code -- nearly all modern compiled languages do this Yes, I'm aware many languages don't compile to machine code -- Sage compiles to SageVM code, which can be interpreted or compiled for a target platform. These are really just a hypothetical "machine code" for an imaginary machine. Parsing, to me, is the least fun part of the compiler hahaha. The AST is essentially directly represented as an IR in Sage, and then lowered to another stage before being compiled to the VM.
@Turalcar
@Turalcar 5 ай бұрын
1:51 "...very few grunts and gestures" x86-84 Instruction Set: Am I a joke to you?
@zackbuildit88
@zackbuildit88 5 ай бұрын
Textbook definition of bloat tbh
@Microextent
@Microextent 5 ай бұрын
@@zackbuildit88 i 100% agree
@zackbuildit88
@zackbuildit88 5 ай бұрын
@@Microextent it's so bloated that a lot of its "features" make it actually SLOWER than ARM cpu stuff even tho ARM doesn't have as many optimization strategies
@Microextent
@Microextent 5 ай бұрын
@@zackbuildit88 Absolutely, sometimes the phrase keep it simple stupid has great merit. Especially in complex systems like cpus, every one i have designed in logisim has been faster with less instructions. Sometimes you need to supplement with code but that is fine if you have fast clock speeds like all modern cpus do.
@zackbuildit88
@zackbuildit88 5 ай бұрын
@@Microextent You said "actually" like you were gonna contradict me but, based on what you said, you agree with me. What? [Edit: I misread]
@psibarpsi
@psibarpsi 5 ай бұрын
I love people like you who delve into the fundamentals and build actually cool things.
@Miguel_Vitta
@Miguel_Vitta 2 күн бұрын
This was pretty useful in increasing my understanding of the subject
@adammcdaniel536
@adammcdaniel536 Күн бұрын
@@Miguel_Vitta Thank you, I'm glad it could help!
@_simoncurtis
@_simoncurtis 5 ай бұрын
This is actually insane! Puts my little scripting language pet project to shame haha
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Hahaha thanks so much, I appreciate it!!😄
@mahdadbaghani2586
@mahdadbaghani2586 3 ай бұрын
real nice. I see a soon-to-be successful channel in CS. keep up the good work!
@archive-underground
@archive-underground 5 ай бұрын
I thought this video had like 1249124 views the first 2 minutes watching, how'd I just come across this randomly? Great stuff!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much, I'm glad you enjoyed it!! I think it's an incredibly interesting subject, I'm glad the KZbin algorithm showed it to you hahaha
@devbites77
@devbites77 5 ай бұрын
Top-notch presentation. I look forward to seeing the subs. rise up.
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much, I'm really glad you liked it!! I hope to deliver more enjoyable content soon with what I've learned!!!
@OWOacnight
@OWOacnight 5 ай бұрын
The thumbnail attracts me immediately when I saw it, great stuff!
@thatonemailbox
@thatonemailbox 5 ай бұрын
Bro opened with brainfuck 💀
@ccgarciab
@ccgarciab 5 ай бұрын
Good choice for a simple machine code tbh
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Hahahaha I had to do it to 'em
@godowskygodowsky1155
@godowskygodowsky1155 5 ай бұрын
BF is actually really easy to write a compiler for because of its small instruction set. Its difficulty is that due to Its small instruction set, it's hard to do anything useful.
@Bobbias
@Bobbias 5 ай бұрын
BF is also baby's first esolang. If someone starts off with Malbolge then you know you're in for a wild ride.
@infrakazos
@infrakazos 5 ай бұрын
@@godowskygodowsky1155 I've made addition, subtraction, multiplication, division, greater than and less than in brainfuck, so i think i can actually start making things, but im too lazy to continue working on it lol
@SimGunther
@SimGunther 5 ай бұрын
Great (albeit super abstract) overview of compilers. 90% of the time will be spent on optimizations, so it's not just important that you get the optimization sequencing correct, but also the AST transformations without losing the original meaning of the tree while still making good use of co-processors in the final binary executable/library output. Although languages like Rust, Haskell, and Idris make this task simpler via structured pattern matching, writing the optimizations themselves and seeing if they break other optimizations will still be a very hard task. Forgot to mention that on some hardware platforms, some very specific optimizations will turn out to be "slow downs", so be wary of that before customizing the optimizations that go into each target CPU/Co-processor.
@Turalcar
@Turalcar 5 ай бұрын
So it's closer to a literary translation from one modern language to another than the examples given at the top of the video. Using different sets of fixed phrases and cultural references (e.g. Shakespeare quotes to Chinese classics) and convey not just the meaning but the author's intention (for compilers that mostly means recognizing which path is the hot one).
@meechsanims
@meechsanims 29 күн бұрын
he had to translate it into something my caveman brain could understand
@Dominik-K
@Dominik-K 5 ай бұрын
Very nice and in-depth overview of those topics. I'm highly interested in more information in those topics, so this is highly appreciated. Thanks for this and please keep it up 🙏
@obiomajronyekwere4469
@obiomajronyekwere4469 3 ай бұрын
Dear god reading your resume and github as a 17 year old programmer is like a mortal staring at a god? what kind of free time do you have to do all this?
@adammcdaniel536
@adammcdaniel536 3 ай бұрын
@@obiomajronyekwere4469 Thank you so so much! Hahaha very little free time, but I don't play games or much else. Music and programming are my hobbies!
@obiomajronyekwere4469
@obiomajronyekwere4469 3 ай бұрын
@@adammcdaniel536 oh god.. and your tryna be in the workforce. Dude. Chill. Like seriously you are the definition of talent. But yknow what ill admit youve got me excited to surpass you one day. Your doing much more than i ever thought that just possible for a casual programmer.
@nteasushz
@nteasushz 4 ай бұрын
This guy compiles. Awesome
@two_horus7337
@two_horus7337 5 ай бұрын
Keep up the good work! Such a concise yet understandable video.
@MikeWardNet
@MikeWardNet 5 ай бұрын
Great content. Much better audio mix.
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much!! I'm glad it's an improvement!
@pureatheistic
@pureatheistic 4 ай бұрын
You live in TN? HELL YEA dude. Exciting to see a programmer content creator living here in this hill Billy hell.
@suyash7120
@suyash7120 4 ай бұрын
This is so awesome... Waiting for more such videos. Kudos 🎉
@briancoghlan7353
@briancoghlan7353 5 ай бұрын
Shout-out to UT! I still go back to Dr.Plank's course websites years later to refresh on concepts!
@GrindAlchemyTech
@GrindAlchemyTech 3 ай бұрын
👌🏾 thank you for sharing your gift with us all
@GodofWar1515
@GodofWar1515 5 ай бұрын
Really Awesome work! It's really nice to see a fellow Programming Language Enthusiast. Keep up the great work!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much!!
@unitedastronomer
@unitedastronomer 4 ай бұрын
wow this really helped me understand the basics of it
@Hector-bj3ls
@Hector-bj3ls 5 ай бұрын
One feature I'd like to see in more compilers is full compile time execution. That's what I'm working on in mine. Essentially I'm compiling to a custom byte code, executing it in a VM, and then inserting the output back into the earlier stages of the compiler.
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
The latest PR for sage DOES have compile time execution!!! Sage has an interpreter which can run at compile time -- also, the new PR adds a Lisp language as an AST preprocessor system which can manipulate user programs to add tests or benchmarks. With this system, you'll be able to write Sage to modify your Sage code!!!!
@Hector-bj3ls
@Hector-bj3ls 5 ай бұрын
@@adammcdaniel536 Oh nice! Having one language to do all the things is my goal. For example, one specific feature of many languages that's always bugged me is, meta programming using a totally different syntax to the rest of the language. An example that many will be familiar with is Typescript's mapped types. Consider the following: ``` type Readonly = { +readonly [K in keyof T] T[K], } ``` A fairly simple example. It just adds the readonly attribute to each property of some type T. My problem with this is that it's not really Typescript code. To express the same in normal TS code you'd write something like: ``` function Readonly(T: type): type { const result = typeDescriptorOf(T); for (const prop of result.properties) { prop.readonly = true; } return descriptorToType(result); } ``` It's more verbose, but it's also more accessible to Typescript developers. Because, instead of being a separate syntax with different rules, it's just code. The only difference is it runs at compile time. Prior art would be comptime in the Zig language, and #run in the Jai language. I think D also had something like this, but it's been a really long time since I used that 😅
@ukrustacean
@ukrustacean 5 ай бұрын
That's the content we need!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thanks so much, I appreciate the kind words a ton!! I LOVE the Ukraine flag behind the Haskell logo lamba!!!🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🐑🐑🐑🐑🐑🐑 SLAVA UKRAINI🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦
@oglothenerd
@oglothenerd 3 ай бұрын
Dude! You're not one of the soy boys, this is actually the kind of stuff I wanna watch! I subbed and liked.
@cellularmitosis2
@cellularmitosis2 5 ай бұрын
Thanks so much for this - I was in the process of writing a brainfuck compiler and this gives me a good roadmap of what’s next
@edgeeffect
@edgeeffect 5 ай бұрын
The Dragon Book would be a kinda obvious reference to cite... but can I also recommend "Understanding and Writing Compilers" by Richard Bornat a particular favourite of mine. :)
@khonello
@khonello 5 ай бұрын
Just checked out your website and you are truly impressive. Would appreciate having you as mentor or tutor
@redcrafterlppa303
@redcrafterlppa303 5 ай бұрын
Great video. Especially interesting as I'm looking forward to write my first compiler myself soon. I found it quite frustrating to find a language to write the compiler in. As the reason for creating my own language was that I wanted to combine multiple languages powers into one. This however led to frustration while writing the compiler. I ran into the problems I wanted to solve compared to the other languages and wished I could write it in my own language. But I know that I at least have to write a bare minimum compiler in some other language to be able to bootstrap it.
@PMA65537
@PMA65537 3 ай бұрын
1:02 According to Bornat a major role of compilers is giving good error messages when compliation fails.
@ЕгорКолов-ч5с
@ЕгорКолов-ч5с 5 ай бұрын
This video is basically about your personal abstract understanding of intermediate representations with a bit of Turing machines sprinkled in, and not about compilers. 1) Your definition of compilers is too restrictive - the IR is not a necessary step during compilation (if you included it, what about other (more significant than IR in my opinion) aspects of compilation such as lexing, building ATS, parsing, type checking, optimization, etc.) and the result of compilation doesn't have to be an executable binary (for example Cfront, the original compiler for C++, translated C++ source code to C source code, javac translates from Java SC to Java bytecode, and if you make a transpiler from brainfuck SC to C SC without generating an executable, it would still be considered a compiler) 2) The caveman analogy is unhelpful and misleading for programmers who don't know anything about compilers, and for those who do it will look as an unnecessary gross oversimplification 3) The part about translating high level languages to IR doesn't explain anything about compilers, and programmers who aren't familiar with compilers and Rust won't be able to understand it The video production is good though, would be great to see an indepth explanation of all compilation stages for a real language with actual code (tcc for example)
@lawrencemanning
@lawrencemanning 5 ай бұрын
Agreed. I’d be surprised if early C compilers used an IR, and compilers existed way before that. The presenting of IR as a core step is vey misleading. On production values; some of the text is unreadably small. IMO this kind of “instruction” would be clearer in a blog post or similar b
@logicaestrex2278
@logicaestrex2278 5 ай бұрын
ok so i have a few questions. i really appreciate your comment btw friend. on number 2, could you elaborate on why its a bad example, or perhaps on what a better example would be? also, what resources do you respect for learning how to make a compiler like this? again, thanks for these points :)
@bossgd100
@bossgd100 5 ай бұрын
I am waiting for your video
@bossgd100
@bossgd100 5 ай бұрын
@@chocolatezt no, but its better if he do it ;)
@bruhmoment1835
@bruhmoment1835 5 ай бұрын
@@bossgd100yeah, just use flawed knowledge until then, because nothing is gospel unless it's on KZbin. For once in your life, read a textbook.
@funky_tree
@funky_tree Ай бұрын
PLEASE make more videos like this, explaining the base stuff that nobody really bothers to learn because of the complexity in the multi page documents and unclear videos. I'm not very good with code, but you made me understand brainfuck
@perodactyl490
@perodactyl490 4 ай бұрын
It would be nice to know how best to implement these small steps such as parsers and ASTs in a way that is readable, functional, and performant. That being said, everything the video included was great
@ゾカリクゾ
@ゾカリクゾ 5 ай бұрын
awesome quality and very interesting. I really want to take a course in programming language theory in the future.
@lorenzojojoba2832
@lorenzojojoba2832 5 ай бұрын
Fantastic video dude. A video in more detail about the typechecker would be awesome. Alao youve dine a lot, im only just getting inro compielrs and this stuff blows my mind.
@newbie8051
@newbie8051 Ай бұрын
Ah, lovely looks interesting Wish I could take 2 electives in my 6th semester, really enjoyed the Image Processing course, but had to miss out on the Compiler Design course
@TheTruthTheyHate
@TheTruthTheyHate 2 ай бұрын
Great video. You just earned a new sub at 3:37. I’m starting my courses for B.S. in Cloud Computing in December. All of this is VERY new to me as i had no background in any of it. What you showed at 3:37 helped alot as i didn’t know what any of the instructions translate to. Now that i’ve got the basic knowledge of the symbols and what they do it’s making things alot more easier. Want to ask a favor. Do you think you can make a video thats more in depth and detailed for all the symbols or instructions and their functions please? Also how they could be used as an example. Once again I’m very new to the whole subject of computer coding and the different languages and what they’re used for. Thanks.
@thebirdhasbeencharged
@thebirdhasbeencharged 5 ай бұрын
Good stuff my man!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you!! It took years to get the compiler solid hahaha
@johncaruthers315
@johncaruthers315 4 ай бұрын
Fellow Vol! Great video, interested to see your research.
@kleanse
@kleanse 26 күн бұрын
I just stumbled across your channel and visited your website, and I am awestruck. The number of projects you’ve built with such detail and depth at your age is mad impressive. Do you have any books or resources you could share that you believe helped bring you to where you are today? I’d love to learn more about the topics you’ve covered and cultivating the work ethic you possess :)
@andrewrusanov6262
@andrewrusanov6262 4 ай бұрын
Brilliant video! I hope you continue making videos on computer science
@vvarhand3985
@vvarhand3985 5 ай бұрын
Awesome vid, will follow your content with great pleasure; just started reading crafting interpreters and will try some funky zig stuff
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
That's great, writing an interpreter is always a super important first step towards a compiler!!! Have you experimented with lisp at all? Lisp is an incredible start towards making one's own programming language!!!
@vvarhand3985
@vvarhand3985 5 ай бұрын
@@adammcdaniel536 I’ve never tried Lisp, and honestly, given the “mystique” it gives off, it sounds like a mind-bending experience (coming from self-taught web dev trying to learn how computers really work). But I am VERY interested in FP as well: I was thinking about Elixir for future job prospects or OCaml because of its overall shilling on various platforms😄 Any specific variety of Lisp?
@taux_gmigmi
@taux_gmigmi 5 ай бұрын
2:36 Sumerian isn't any "smaller" or "simpler" than English just because it's an older language. Obviously this is just a metaphor, but if you know about linguistics then the metaphor kind of falls apart. Instead of translating from 1 natural language to the other, maybe something more accurate would be translating from English to formal logic, with the intermediate representation being a logic-based language like Lojban.
@lunkel8108
@lunkel8108 5 ай бұрын
It's always interesting to me how many people think modern humans just a few thousand years ago were stupid idiots who couldn't even speak a proper language. A while ago I overheard a guy confidently explaining to his friends how biblical hebrew was incredibly "primitive" and how they didn't have poetry or complex narratives back then (while talking about the bible?!) because they were too busy getting chased by saber-toothed tigers (?!?). His main piece of evidence? That too many sentences in translations of the bible start with "and", which is obviously not something a "real language" would do. You know, that translation artifact of a grammatical construction (the vav-consecutive) that biblical hebrew had and modern english doesn't? Yeah, real primitive of them.
@sethrobinson613
@sethrobinson613 3 ай бұрын
I built a compiler for a course in school, we went from the top down focusing on language construction and stopping at intermediate representation due to the time constraints of the semester. I know it's possible to build up from the assembly code, and I'm curious if that's how you built the source language. Knowing very little about machine code, I'd be interested to learn more about how and why you made certain design choices. I'm hoping to make time to create a language and compiler that's slightly more complex than my school work later this year.
@Delta0001-y
@Delta0001-y 5 ай бұрын
This is fantastic, thanks!
@kevin42
@kevin42 4 ай бұрын
Exceptional work!
@adammcdaniel536
@adammcdaniel536 4 ай бұрын
@@kevin42 Thank you!!
@TarkTheConlanger
@TarkTheConlanger 5 ай бұрын
Damn, great video, you definitely deserve more views and subs
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much, I'm really glad you appreciated this content!! I spent a lot of time on it :)
@MichaelGarcia-e1b
@MichaelGarcia-e1b 2 ай бұрын
2:42 Such a great "conveniently". Kinda funny how so many of humanity's greatest inventions work thanks to conveniences like this. 😁
@CoreDumpped
@CoreDumpped 5 ай бұрын
I loved this video, nice job :D
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thanks so much!! :)
@kenana3456
@kenana3456 3 ай бұрын
Nice video, I know you from your old blog where you talked about compilers!
@jordixboy
@jordixboy 5 ай бұрын
If you're really interested in this topic, I would recommend taking these courses: nand2tetris and nand2tetris2, its heavy, long but totally worth it. You start by building logical gates with boolean algebra, you build an ALU, RAM, Registers... then a CPU and wire everything together using hardware description language (HDL). Then you program your CPU in binary, then you create an assembler for an assembly language, then you build a Java-like language and a compiler, then you build an OS and programs for it on your language. Highly Recommended!!! Thanks for the video.
@vitalyl1327
@vitalyl1327 5 ай бұрын
Or an even deeper course: Project Oberon - a complete RISC CPU + VGA + PS/2 keyboard and mouse controllers + SD card controller, all in a simplified HDL, along with a complete OS and a high level language compiler. With a windowed GUI.
@jordixboy
@jordixboy 5 ай бұрын
@@vitalyl1327 interesting! any link? is this a course or something?
@vitalyl1327
@vitalyl1327 5 ай бұрын
@@jordixboy youtube is likely to delete comments with links. Just search for "Project Oberon", you'll find all the course material in the first few links.
@vitalyl1327
@vitalyl1327 5 ай бұрын
@@jordixboy just look up the "Wirth Project Oberon". Links are problematic here.
@Valurinn
@Valurinn 2 ай бұрын
20:23 10/10 on intense musical fade-inn on epic greatness 🫡
@s8x.
@s8x. 5 ай бұрын
Another genius kid in programming. They must be stopped
@KAZVorpal
@KAZVorpal 3 ай бұрын
You should mention to people that it is really easy to write an interpreter in JavaScript to have your own programming language, that runs in the browser or in node. Of course that isn't quite as performant as using assembler or C and writing a compiler...but it means they can create almost anything, the very kind of stuff that you would do, without having to do quite as much heavy lifting. I'm working on a programming language with Klingon keywords, myself.
@gowthamk7416
@gowthamk7416 5 ай бұрын
Now you became my inspiration ❤️
@RichardLofty
@RichardLofty 5 ай бұрын
Holy C compiler translates source to machine code directly line by line. No intermediate representation is required depending on the language.
@toricon8070
@toricon8070 5 ай бұрын
this used to be the case, but CPUs have advanced significantly since C was created, and the C standard has not/will not/cannot change enough to keep up with it. there are a _lot_ of adjustments and optimizations that the GCC does to keep C performing at the blazing speeds we expect of it. see "C Is Not a Low-Level Language".
@sudarshanrobot
@sudarshanrobot 5 ай бұрын
@@toricon8070 OP was talking about Holy C, not C, that's another language. Although I'm not sure if the given information is correct.
@toricon8070
@toricon8070 5 ай бұрын
@@sudarshanrobot oh thank you! that will be fun to learn about
@Isaac-zy5do
@Isaac-zy5do 5 ай бұрын
The tiny C compiler is also famously a single-pass compiler
@MKVideoful
@MKVideoful 5 ай бұрын
It would be really nice to see the OS run on simple embedded platform (ARM/Risc V) with screen and keyboard. Then you can run compiler on it. No longer need to have PC.
@boltez6507
@boltez6507 5 ай бұрын
It would be great if you could make a video or just post a blog about the prerequisites to actually make your own compiler or language,though this video serves as a good introduction as to how a compiler is supposed to work,the knowledge can't be directly used to implement a language as such. Alot of things need to be explored prior to even attempting to build your own compiler,i hope that you can make a blog about all the prequisites required from beginning to end.
@dalemoayokunle7330
@dalemoayokunle7330 3 ай бұрын
Seconded🙋
@ladyville3
@ladyville3 2 ай бұрын
In all my years of learning and studying, I have found the best people to learn from are the ones that are not geniuses. Geniuses forget they are geniuses, and often leave you behind a few sentences in. I will say, I find people who are physicists usually can explain things a lot clearly than most. Lol.
@KayOScode
@KayOScode 3 ай бұрын
I made a language called que in 2 weeks from scratch. It used byte code interpretation instead of fully compiling to machine code, but still quite cool. It’s interesting that your byte code is more high level than mine was. Mine was almost one to one with the ARM instruction set. I figured if it were low level it would be easy to translate, but I think that wasn’t correct thinking.
@discotecc
@discotecc 3 ай бұрын
You're a great communicator
@adammcdaniel536
@adammcdaniel536 3 ай бұрын
@@discotecc Thanks so much!!
@ccgarciab
@ccgarciab 5 ай бұрын
Very nice presentation, and impressive showcase. I didn't expect Sage to be structurally typed. Given the rusty examples, I was expecting static nominal. I imagine it allows for dynamic dispatch as well as the static style shown in the video?
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you so much!! I'm glad you liked it!! Regretfully, it doesn't allow for dynamic dispatch yet, although that's in the works on top of the higher level of IR!!!!!!! Dynamic dispatch has been really hard for me to think about, although it's entirely possible. It's been hard for me to conceptualize -- VTables are difficult hahahaha
@worldordergaming3449
@worldordergaming3449 Ай бұрын
I can tell you are using manim for your visualizations. Awesome job Adam! Best CS 302 TA out there.
@adammcdaniel536
@adammcdaniel536 Ай бұрын
@@worldordergaming3449 Thank you so much for the kind words! It's great to see my fellow classmates here! :D
@jacobvartuli507
@jacobvartuli507 5 ай бұрын
Brilliant! Keep up the great work.
@shaquille_oatmeal207
@shaquille_oatmeal207 3 ай бұрын
PhD at 22. That’s it. I’m so cooked 🙏
@JohnSmith-op7ls
@JohnSmith-op7ls 3 ай бұрын
Stop trying to make “cooked” a thing
@shaquille_oatmeal207
@shaquille_oatmeal207 3 ай бұрын
@@JohnSmith-op7ls ur right bro. My vocabulary is cooked 😔
@proceduralism376
@proceduralism376 2 ай бұрын
i always had a phd, a pretty huge d-
@bjdooi
@bjdooi 2 ай бұрын
bro it's ok he's a PHD student, he doesn't actually have his PhD yet lol
@elorrambasdo5233
@elorrambasdo5233 Ай бұрын
​@@shaquille_oatmeal207chat, are we oatmeal's vocabulary?
@ServerGhost-d8p
@ServerGhost-d8p 5 ай бұрын
Lightning infused silicon lmao definitely using that one
@chiquiflautro
@chiquiflautro 2 ай бұрын
Great content! Out of curiosity, are you using manim to do the animations?
@adammcdaniel536
@adammcdaniel536 2 ай бұрын
@@chiquiflautro Thank you so much, and yes I'm using Manim!
@bigyihsuan2
@bigyihsuan2 4 ай бұрын
Great video, however it gives a vibe of the "draw the rest of the owl" meme in terms of how high level the explanations are. I've got an interest in building programming languages and so far the hardest part is changing from an interpreter to a compiler (which I have yet to do). You mention you use IRs to represent the higher level code in a form that's easier for the compiler to deal with. However you didn't really explain about what should go into an IR. How much of the original language should be stripped out? At what point should the IR be translated into another IR (if at all)? Another thing with the same "draw the rest of the owl" feeling is the final SageVM asm to native machine code step. IMO that is the most important step, but you glossed over it so fast that I wondered of it is indeed that easy (probably not). Summing up, I guess I had different expectations for this video based on the title than what was actually presented (a more low level view vs the high level view presented in the video). As another commenter said, great presentation, great dowmo. But as an educational explainer, leaves people more confused after watching it than before.
@newbie8051
@newbie8051 Ай бұрын
0:42 damn, you are 22 and finished with your masters damn I'm 21 and am thinking of opting for a masters degree after I graduate in a year
@akaidenki5526
@akaidenki5526 4 ай бұрын
explaining instructions using brainfuck gotta be the best ever example of how it works inside the memory 😂 nice one
@fantasy_foexig1116
@fantasy_foexig1116 5 ай бұрын
what a legendary pull the algorithm Gods blessed me once again
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you, I'm so glad you liked it!! This was my first video, hopefully of many!!!! Thank you for the support!!!
@preston7376
@preston7376 5 ай бұрын
Compilers are not limited to programs that generate machine code... it is any program which takes a language as input and generates another one as output. Not limited to machine code
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Yep, you can compile to an IR or another source language if you like
@poisonbar844
@poisonbar844 5 ай бұрын
Thanks a lot man for the informations. Hope to see more from you. Really enjoyed the video. [ Tho a bit harsh for my brain to understand it all so I will be watching them for a number of time to understand it whole.] Keep'em coming
@seekilm_
@seekilm_ 5 ай бұрын
Nice with new audio ahah. Keep it up!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
Thank you!!
@knkootbaoat6759
@knkootbaoat6759 5 ай бұрын
i didnt view the other videos. but man audio makes such a HUGE difference in terms of watchability (at least for me)
@seekilm_
@seekilm_ 5 ай бұрын
@@knkootbaoat6759 Yep the more time passes, the more I feel like I just have the sound of the voice and that's it. It became almost impossible to follow a video with music.
@AdverTyy
@AdverTyy 5 ай бұрын
Waiting for more videos about assembly!!!
@adammcdaniel536
@adammcdaniel536 5 ай бұрын
I hope to deliver content about this soon in the near future!!! Thank you for the encouragement!!!
@alexanderserafeim9416
@alexanderserafeim9416 5 ай бұрын
Very nice explanation. Not too much whiteboarding and very easy to follow code. Good luck with your PhD :)
@snake3444
@snake3444 5 ай бұрын
Dude I just found GOLD, first class stuff right here👌🏻
@NanR
@NanR 5 ай бұрын
Great video! It's really well made and very educational. BTW, your website's About Me has a small error in the spanish section. "He estado hablando" implies you started talking spanish in 2021, and haven't ever stopped since. A more correct way to say that would be "(Yo) Llevo hablando español desde 2021". I'd also recommend changing "puedo hablar muy bien" to "puedo hablar*lo* muy bien" (I can speak very well --> I can speak it very well).
@AgentMatt47
@AgentMatt47 5 ай бұрын
Your voice is so cute 🥰. Your promotor is so lucky to work with you
Let's Create a Compiler (Pt.1)
1:11:03
Pixeled
Рет қаралды 559 М.
Just In Time (JIT) Compilers - Computerphile
10:41
Computerphile
Рет қаралды 279 М.
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН
The IMPOSSIBLE Puzzle..
00:55
Stokes Twins
Рет қаралды 171 МЛН
Unreal Engine 5 Tutorial - PCG - 8. Height to Density
13:34
JBarlowTraining
Рет қаралды 5
Programming with Math | The Lambda Calculus
21:48
Eyesomorphic
Рет қаралды 237 М.
(Original Unedited Audio) Compilers, How They Work, And Writing Them From Scratch
23:54
The 3 Laws of Writing Readable Code
5:28
Kantan Coding
Рет қаралды 737 М.
Writing My Own Database From Scratch
42:00
Tony Saro
Рет қаралды 256 М.
I Went Too Fast
16:24
SuperfastMatt
Рет қаралды 161 М.
What Is A Graphics Programmer?
30:21
Acerola
Рет қаралды 452 М.
A Compiler For Our Own Programming Language // Full Guide
18:54
The Ultimate Sausage Prank! Watch Their Reactions 😂🌭 #Unexpected
00:17
La La Life Shorts
Рет қаралды 8 МЛН