Writing a Compiler and Interpreter in Rust - Part 1

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ค. 2024
  • In this series, we write a compiler and interpreter for my stack based language "MCL" (a programming language I designed) in Rust. Originally written in C++, we investigate how it works, rewrite it in Rust, and optimize the hell out of it.
    In this episode, we look at the old code, and then get into actually writing some Rust! Exciting.
    The codebase will be on GitHub, but in this video we don't produce enough code to push anything yet. The original mcl is at github.com/lionkor/mcl
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น • 24

  • @romangeneral23
    @romangeneral23 16 ชั่วโมงที่ผ่านมา

    We must view compiler as enemy!!!

  • @lukebrichey
    @lukebrichey 9 วันที่ผ่านมา

    Was hoping to write an interpreter and learn Rust so this is precisely what I was looking for! Excited for the series

    • @lionkor98
      @lionkor98  6 วันที่ผ่านมา

      Hope you enjoy it! Taking a few weeks break for my thesis, but then I'll be right on episode 8 -- so in a few days probably. Interpreters are very fun to build, I encourage you to try it yourself!

  • @kamertonaudiophileplayer847
    @kamertonaudiophileplayer847 หลายเดือนก่อน +4

    Everyone has the idea to create own language, a compiler, an interpreter and so on. Certainly, I did it too. I am glad that someone is willing to share the idea. My way was a bit different, originally my language was written in Java and then I rewrote it in Rust.

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +1

      It's a wonderful challenge, especially when you go more in depth than "just" a stack based language like we do here

    • @kamertonaudiophileplayer847
      @kamertonaudiophileplayer847 หลายเดือนก่อน

      @@lionkor98 Sure.

  • @mathmo
    @mathmo หลายเดือนก่อน +5

    Looks promising! You should create a playlist for these videos.

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +1

      Done!

  • @aayushashokkashyap
    @aayushashokkashyap หลายเดือนก่อน

    These days my feed has gotten a lot better with people like him appearing.

  • @eineatombombe
    @eineatombombe หลายเดือนก่อน

    cool stuff

  • @linkernick5379
    @linkernick5379 หลายเดือนก่อน

    You've got really appealing ASMR-like voice 🙂‍↔️
    But the content is good too, looking forward to see how LLVM works, I hope you'll use it for codegen.

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +1

      Hi, we're probably gonna write our own shitty JIT first to see how far we can go, and then switch to something serious

  • @slendi9623
    @slendi9623 หลายเดือนก่อน

    hes just like me fr

  • @vanillarodent
    @vanillarodent หลายเดือนก่อน

    heard we switching to rust

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +1

      we have to, its very hip and very cool!

  • @vectorlua8081
    @vectorlua8081 หลายเดือนก่อน +7

    I'd honestly rather write stuff in C++, but cargo is simply built different.

    • @blueghost3649
      @blueghost3649 หลายเดือนก่อน +1

      Why C++?

    • @vectorlua8081
      @vectorlua8081 หลายเดือนก่อน

      @@blueghost3649 I just prefer C++, to my monkey brain it just reads easier, and I'm not referring to most C++ 20 features, stuff is living, breathing, nightmare fuel. (specifically std::ranges)

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +2

      I agree for the most part, C++ is quite nice and it's still what I mostly write, but rust + cargo are just too easy to not use ;)

    • @axisaligned9799
      @axisaligned9799 หลายเดือนก่อน +4

      Why would u want to miss out on traits & algebraic enums? I heavily use them to model language for compilers

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +1

      @@axisaligned9799 exactly

  • @khanra17
    @khanra17 หลายเดือนก่อน

    Audio quality is wack & over edited

    • @lionkor98
      @lionkor98  หลายเดือนก่อน +2

      Hi! I didn't edit the audio at all, I just sound like that. If you mean it cutting out here and there, that's RNNoise noise suppression.

    • @esiarpze7908
      @esiarpze7908 หลายเดือนก่อน

      I like the audio, it’s lovely