• fxomt@lemm.ee
    link
    fedilink
    arrow-up
    4
    ·
    edit-2
    1 day ago

    That’s pretty cool, was this a practice for actual compiler development? Or for fun, or an actual project?

    • Val@lemm.eeOP
      link
      fedilink
      arrow-up
      4
      ·
      1 day ago

      I’m intending to use this for a custom language “OA” that I want to compile to Rust and JS to start with.

      I don’t know enough about LLVM to compile directly to machine code although I would like to.

      • fxomt@lemm.ee
        link
        fedilink
        arrow-up
        7
        ·
        1 day ago

        I love compiler dev, so i can give you a few tips:

        It may be hard to compile to rust, due to the borrow checker; but C or javascript are great first backends, i always go with C for my prototypes.

        PS: Don’t go with LLVM early on, it has almost no documentation! it’s not worth it, i learned that the hard way. Even zig replaced their LLVM backend with a C one.

        Also some good libraries for rust:

        Here’s a great list of libraries that can help with building it: https://github.com/Kixiron/rust-langdev

        Good luck with OA :)

        • Val@lemm.eeOP
          link
          fedilink
          arrow-up
          4
          ·
          1 day ago

          Thanks!

          I intend for the language to have a similar borrow checker and type system. Which is why I’m targeting rust. It means I have something to check against when writing the tooling. (Although I’m not sure I’ll get that far. My computer is littered with dead projects).