roc/src
2025-12-08 20:11:42 +11:00
..
base Fix Windows CI 2025-12-06 08:14:05 -05:00
base58 More cleanups 2025-12-04 08:23:41 -05:00
build Add List.count_if 2025-12-07 13:32:14 -05:00
builtins Clean up some comments 2025-12-04 09:56:53 -05:00
bundle Delete a ton of unused arguments 2025-12-04 01:45:48 -05:00
canonicalize Make a test less hardcoded 2025-12-04 22:36:44 -05:00
check use items[0] 2025-12-04 22:28:30 -05:00
cli add debug info and flag 2025-12-08 20:09:31 +11:00
collections Rename .zero to .first 2025-12-04 21:00:35 -05:00
compile Remove more hardcoded enum values 2025-12-04 21:30:21 -05:00
eval fix infinite loop 2025-12-06 08:29:39 -05:00
fmt Merge remote-tracking branch 'origin/fix-inspect' into ranges 2025-12-04 11:24:53 -05:00
fs Clean up some comments 2025-12-04 09:56:53 -05:00
interpreter_shim working roc build 2025-12-02 21:13:26 +11:00
ipc Merge remote-tracking branch 'remote/main' into roc-build 2025-12-08 11:37:35 +11:00
layout Clean up some comments 2025-12-04 09:56:53 -05:00
lsp zig lints -- add doc comments for LSP modules 2025-12-08 20:11:42 +11:00
parse Merge remote-tracking branch 'remote/main' into roc-build 2025-12-08 11:37:35 +11:00
playground_wasm Clean up some comments 2025-12-04 09:56:53 -05:00
PROFILING
repl Merge remote-tracking branch 'origin/main' into ranges 2025-12-04 18:46:57 -05:00
reporting
roc_src
snapshot_tool Clean up some comments 2025-12-04 09:56:53 -05:00
types Rename .zero to .first 2025-12-04 21:00:35 -05:00
unbundle Delete a ton of unused arguments 2025-12-04 01:45:48 -05:00
watch Clean up some comments 2025-12-04 09:56:53 -05:00
flake.lock
flake.nix Fix typo in flake.nix: testscmd -> testcmd 2025-12-05 00:16:21 -05:00
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