Live data from Hacker News

LLVM from a Go Perspective

aykevl.nl

1–10 of 15 posts

Re: LLVM from a Go Perspective

#2
Hmm, not sure I agree that LLVM has little documentation. My experience using it has been pretty smooth.

Regardless, compiling functions from a language you know to LLVM IR is a good way to learn how IR works. You can do this for C(++) with the clang --emit-llvm switch. In addition, many optimizers in LLVM are geared towards the IR patterns clang emits.

Re: LLVM from a Go Perspective

#3
> compiler libraries such as LLVM make this a whole lot easier, making it possible for a single person to develop a new language that is close to C in terms of performance.

The TinyGo project is interesting, but it is not a new language developed by a single person as Go is not a new language.

Wondering is there any such single person project implementing a compiler for a new language using LLVM and delivering close to C performance?

Re: LLVM from a Go Perspective

#4
post #2

Hmm, not sure I agree that LLVM has little documentation. My experience using it has been pretty smooth. Regardless, compiling functions from a language you know to LLVM IR is a good way to learn how IR works. You can do this for C(++) with the clang --emit-llvm switch. In addition, many optimizers in LLVM are geared towards the IR patterns clang emits.

If you're working at the IR level, then there's usually pretty good documentation in terms of the doxygen and various pages explaining things.

But if you start venturing down into the backend, a lot of gotchas are never documented anywhere, just somehow learned through osmosis from another backend author or looking up code snippets from another implemented backend.

Re: LLVM from a Go Perspective

#5
post #3

> compiler libraries such as LLVM make this a whole lot easier, making it possible for a single person to develop a new language that is close to C in terms of performance. The TinyGo project is interesting, but it is not a new language developed by a single person as Go is not a new language. Wondering is there any such single person project implementing a compiler for a new language using LLVM and delivering close…

xtlang is one; ML meets C with S-expressions and hot reloading.

https://extemporelang.github.io/docs/reference/types/

edit: link is more specific now

Re: LLVM from a Go Perspective

#6
post #4
post #2

Hmm, not sure I agree that LLVM has little documentation. My experience using it has been pretty smooth. Regardless, compiling functions from a language you know to LLVM IR is a good way to learn how IR works. You can do this for C(++) with the clang --emit-llvm switch. In addition, many optimizers in LLVM are geared towards the IR patterns clang emits.

If you're working at the IR level, then there's usually pretty good documentation in terms of the doxygen and various pages explaining things. But if you start venturing down into the backend, a lot of gotchas are never documented anywhere, just somehow learned through osmosis from another backend author or looking up code snippets from another implemented backend.

Sure; the article was about building compilers rather than backends. FWIW I looked briefly into building a LLVM backend (IR subset) for a DSP chip, and gave up partly for the reasons you mentioned.

Re: LLVM from a Go Perspective

#7
post #3

> compiler libraries such as LLVM make this a whole lot easier, making it possible for a single person to develop a new language that is close to C in terms of performance. The TinyGo project is interesting, but it is not a new language developed by a single person as Go is not a new language. Wondering is there any such single person project implementing a compiler for a new language using LLVM and delivering close…

Meet Wren: https://github.com/wren-lang/wren

Re: LLVM from a Go Perspective

#8
post #3

> compiler libraries such as LLVM make this a whole lot easier, making it possible for a single person to develop a new language that is close to C in terms of performance. The TinyGo project is interesting, but it is not a new language developed by a single person as Go is not a new language. Wondering is there any such single person project implementing a compiler for a new language using LLVM and delivering close…

https://ziglang.org/

As far as I know, it's mostly Andrew Kelley[1] working on Zig, though it seems to be growing quickly now!

[1] https://andrewkelley.me/post/full-time-zig.html

Re: LLVM from a Go Perspective

#9
post #3

> compiler libraries such as LLVM make this a whole lot easier, making it possible for a single person to develop a new language that is close to C in terms of performance. The TinyGo project is interesting, but it is not a new language developed by a single person as Go is not a new language. Wondering is there any such single person project implementing a compiler for a new language using LLVM and delivering close…

Meet Wren: https://github.com/wren-lang/wren

Any reference for C-like performance?

Re: LLVM from a Go Perspective

#10
post #3

> compiler libraries such as LLVM make this a whole lot easier, making it possible for a single person to develop a new language that is close to C in terms of performance. The TinyGo project is interesting, but it is not a new language developed by a single person as Go is not a new language. Wondering is there any such single person project implementing a compiler for a new language using LLVM and delivering close…

Not a new language, as it’s based on/similar to Ruby syntax, but the latter is interpreted while this one is built from the ground up for compilation/LLVM:

https://crystal-lang.org

Post reply on HN