roc/src
2025-10-14 13:55:37 +02:00
..
base Removed last deprecated things. 2025-10-01 18:08:47 +02:00
base58 Give base58 its own module 2025-08-13 08:20:06 -04:00
build mrege fix progress: 59/63 steps succeeded 2025-09-30 19:19:34 +02:00
builtins fmt 2025-10-01 20:09:06 +02:00
bundle rename, fix hash [skip ci] 2025-10-14 13:55:37 +02:00
canonicalize fix snapshots 2025-09-26 16:12:27 +02:00
check fmt 2025-10-01 20:09:06 +02:00
cli fmt 2025-10-01 20:09:06 +02:00
collections Update alignedAlloc and other functions to use std.mem.Alignment instead of ints 2025-09-07 02:29:16 -05:00
compile Removed last deprecated things. 2025-10-01 18:08:47 +02:00
eval fmt 2025-10-01 20:09:06 +02:00
fmt fmt 2025-10-01 20:09:06 +02:00
fs get rid of depracatedWriter/Reader 2025-09-27 18:36:01 +02:00
interpreter_shim Merge branch 'main' of github.com:roc-lang/roc into upgrade-to-zig-0.15.1 2025-09-30 16:40:03 +02:00
ipc Replace allocPrintZ with allocPrint and an explcit null terminator 2025-09-07 20:35:28 -05:00
layout mrege fix progress: 59/63 steps succeeded 2025-09-30 19:19:34 +02:00
parse fix playground_wasm 2025-10-02 17:32:29 +02:00
playground_wasm fix playground_wasm 2025-10-02 17:32:29 +02:00
PROFILING update exec_bench.roc to basic-cli 0.20 (#8243) 2025-09-09 18:30:27 +02:00
repl fmt 2025-10-01 20:09:06 +02:00
reporting fix playground_wasm 2025-10-02 17:32:29 +02:00
roc_src get rid of all deprecated things 2025-10-01 15:52:56 +02:00
snapshot_tool Removed last deprecated things. 2025-10-01 18:08:47 +02:00
types Merge branch 'main' of github.com:roc-lang/roc into upgrade-to-zig-0.15.1 2025-09-30 16:40:03 +02:00
unbundle fmt 2025-10-01 20:09:06 +02:00
watch Update alignedAlloc and other functions to use std.mem.Alignment instead of ints 2025-09-07 02:29:16 -05:00
flake.lock update flake 2025-09-22 15:47:07 +02:00
flake.nix update flake 2025-09-22 15:47:07 +02:00
README.md use zig 15 2025-10-01 20:13:16 +02:00

Roc Compiler (Zig Implementation)

Navigation

Core compiler directories:

  • base/ - Core data structures and utilities shared across the compiler
  • check/ - Main compilation pipeline (parsing, canonicalization, type checking)
  • types/ - Type system definitions and utilities
  • builtins/ - Built-in types, functions, and operations
  • reporting/ - Error reporting and diagnostic formatting
  • collections/ - Efficient data structures used throughout the compiler
  • cache/ - Compilation caching system for faster incremental builds
  • coordinate/ - Cross-module compilation coordination and dependency management
  • eval/ - Runtime evaluation and interpretation system
  • fs/ - Filesystem operations and file I/O utilities
  • layout/ - Memory layout computation and management for code generation
  • serialization/ - Serialization utilities for compiler data structures
  • snapshots/ - Snapshot tests validating compiler behavior across all stages

Status

This table provides a summary of progress for the zig compiler re-write and should be updated with the PR that includes new features.

Str & Num Functions Modules Collections Records & Tuples Recursive Types Static Dispatch
Parse 🔋 🔋 🪫 🪫 🔋 🪫 🚧
Canonicalize 🪫 🪫 🪫 🪫 🪫 🪫 🚧
Resolve Imports 🚧 🚧 🪫 🚧 🚧 🚧 🚧
Check Types 🪫 🚧 🚧 🚧 🚧 🚧
Interpreter
Specialize Types
Lift Functions
Solve Functions
Specialize Functions
Reference Counting
Lower IR
Gen LLVM
  • N/A Not applicable
  • 🚧 Work Started
  • 🪫 Tests Passing
  • 🔋 Polished

Fast Feedback Loop

The roc zig compiler can have a very fast feedback loop. We support zigs incremental compilation and watch mode. By avoiding generating final executables, we can build and typecheck much much faster.

Try it with zig build -Dno-bin -fincremental --watch

Expanding to ZLS

This fast config can also be used with zls. Simply follow these steps:

  1. run zls --version and make sure it is 0.15.0 (this is still used for zig 0.15.1).
  2. run zls env and grab the config_file path.
  3. Edit the config file to include
{
  "enable_build_on_save": true,
  "build_on_save_args": ["-Dno-bin", "-fincremental"]
}
  1. Advised, also changing the cache dir, I use --cache-dir .zig-cache/zls. Otherwise, zig commands run manually can lead to the lsp breaking and requiring a restart.
  2. Optionally, add -Dfuzz above as well to get type checking of fuzz scripts as well.
  3. Note, I had to fully delete my .zig-cache to get zls to start. Make sure to check the logs if you aren't getting type failures.
  4. Enjoy better lsp results.

Simply testing feedback loop

Sadly, this is not nearly as fast due to building binaries. One day, we will get dev zig backends, and it should be fast.

Try it with zig build test -fincremental --watch

Overview

Zig Dependency Graph