About a year ago, I played a bit with writing a programming language. That’s quite a fun journey. If you want to go that way, there are a few helpful links:

As the compiler language I had chosen Python because it’s pretty good for fast prototyping and there is no need to care about compilation performance (nobody’s going to use your language anyway).

As the compilation target I had picked LLVM, it is low-level enough to give interesting challenges but not too low-level. Also, LLVM is better than FIRM, WASM, Go AST, and similar just because it has more documentation, tutorials, even books. However, the documentation is for smart people and mostly for C++, I didn’t get anything helpful from it.

There are the libraries I was using for my compiler:

  • lark is great for writing parsers.
  • llvmlite is good enough for generating LLVM code, nothing better is there for Python anyway.

If you want to use another language for the compiler (especially a functional one) without a good parsing library, I’d go with a parser combinator. Serious languages don’t use it because of a bad performance and picking a random interpretation in case of an ambiguity. But if you just want to have fun, who cares.