roc/src
2025-10-06 22:22:24 -04:00
..
base Process type decls separately, generalize, then inst in annos 2025-09-30 17:44:45 -04:00
base58 Give base58 its own module 2025-08-13 08:20:06 -04:00
build Fix tag ext and number layouts 2025-09-30 17:47:03 -04:00
builtins Roc platform host shim (#8214) 2025-09-09 13:15:23 +02:00
bundle Give base58 its own module 2025-08-13 08:20:06 -04:00
canonicalize zig fmt 2025-10-06 17:01:23 -04:00
check Refactor out ValidationContext 2025-10-06 10:44:41 -04:00
cli Refactor out ValidationContext 2025-10-06 10:44:41 -04:00
collections Merge pull request #8179 from roc-lang/downloads 2025-08-16 14:01:35 -04:00
compile Introduce ModuleKind 2025-10-06 11:33:24 -04:00
eval Refactor out ValidationContext 2025-10-06 10:44:41 -04:00
fmt Add type modules 2025-10-04 14:44:54 -04:00
fs Update README's 2025-08-12 18:26:26 +10:00
interpreter_shim Fix CI 2025-09-27 07:57:29 -04:00
ipc Update README's 2025-08-12 18:26:26 +10:00
layout Fix last compile issues 2025-10-02 21:00:46 -04:00
parse Add nested types 2025-10-06 16:44:17 -04:00
playground_wasm Refactor out ValidationContext 2025-10-06 10:44:41 -04:00
PROFILING update exec_bench.roc to basic-cli 0.20 (#8243) 2025-09-09 18:30:27 +02:00
repl Clean up some obsolete comments 2025-10-06 10:50:16 -04:00
reporting Try removing timeouts 2025-08-17 10:15:43 -04:00
roc_src Fix lints 2025-09-13 00:18:03 -04:00
snapshot_tool Restore type=snippet 2025-10-06 22:22:24 -04:00
types Fix playground compile 2025-09-30 17:47:04 -04:00
unbundle Fix CI 2025-08-15 15:36:25 -04:00
watch Update watch.zig 2025-08-18 01:41:52 +10:00
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.14.0 (this is still used for zig 0.14.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