• joyjoy@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    1 year ago

    When you write a compiler, you eventually have to write it twice. Once in a pre-existing language, then again in the language it compiles.

    Just say no to bootstrapping.

  • Jeena@jemmy.jeena.net
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    At university the by far coolest and most fun course was compiler construction. We had to write something which would compile a small subset of Java (Javalette) into the Java Virtual Machine instruction set.

    I wrote my compiler in Haskell because it seemed that it’d be much less hassle compared to do it in a object oriented or procedual language.

    It ain’t pretty but it’s honest work: https://github.com/jeena/CC/blob/master/Compiler.hs

    • nychtelios@rlyeh.icu
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Actually compilers are more complex than operative systems, and incredibly they are built using compilers.

        • phorq@lemmy.ml
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Yup, C is written in C. You bootstrap using a compiler written in another language until your language is complete enough to write its own compiler.