mirror of
https://github.com/roc-lang/roc.git
synced 2025-12-23 08:48:03 +00:00
* Implement bitwise shifts Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Add low_level_interp shift tests Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Fix wrong test Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Use appropriate byte size for shifts Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Simplify shift left and right interpreter Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Factorize the num_shift_right_zf_by in interpreter Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Add edge cases tests for shifts Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Fix an edge case test Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Truncate shift left to the correct precision Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * Add shift operators to the borrow switch Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> * restore accidental deletions --------- Signed-off-by: Matthieu Pizenberg <matthieu.pizenberg@gmail.com> Co-authored-by: Anton-4 <17049058+Anton-4@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| base | ||
| base58 | ||
| build | ||
| builtins | ||
| bundle | ||
| canonicalize | ||
| check | ||
| cli | ||
| collections | ||
| compile | ||
| eval | ||
| fmt | ||
| fs | ||
| interpreter_shim | ||
| ipc | ||
| layout | ||
| lsp | ||
| parse | ||
| playground_wasm | ||
| PROFILING | ||
| repl | ||
| reporting | ||
| roc_src | ||
| snapshot_tool | ||
| target | ||
| types | ||
| 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:
- run
zls --versionand make sure it is0.15.0(this is still used for zig0.15.2). - run
zls envand grab theconfig_filepath. - Edit the config file to include
{
"enable_build_on_save": true,
"build_on_save_args": ["-Dno-bin", "-fincremental"]
}
- 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. - Optionally, add
-Dfuzzabove as well to get type checking of fuzz scripts as well. - Note, I had to fully delete my
.zig-cacheto getzlsto start. Make sure to check the logs if you aren't getting type failures. - 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
