roc/src
2025-09-06 21:12:33 -05:00
..
base rename std.ArrayListUnmanaged to std.ArrayList 2025-09-06 20:48:49 -05:00
base58 Give base58 its own module 2025-08-13 08:20:06 -04:00
build Change std.io.getStdErr() to std.fs.File.stderr() and use deprecatedWriter instead of writer 2025-09-06 21:12:29 -05:00
builtins Change std.io.getStdIn to std.fs.File.stdin 2025-09-06 21:12:33 -05:00
bundle Rename .C calling convention to .c 2025-09-06 20:52:08 -05:00
canonicalize rename std.ArrayListUnmanaged to std.ArrayList 2025-09-06 20:48:49 -05:00
check rename std.ArrayList to std.array_list.Managed 2025-09-06 20:47:40 -05:00
cli Change std.io.getStdErr() to std.fs.File.stderr() and use deprecatedWriter instead of writer 2025-09-06 21:12:29 -05:00
collections rename std.ArrayListUnmanaged to std.ArrayList 2025-09-06 20:48:49 -05:00
compile Change std.io.getStdErr() to std.fs.File.stderr() and use deprecatedWriter instead of writer 2025-09-06 21:12:29 -05:00
eval Change std.io.getStdErr() to std.fs.File.stderr() and use deprecatedWriter instead of writer 2025-09-06 21:12:29 -05:00
fmt Change std.io.getStdIn to std.fs.File.stdin 2025-09-06 21:12:33 -05:00
fs rename std.ArrayListUnmanaged to std.ArrayList 2025-09-06 20:48:49 -05:00
interpreter_shim Change std.io.getStdErr() to std.fs.File.stderr() and use deprecatedWriter instead of writer 2025-09-06 21:12:29 -05:00
ipc Update README's 2025-08-12 18:26:26 +10:00
layout rename std.ArrayList to std.array_list.Managed 2025-09-06 20:47:40 -05:00
parse rename std.ArrayListUnmanaged to std.ArrayList 2025-09-06 20:48:49 -05:00
playground_wasm Rename .C calling convention to .c 2025-09-06 20:52:08 -05:00
PROFILING find . -name \*.png | parallel --bar optipng -o 7 {} (#8233) 2025-08-30 11:17:11 +02:00
repl Rename .C calling convention to .c 2025-09-06 20:52:08 -05:00
reporting Change std.io.getStdOut() to std.fs.File.stdout() and use deprecatedWriter instead of writer 2025-09-06 21:02:34 -05:00
snapshot_tool Change std.io.getStdErr() to std.fs.File.stderr() and use deprecatedWriter instead of writer 2025-09-06 21:12:29 -05:00
types rename std.ArrayList to std.array_list.Managed 2025-09-06 20:47:40 -05:00
unbundle rename std.ArrayList to std.array_list.Managed 2025-09-06 20:47:40 -05:00
watch Rename .C calling convention to .c 2025-09-06 20:52:08 -05:00
flake.lock new compiler flake (#7950) 2025-07-11 13:38:02 +02:00
flake.nix new compiler flake (#7950) 2025-07-11 13:38:02 +02:00
README.md add more directory documentation 2025-07-13 13:42:59 +10: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.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