Compilers, How They Work, And Writing Them From Scratch

Поделиться
HTML-код
  • Опубликовано: 21 ноя 2024
  • Here's my compiler discussed in the video:
    adam-mcdaniel....
    And the web-demo:
    adam-mcdaniel....
    Finally, check out my website and my blog!
    adam-mcdaniel.net
    adam-mcdaniel....
    If you're interested, check out my shell, too!
    adam-mcdaniel....
    This is a reupload with better audio mixing!

Комментарии • 424

  • @Conman9310
    @Conman9310 5 месяцев назад +700

    ITS MY SLEEPOVER AND I GET TO PICK THE MOVIE

    • @CppExpedition
      @CppExpedition 2 месяца назад +5

      please invite me to all your parties! 🎈

    • @neithsan5110
      @neithsan5110 13 дней назад

      so u pick how to write compilers from scratch? 😹

  • @ethanly1720
    @ethanly1720 5 месяцев назад +128

    Yooo, you were my TA. Quality content and super clear way of explaining!

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +24

      Hahaha great to see you here! Thanks so much!

  • @dragonfiregaming4427
    @dragonfiregaming4427 4 месяца назад +238

    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.

  • @tom901ful
    @tom901ful 5 месяцев назад +822

    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 месяцев назад +275

      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 месяцев назад +53

      I'd say that makes this video blasphemy and you a heretic - but in a good way

    • @terminallychill8029
      @terminallychill8029 5 месяцев назад +9

      What other kinds of genius did Terry Davis have 🤔

    • @tom901ful
      @tom901ful 5 месяцев назад +13

      @@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 месяцев назад +4

      @@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?

  • @fangbozhu7379
    @fangbozhu7379 2 дня назад +1

    Finished a Masters at 22, and producing such neatly commentated videos... you're spectacular

  • @therealestsnake
    @therealestsnake 29 дней назад +2

    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!

  • @kr8432
    @kr8432 24 дня назад +3

    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..

  • @abrianabir7127
    @abrianabir7127 16 дней назад +2

    Awesome video and narration! finally got the time to sit down and watch. very informative!

    • @adammcdaniel536
      @adammcdaniel536  16 дней назад

      @@abrianabir7127 Thanks so much, Im glad you liked it! :D

  • @vikaspoddar001
    @vikaspoddar001 3 месяца назад +5

    You are great, we want a full series on the compiler, language design, type system 😅😅😅

  • @divy1211
    @divy1211 5 месяцев назад +54

    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!

  • @aymenbelghoul2713
    @aymenbelghoul2713 4 месяца назад +5

    This is one of those guys that appear from nowhere , drop a banger, then vanish forever

  • @tgrey_shift..mp334
    @tgrey_shift..mp334 8 дней назад +2

    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  7 дней назад

      @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!👀

  • @steveclancy6474
    @steveclancy6474 2 месяца назад +2

    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.

  • @Neel631
    @Neel631 5 месяцев назад +37

    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 месяцев назад +2

      Thank you so much, that's super kind!! I'm glad you liked it, I worked hard on it!! Hahaha

  • @oglothenerd
    @oglothenerd 3 месяца назад +4

    Brainfuck mentioned, let's go! I actually started writing a compiler for (human readable to) Brainfuck a little while ago!

  • @JackieJKENVtuber
    @JackieJKENVtuber 5 месяцев назад +121

    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 месяцев назад +3

      So we're all imagining that one picture of Newton, right?

    • @unnoticedspacegoat8537
      @unnoticedspacegoat8537 5 месяцев назад +3

      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**

  • @meronamsamho9410
    @meronamsamho9410 4 месяца назад +5

    5 seconds in and i get the best definition of what a computer is in my years of CE

  • @Stella-se1lg
    @Stella-se1lg 3 месяца назад +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 месяца назад +4

      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.

  • @mahdadbaghani2586
    @mahdadbaghani2586 2 месяца назад +3

    real nice. I see a soon-to-be successful channel in CS. keep up the good work!

  • @oli111222
    @oli111222 2 месяца назад +4

    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!

  • @gottagofast0077
    @gottagofast0077 5 месяцев назад +6

    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 месяцев назад +4

      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.

  • @vanadium6021
    @vanadium6021 5 месяцев назад +22

    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!

  • @_simoncurtis
    @_simoncurtis 5 месяцев назад +12

    This is actually insane! Puts my little scripting language pet project to shame haha

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +1

      Hahaha thanks so much, I appreciate it!!😄

  • @obiomajronyekwere4469
    @obiomajronyekwere4469 3 месяца назад +16

    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  2 месяца назад +10

      @@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 2 месяца назад +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.

  • @kamalacharya4608
    @kamalacharya4608 5 месяцев назад +16

    The video is really high quality.
    Keep making more.

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +3

      Thank you so much, I really appreciate the kind words!!!

  • @Turalcar
    @Turalcar 5 месяцев назад +106

    1:51 "...very few grunts and gestures"
    x86-84 Instruction Set: Am I a joke to you?

    • @zackbuildit88
      @zackbuildit88 5 месяцев назад +9

      Textbook definition of bloat tbh

    • @Microextent
      @Microextent 5 месяцев назад +2

      @@zackbuildit88 i 100% agree

    • @zackbuildit88
      @zackbuildit88 5 месяцев назад +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 месяцев назад +2

      @@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 месяцев назад +2

      @@Microextent You said "actually" like you were gonna contradict me but, based on what you said, you agree with me. What? [Edit: I misread]

  • @SimGunther
    @SimGunther 5 месяцев назад +12

    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 месяцев назад +1

      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 26 дней назад

      he had to translate it into something my caveman brain could understand

  • @OWOacnight
    @OWOacnight 5 месяцев назад +6

    The thumbnail attracts me immediately when I saw it, great stuff!

  • @thatonemailbox
    @thatonemailbox 5 месяцев назад +566

    Bro opened with brainfuck 💀

    • @ccgarciab
      @ccgarciab 5 месяцев назад +75

      Good choice for a simple machine code tbh

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +88

      Hahahaha I had to do it to 'em

    • @godowskygodowsky1155
      @godowskygodowsky1155 5 месяцев назад +27

      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 месяцев назад +12

      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

  • @devbites77
    @devbites77 5 месяцев назад +16

    Top-notch presentation. I look forward to seeing the subs. rise up.

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +2

      Thank you so much, I'm really glad you liked it!! I hope to deliver more enjoyable content soon with what I've learned!!!

  • @archive-underground
    @archive-underground 5 месяцев назад +23

    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 месяцев назад +5

      Thank you so much, I'm glad you enjoyed it!! I think it's an incredibly interesting subject, I'm glad the RUclips algorithm showed it to you hahaha

  • @psibarpsi
    @psibarpsi 5 месяцев назад +13

    I love people like you who delve into the fundamentals and build actually cool things.

  • @Dominik-K
    @Dominik-K 5 месяцев назад +3

    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 🙏

  • @suyash7120
    @suyash7120 4 месяца назад +2

    This is so awesome... Waiting for more such videos. Kudos 🎉

  • @Hector-bj3ls
    @Hector-bj3ls 5 месяцев назад +3

    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 😅

  • @pureatheistic
    @pureatheistic 4 месяца назад +2

    You live in TN? HELL YEA dude. Exciting to see a programmer content creator living here in this hill Billy hell.

  • @briancoghlan7353
    @briancoghlan7353 4 месяца назад +1

    Shout-out to UT! I still go back to Dr.Plank's course websites years later to refresh on concepts!

  • @two_horus7337
    @two_horus7337 5 месяцев назад +4

    Keep up the good work! Such a concise yet understandable video.

  • @khonello
    @khonello 5 месяцев назад +1

    Just checked out your website and you are truly impressive. Would appreciate having you as mentor or tutor

  • @MikeWardNet
    @MikeWardNet 5 месяцев назад +10

    Great content. Much better audio mix.

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +2

      Thank you so much!! I'm glad it's an improvement!

  • @ЕгорКолов-ч5с
    @ЕгорКолов-ч5с 5 месяцев назад +70

    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 месяцев назад +7

      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 месяцев назад +4

      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 месяцев назад +5

      I am waiting for your video

    • @bossgd100
      @bossgd100 5 месяцев назад +2

      @@chocolatezt no, but its better if he do it ;)

    • @bruhmoment1835
      @bruhmoment1835 5 месяцев назад +4

      @@bossgd100yeah, just use flawed knowledge until then, because nothing is gospel unless it's on RUclips. For once in your life, read a textbook.

  • @cellularmitosis2
    @cellularmitosis2 5 месяцев назад +4

    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

  • @funky_tree
    @funky_tree Месяц назад +1

    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

  • @johncaruthers315
    @johncaruthers315 4 месяца назад +1

    Fellow Vol! Great video, interested to see your research.

  • @nteasushz
    @nteasushz 4 месяца назад +2

    This guy compiles. Awesome

  • @s8x.
    @s8x. 5 месяцев назад +2

    Another genius kid in programming. They must be stopped

  • @worldordergaming3449
    @worldordergaming3449 28 дней назад +1

    I can tell you are using manim for your visualizations. Awesome job Adam!
    Best CS 302 TA out there.

    • @adammcdaniel536
      @adammcdaniel536  28 дней назад

      @@worldordergaming3449 Thank you so much for the kind words! It's great to see my fellow classmates here! :D

  • @redcrafterlppa303
    @redcrafterlppa303 5 месяцев назад +1

    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.

  • @kleanse
    @kleanse 23 дня назад

    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 :)

  • @GodofWar1515
    @GodofWar1515 5 месяцев назад +1

    Really Awesome work! It's really nice to see a fellow Programming Language Enthusiast. Keep up the great work!

  • @andrewrusanov6262
    @andrewrusanov6262 4 месяца назад +1

    Brilliant video! I hope you continue making videos on computer science

  • @PMA65537
    @PMA65537 3 месяца назад +2

    1:02 According to Bornat a major role of compilers is giving good error messages when compliation fails.

  • @ollieoniel
    @ollieoniel 2 месяца назад

    Amazing stuff. You definitely have big brains. You should try start into monetization. The only thing I would say if you do sell it to people, let people do some image rendering as their first code steps lol. I wouldn't mind getting advice on compiler, I bought some books on assembly code and I am trying my own language, is assembler too low lever to create a compiler or would you advise c or something not so low?

  • @ゾカリクゾ
    @ゾカリクゾ 5 месяцев назад +3

    awesome quality and very interesting. I really want to take a course in programming language theory in the future.

  • @kenana3456
    @kenana3456 3 месяца назад

    Nice video, I know you from your old blog where you talked about compilers!

  • @unitedastronomer
    @unitedastronomer 4 месяца назад +1

    wow this really helped me understand the basics of it

  • @edgeeffect
    @edgeeffect 5 месяцев назад +4

    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. :)

  • @ladyville3
    @ladyville3 Месяц назад +1

    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.

  • @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.

  • @oglothenerd
    @oglothenerd 3 месяца назад +6

    Dude! You're not one of the soy boys, this is actually the kind of stuff I wanna watch! I subbed and liked.

  • @lorenzojojoba2832
    @lorenzojojoba2832 5 месяцев назад +1

    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.

  • @vvarhand3985
    @vvarhand3985 5 месяцев назад +1

    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?

  • @GrindAlchemyTech
    @GrindAlchemyTech 3 месяца назад +1

    👌🏾 thank you for sharing your gift with us all

  • @jordixboy
    @jordixboy 5 месяцев назад +2

    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 месяцев назад +1

      @@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.

  • @CoreDumpped
    @CoreDumpped 5 месяцев назад +1

    I loved this video, nice job :D

  • @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. 😁

  • @Valurinn
    @Valurinn 2 месяца назад

    20:23 10/10 on intense musical fade-inn on epic greatness 🫡

  • @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

  • @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.

  • @RichardLofty
    @RichardLofty 5 месяцев назад +16

    Holy C compiler translates source to machine code directly line by line.
    No intermediate representation is required depending on the language.

    • @toricon8070
      @toricon8070 5 месяцев назад +1

      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 месяцев назад +4

      @@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 месяцев назад +3

      @@sudarshanrobot oh thank you! that will be fun to learn about

    • @Isaac-zy5do
      @Isaac-zy5do 5 месяцев назад +1

      The tiny C compiler is also famously a single-pass compiler

  • @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

  • @ArthurSchoppenweghauer
    @ArthurSchoppenweghauer 4 месяца назад +8

    This video is useful if you already know how compilers are built.

  • @TarkTheConlanger
    @TarkTheConlanger 5 месяцев назад +2

    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 :)

  • @discotecc
    @discotecc 3 месяца назад +1

    You're a great communicator

  • @AgentMatt47
    @AgentMatt47 5 месяцев назад +1

    Your voice is so cute 🥰. Your promotor is so lucky to work with you

  • @poisonbar844
    @poisonbar844 5 месяцев назад +2

    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

  • @jacobvartuli507
    @jacobvartuli507 5 месяцев назад +1

    Brilliant! Keep up the great work.

  • @AdverTyy
    @AdverTyy 5 месяцев назад +1

    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!!!

  • @gowthamk7416
    @gowthamk7416 5 месяцев назад +1

    Now you became my inspiration ❤️

  • @taux_gmigmi
    @taux_gmigmi 5 месяцев назад +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.

  • @KAZVorpal
    @KAZVorpal 3 месяца назад +1

    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.

  • @NanR
    @NanR 5 месяцев назад +1

    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).

  • @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.

  • @L84PA-T
    @L84PA-T 11 дней назад

    I would like this video twice if I could

  • @bigyihsuan2
    @bigyihsuan2 4 месяца назад +1

    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.

  • @thebirdhasbeencharged
    @thebirdhasbeencharged 5 месяцев назад +7

    Good stuff my man!

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +3

      Thank you!! It took years to get the compiler solid hahaha

  • @alexanderserafeim9416
    @alexanderserafeim9416 5 месяцев назад +1

    Very nice explanation. Not too much whiteboarding and very easy to follow code. Good luck with your PhD :)

  • @ServerGhost-d8p
    @ServerGhost-d8p 5 месяцев назад +1

    Lightning infused silicon lmao definitely using that one

  • @boltez6507
    @boltez6507 5 месяцев назад +1

    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.

  • @kevin42
    @kevin42 4 месяца назад +1

    Exceptional work!

  • @Delta0001-y
    @Delta0001-y 5 месяцев назад +2

    This is fantastic, thanks!

  • @ukrustacean
    @ukrustacean 5 месяцев назад +2

    That's the content we need!

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +2

      Thanks so much, I appreciate the kind words a ton!! I LOVE the Ukraine flag behind the Haskell logo lamba!!!🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🐑🐑🐑🐑🐑🐑 SLAVA UKRAINI🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦🇺🇦

  • @seekilm_
    @seekilm_ 5 месяцев назад +5

    Nice with new audio ahah. Keep it up!

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад +1

      Thank you!!

    • @knkootbaoat6759
      @knkootbaoat6759 5 месяцев назад +1

      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 месяцев назад +1

      @@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.

  • @yelshabasy
    @yelshabasy 5 месяцев назад +2

    What resources helped you create this language and create the cool projects you made with it, such as the OS. Ive been trying to implement a custom language for the longest but met with a lot of roadblocks with resources becoming very limited the further I go. Amazing work!

    • @adammcdaniel536
      @adammcdaniel536  5 месяцев назад

      The only resources that helped me create this language was practice -- there are very few resources that make it easy to learn how to make a good custom language. If you want to talk with me directly about how to accomplish this, you can message me -- my discord account is directly available in the Sage discord server!!! You can privately message me from there!!

  • @shaquille_oatmeal207
    @shaquille_oatmeal207 3 месяца назад +103

    PhD at 22. That’s it. I’m so cooked 🙏

    • @JohnSmith-op7ls
      @JohnSmith-op7ls 3 месяца назад +3

      Stop trying to make “cooked” a thing

    • @shaquille_oatmeal207
      @shaquille_oatmeal207 3 месяца назад +107

      @@JohnSmith-op7ls ur right bro. My vocabulary is cooked 😔

    • @proceduralism376
      @proceduralism376 2 месяца назад +2

      i always had a phd, a pretty huge d-

    • @bjdooi
      @bjdooi 2 месяца назад +4

      bro it's ok he's a PHD student, he doesn't actually have his PhD yet lol

    • @elorrambasdo5233
      @elorrambasdo5233 Месяц назад +1

      ​@@shaquille_oatmeal207chat, are we oatmeal's vocabulary?

  • @fantasy_foexig1116
    @fantasy_foexig1116 5 месяцев назад +1

    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!!!

  • @uuu12343
    @uuu12343 5 месяцев назад +1

    As others have pointed out, this is like Terry Davis if he didnt explode

  • @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 месяцев назад +2

      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

  • @preston7376
    @preston7376 5 месяцев назад +13

    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 месяцев назад +2

      Yep, you can compile to an IR or another source language if you like

  • @chiquiflautro
    @chiquiflautro 2 месяца назад +1

    Great content!
    Out of curiosity, are you using manim to do the animations?

    • @adammcdaniel536
      @adammcdaniel536  2 месяца назад +1

      @@chiquiflautro Thank you so much, and yes I'm using Manim!