roc/src
2025-11-16 23:35:05 -05:00
..
base more Result>Try updates (#8382) 2025-11-14 17:10:55 +01:00
base58 Give base58 its own module 2025-08-13 08:20:06 -04:00
build Fix builtin compiler 2025-11-16 23:35:05 -05:00
builtins more Result>Try updates (#8382) 2025-11-14 17:10:55 +01:00
bundle Merge branch 'main' into reader-cleanup 2025-10-26 00:21:39 +02:00
canonicalize Fix some nominal str things 2025-11-16 23:27:48 -05:00
check Fix some nominal str things 2025-11-16 23:27:48 -05:00
cli Remove .str primitive type 2025-11-16 22:59:24 -05:00
collections replacing array_list.Managed with ArrayList with script help 2025-10-23 14:23:32 +00:00
compile Remove .str primitive type 2025-11-16 22:59:24 -05:00
eval Fix some nominal str things 2025-11-16 23:27:48 -05:00
fmt more cli end-to-end tests, fix fmt memory leaks 2025-10-29 19:27:39 +01:00
fs replacing array_list.Managed with ArrayList with script help 2025-10-23 14:23:32 +00:00
interpreter_shim Try renaming Result to Try 2025-10-30 20:50:36 -04:00
ipc fix test/str/app.roc test 2025-10-17 18:18:38 +02:00
layout Fix some nominal str things 2025-11-16 23:27:48 -05:00
parse Add support for :: 2025-11-16 17:13:11 -05:00
playground_wasm Remove .str primitive type 2025-11-16 22:59:24 -05:00
PROFILING Clean up some comments 2025-10-18 19:00:30 -04:00
repl Remove .str primitive type 2025-11-16 22:59:24 -05:00
reporting Merge pull request #8363 from roc-lang/add-more-misspellings 2025-11-10 16:49:43 -05:00
roc_src get rid of all deprecated things 2025-10-01 15:52:56 +02:00
snapshot_tool Remove .str primitive type 2025-11-16 22:59:24 -05:00
types Remove .str primitive type 2025-11-16 22:59:24 -05:00
unbundle fmt 2025-10-01 20:09:06 +02:00
watch replacing array_list.Managed with ArrayList with script help 2025-10-23 14:24:15 +00:00
flake.lock upgrade to zig 0.15.2 2025-10-18 20:30:45 +02:00
flake.nix better nix aliases 2025-10-31 15:03:39 +01:00
README.md upgrade to zig 0.15.2 2025-10-18 20:30:45 +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.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