From Nim's point of view, it's a backend just like C or JavaScript - from LLVM's point of view, it's a language frontend that emits IR. When I started

GitHub - arnetheduck/nlvm: LLVM-based compiler for the Nim language

submited by
Style Pass
2022-06-22 14:00:14

From Nim's point of view, it's a backend just like C or JavaScript - from LLVM's point of view, it's a language frontend that emits IR.

When I started on this little project, I knew neither llvm nor Nim. Therefore, I'd specially like to thank the friendly folks at the #nim channel that never seemed to tire of my nooby questions. Also, thanks to all tutorial writers out there, on llvm, programming and other topics for providing such fine sources of copy-pa... er, inspiration!

We will need a few development libraries installed, mainly due to how nlvm processes library dependencies (see dynlib section below):

You can link statically to LLVM to create a stand-alone binary - this will use a more optimized version of LLVM as well, but takes longer to build:

When compiling, nlvm will generate a single .o file with all code from your project and link it using $CC - this helps it pick the right flags for linking with the C library.

Leave a Comment