Writing a Compiler and Interpreter in Rust - Part 1

Sdílet
Vložit
  • čas přidán 5. 05. 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
  • Věda a technologie

Komentáře • 23

  • @lukebrichey
    @lukebrichey Před 3 dny

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

    • @lionkor98
      @lionkor98  Před dnem

      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 Před měsícem +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  Před měsícem +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 Před měsícem

      @@lionkor98 Sure.

  • @mathmo
    @mathmo Před měsícem +5

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

  • @aayushashokkashyap
    @aayushashokkashyap Před měsícem

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

  • @eineatombombe
    @eineatombombe Před měsícem

    cool stuff

  • @linkernick5379
    @linkernick5379 Před měsícem

    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  Před měsícem +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 Před měsícem

    hes just like me fr

  • @vanillarodent
    @vanillarodent Před měsícem

    heard we switching to rust

    • @lionkor98
      @lionkor98  Před měsícem +1

      we have to, its very hip and very cool!

  • @vectorlua8081
    @vectorlua8081 Před měsícem +7

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

    • @blueghost3649
      @blueghost3649 Před měsícem +1

      Why C++?

    • @vectorlua8081
      @vectorlua8081 Před měsícem

      @@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  Před měsícem +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 Před měsícem +4

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

    • @lionkor98
      @lionkor98  Před měsícem +1

      @@axisaligned9799 exactly

  • @khanra17
    @khanra17 Před měsícem

    Audio quality is wack & over edited

    • @lionkor98
      @lionkor98  Před měsícem +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 Před měsícem

      I like the audio, it’s lovely