Stream: beginners

Topic: ✔ Is there a `libroc` one can use to compile roc code?


view this post on Zulip Lukas Hermann (Dec 08 2025 at 01:24):

Hi all, I was curious if there is a way to link to the roc compiler so that I can embed it in a program?

view this post on Zulip Lukas Hermann (Dec 08 2025 at 01:25):

I recognize that the new compiler is still immature so this could be a "nice to have" in the future.

view this post on Zulip Luke Boswell (Dec 08 2025 at 01:34):

There are plans for a libroc though we don't have a library published or easy to use yet

view this post on Zulip Notification Bot (Dec 08 2025 at 01:35):

Lukas Hermann has marked this topic as resolved.

view this post on Zulip Luke Boswell (Dec 08 2025 at 01:37):

Currently for the roc WASM playground we compile various roc modules using zig, so we know there are minimal dependencies and everything works nicely cross-platform (U32/U64 etc).

The zig modules are available via github, which is how I use the builtins in the zig platform template. So in theory it should be pretty easy to embed the whole compiler, the challenges at the moment comes from the BuildEnv which is used to schedule and compile all the different .roc files.

view this post on Zulip Luke Boswell (Dec 08 2025 at 01:38):

Is there a particular reason you want to embed the compiler and not just a compiled roc app?

view this post on Zulip Luke Boswell (Dec 08 2025 at 01:39):

In this PR https://github.com/roc-lang/roc/pull/8548 that I'm currently working on, we introduce another interpreter shim so roc (cli) can build standalone binaries even before we have the functionality to lower to machine code in the compilation pipeline

view this post on Zulip Lukas Hermann (Dec 08 2025 at 01:52):

Luke Boswell said:

Is there a particular reason you want to embed the compiler and not just a compiled roc app?

It’s kind of a “it would be cool if I could do this” idea. There’s a creative software called TouchDesigner which has Python and GLSL nodes. I was thinking it would be a fun project to try to make a Roc node and platform


Last updated: Dec 21 2025 at 12:15 UTC