roc/src
2025-11-27 21:25:29 -05:00
..
base Use a debug helper to detect bad intern isnerts 2025-11-26 20:04:11 -05:00
base58
build Working on implementing List.append in low level interpreter 2025-11-27 21:25:29 -05:00
builtins Working on implementing List.append in low level interpreter 2025-11-27 21:25:29 -05:00
bundle
canonicalize Working on implementing List.append in low level interpreter 2025-11-27 21:25:29 -05:00
check Fix early return from within for loop 2025-11-27 00:02:39 -05:00
cli Fix test on Windows 2025-11-27 09:24:55 -05:00
collections Merge origin/main 2025-11-26 13:15:58 -05:00
compile Fix silent failure str/app.roc (#8472) 2025-11-27 19:13:56 +01:00
eval Working on implementing List.append in low level interpreter 2025-11-27 21:25:29 -05:00
fmt Merge origin/main 2025-11-22 15:45:17 -05:00
fs
interpreter_shim Minor getIdentTextFromAnyStore hack 2025-11-26 18:48:24 -05:00
ipc Merge origin/main 2025-11-22 15:45:17 -05:00
layout Fix silent failure str/app.roc (#8472) 2025-11-27 19:13:56 +01:00
lsp Add experimental LSP written in Zig (#8423) 2025-11-25 13:49:22 +01:00
parse Merge remote-tracking branch 'origin/main' into propagate_is_eq 2025-11-26 16:26:57 -05:00
playground_wasm Merge remote-tracking branch 'origin/main' into propagate_is_eq 2025-11-26 20:31:35 -05:00
PROFILING Get rid of is_ne again 2025-11-26 22:56:22 -05:00
repl Merge remote-tracking branch 'origin/main' into propagate_is_eq 2025-11-26 20:31:35 -05:00
reporting Merge remote-tracking branch 'origin/main' into fix-dbg-bug 2025-11-26 12:34:30 -05:00
roc_src
snapshot_tool More fixes 2025-11-26 14:11:01 -05:00
types Merge remote-tracking branch 'origin/main' into propagate_is_eq 2025-11-26 13:29:54 -05:00
unbundle
watch
flake.lock
flake.nix
README.md

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.2).
  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