Skip to content
CAI
Software that uses CAICheck a score

cucapra/dahlia

64.5

Adequate · 20 September 2026

7.6k

lines of production code

Scala

primary language

1

measurement over time

CAI band scale
CAI lens gauges

What this system is

Dahlia is a compiler system for the Fuse programming language that translates high-level array and linear algebra operations into executable C++ code or hardware descriptions for FPGAs via Calyx and Vivado backends. It provides a complete toolchain including a Scala-based parser, type checker, and lowering passes, alongside utilities for JSON data handling, memory access visualization, and IDE integration. The system supports a range of numeric types and array manipulations, enabling users to generate and run standalone kernels or synthesize hardware designs from source code.

How it got here

2018–2019 — Compiler infrastructure and backend expansion

16 changes.

This period focused on rebuilding the Dahlia compiler's core infrastructure, replacing the initial OCaml-based execution model with a C++ backend and introducing a new Calyx backend with source-level debugging. Significant work included implementing a formal type system with subtyping, adding a fastparse-based parser, and developing tools for array access visualization and Emacs syntax highlighting.

2020–2025 — test coverage expansion and backend fixes

9 changes.

This period focused on significantly expanding test coverage for the compiler's C++, Vivado, and FuTIL backends by adding extensive expectation files and input data for various algorithms and language features. It also included specific fixes to the Calyx backend to correctly handle signed binary operations and updated test expectations for signed primitives and fixed-point constants. Additionally, a Vim syntax highlighting plugin was added to improve the development experience for Fuse files.

Features

Added Emacs support for Fuse language syntax highlighting and indentation

Users can now edit Fuse source files in Emacs with basic syntax highlighting and indentation support. This change introduces a new \fuse-mode\ major mode that highlights keywords, types, and booleans, and provides auto-indentation based on brace nesting. The mode automatically activates for files with \.fuse\ or \.ifuse\ extensions and includes specific instructions for integration with Spacemacs.

tools/emacs · high confidence

Added syntax highlighting for Fuse files in Vim

Vim users can now get syntax highlighting for \*.fuse files. This change introduces a new Vim plugin located at tools/vim/fuse that detects the fuse file type and applies syntax rules for constants, types, keywords, and comments, installable via Pathogen or by copying the directory to \~/.vim/bundle.

tools/vim · high confidence

Initial project structure and build configuration for Dahlia

This change introduces the foundational build and configuration files for the Dahlia programming language and its Fuse compiler. It adds a Makefile for building and installing the project via sbt, a .scalafmt.conf for Scala code formatting, and a LICENSE file (MIT). The repository now includes a 'fuse' symlink pointing to the Scala 3.3.1 fat JAR, a .gitignore tailored for Scala and development tools, and a runt.toml configuration defining integration tests for compilation and execution. Additionally, a .hook.yaml is added for deployment automation, and the README.md is updated with setup instructions and documentation links.

(repo-wide) · high confidence

Introduce \`fuse run\` command for direct executable generation

Users can now compile and link C++ programs directly using the new \fuse run\ subcommand, which automatically handles header extraction and invokes the C++ compiler. This replaces the previous workflow of generating source code and manually compiling it, streamlining the process for the C++ backend.

src/main/scala · high confidence

Introduce new parser and Calyx backend with source-level debugging support

The repository now uses a new \fastparse\-based parser (replacing the previous implementation) and includes a new Calyx backend alongside the existing Vivado and C++ backends. The Calyx backend generates source-level debugging information by emitting \@pos\ annotations and a \sourceinfo\ block that maps source line numbers to generated Calyx control nodes. Additionally, the new parser supports explicit type casting syntax (\expr as type\), hexadecimal and octal integer literals, and array/record compound literals.

repository · high confidence

Introduces new compiler infrastructure for checking, transformation, and pretty-printing

The \src/main/scala/common\ directory now includes foundational compiler components: a \Checker\ framework for collecting information via side effects without modifying the AST, a \Transformer\ for rewriting AST nodes while preserving source positions, and a \Pretty\ module for generating human-readable Dahlia source code. Additionally, \CodeGenHelpers\ provides peephole optimizations for arithmetic and bitwise operations, and \Logger\ configures the scribe logging framework with position-aware output.

src/main/scala/common · high confidence

Launch of new Dahlia documentation website

The project documentation has been migrated to a new Docusaurus-based website titled 'Dahlia', featuring a Cornell red color scheme and syntax highlighting for the Dahlia language. The site includes an overview, installation guide, language construct references (cheatsheet, literals, binders, types), CLI usage instructions, and tools documentation. It also introduces copy-to-clipboard functionality for code blocks and organizes content via a structured sidebar navigation.

website · high confidence

New JSON data parser implementation

A new C++ source file (parser.cpp) has been added to the resources headers, introducing a JSON data parser that utilizes the nlohmann/json library. This component reads JSON data from a specified file path, handles parsing errors, and provides a generic flattening utility for multi-dimensional vectors, enabling the application to process structured input data more robustly.

src/main/resources · high confidence

New array access visualizer tool with banking support

A new Racket-based tool has been added to visualize array memory accesses, specifically highlighting how data is distributed across memory banks. The library provides a \let/matrix\ macro to define arrays with optional bank configurations (e.g., \\#:bank\), and supports visualizing access patterns from \for\ and \while\ loops. It generates graphical outputs (PNG/PDF) showing marked matrix elements and bank shading, with examples including GEMM blocked operations and split-view scenarios.

tools/array-access-visualizer · high confidence

New documentation website with copy-to-clipboard code blocks and compiler diagram

The documentation site has been rebuilt, setting the overview page as the default landing page via a redirect in the static index. The site now includes a compiler architecture diagram (dahlia-compiler.svg) and adds copy-to-clipboard buttons to all fenced code blocks, implemented through new JavaScript and CSS assets that inject buttons into syntax-highlighted code elements.

website/static · high confidence

Removals

Removal of initial parser, lexer, and AST definitions

The initial implementation of the language's core infrastructure has been removed. This includes the abstract syntax tree (AST) definitions, the lexer (lexer.mll), the parser (parser.mly), the build configuration (jbuild), and the helper module (make\_ast.ml). Consequently, the ability to parse and interpret simple variable assignments (e.g., \let x = 5;\) is no longer available in this location, as these files have been deleted.

src · high confidence

Behavioural changes

Documentation moved to notes/ with build tooling

The project documentation has been relocated from docs/ to notes/. This change introduces a new build system using Pandoc to compile Markdown sources into HTML, complete with a Makefile for generation and deployment, a modd configuration for live reloading, and supporting assets like CSS, HTML templates, and Racket scripts for generating diagrams.

notes · high confidence

New type system with subtyping and join operations

The typechecker now implements a formal subtyping hierarchy for numeric types (including sized integers, static integers, indices, floats, doubles, rationals, and fixed-point numbers) and defines join operations to determine result types for binary operators. This change introduces a new \Subtyping.scala\ module that handles type equality, subtype checks, and least upper bound calculations, while \TypeCheck.scala\ uses these relations to validate expressions, function arguments, and casts, ensuring that operations like comparisons and arithmetic adhere to the new type rules.

src/main/scala/typechecker · high confidence

Refactored C++ backend structure and added executable runnable support

The C++ code generation logic has been restructured to separate common functionality into a new \CppLike\ trait, which handles generic C++ emission (loops, expressions, types) and is now extended by specific backends. The \VivadoBackend\ has been moved out of this location to focus on FPGA-specific generation, while a new \CppRunnable\ backend has been introduced to generate standalone, executable C++ code. This new backend automatically parses input data from JSON, serializes results back to JSON, and includes necessary headers, allowing users to run generated kernels directly with GCC without external harnesses.

src/main/scala/backends · high confidence

Replace OCaml executable with Bash wrapper for C++ backend

The project has shifted from an OCaml-based execution model to a C++ backend workflow. The previous OCaml executable (bin/ex.ml) and its build configuration (bin/jbuild) have been removed. In their place, a new shell script (bin/run-dahlia) has been introduced to orchestrate the compilation and execution of Dahlia programs. This script invokes the 'fuse' tool to generate C++ code, compiles it, and then runs the resulting binary with associated JSON data files.

bin · high confidence

Updated FuTIL backend test expectations for signed operations, fixed-point constants, and multi-cycle groups

The test suite in \file-tests/should-futil\ has been updated to reflect changes in the Calyx backend's code generation. New and modified \.expect\ files verify that signed binary operations now correctly emit signed primitives (e.g., \std\_sadd\), fixed-point constants are properly instantiated with their specific bit-widths, and multi-cycle fixed-point operations utilize pipelined primitives like \std\_fp\_mult\_pipe\. Additionally, the tests confirm correct handling of multi-dimensional array indexing, function invocations with memory arguments, and the sequentialization of reduce loops.

file-tests/should-futil · high confidence

Fixes

Fix Calyx backend signed binary operation emission

The Calyx backend now correctly handles signed binary operations, addressing a previous issue where signed arithmetic was not emitted properly. This change ensures that operations involving signed integers and fixed-point numbers generate the correct Calyx code, preventing potential runtime errors or incorrect results for programs relying on signed arithmetic.

src/main/scala/backends/calyx · high confidence

Test coverage

Added expected output files for C++ and Vivado backend tests; Added lowering tests for memory banks, unrolling, and fixed-point types; Added parent-map test fixtures for block, dot-product, and nested loops; Added parser and type checker test suites; Added test expectation and input data files for various algorithms; Expanded test coverage for language features and backend capabilities; Updated lowering test expectations for hoisting, scoping, and sequentialization.

Dependencies

Upgrade to Scala 3.3.1 and update project dependencies

The project has migrated to Scala 3.3.1 LTS, requiring users to have a compatible Scala 3 environment. Several library dependencies have been updated or added, including ScalaTest 3.2.18, scala-parser-combinators 2.0.0, fastparse 3.0.2, scopt 4.0.1, scribe 3.5.5, and sourcecode 0.2.7. The build configuration now includes fatal warnings and new syntax options, and the project name has been changed to 'Dahlia'. Additionally, the website dependencies have been updated to use Docusaurus version 1.11.1.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Baseline

  • First survey — no prior run to compare against. CAI 64.

Lenses

  • Code Health 92
  • Architecture 100
  • Maturity 53
  • Readiness 55
  • Security 95

Changes since last survey

  • 300 commits — 254 feature/other, 46 fixes

By area

  • src/main — 166 commits
  • (repo) — 38 commits
  • file-tests/should-futil — 31 commits
  • (root) — 19 commits
  • file-tests/should-lower — 7 commits
  • file-tests/cpp-out — 5 commits
  • file-tests/should-run — 5 commits
  • .github/workflows — 4 commits
  • docs/cheat.md — 4 commits
  • file-tests/data — 4 commits
  • src/test — 4 commits
  • tools/vim — 4 commits
  • file-tests/parent-map — 3 commits
  • docs/array-access-visualizer.md — 1 commit
  • docs/install.md — 1 commit
  • docs/overview.md — 1 commit
  • file-tests/lower-data — 1 commit
  • file-tests/should-lower-run — 1 commit
  • project/build.properties — 1 commit

Notable commits

  • fix: Add support for fixed point multi-cycle binary operations. (#366)
  • fix: Deprecate and remove Calyx fixed point with different widths. (#386)
  • fix: Deprecate fixed point constants in Dahlia. (#362)
  • fix: Fix Calyx backend issue with emitting signed binops (#430)
  • fix: Fix JSON parent-map output and modify commands that shouldn't be added to the list
  • fix: Fix Seq Mem Ports (#401)
  • fix: Fix emitting groups that don't have annotations, add pos to cond groups
  • fix: Fix for blocks and lets in parent map
  • fix: Fix issue in C++ backend when passing let variable to functions (#414)
  • fix: Fix ordering. (#354)
  • fix: Fix parsing issue of hex numbers in cast expr (#412)
  • fix: Fix timing bug with multi-cycle. (#371)
  • fix: Fix url for DrRacket (#377)
  • fix: Hacky fix.
  • fix: Hoisting Fixes (#363)
  • fix: Merge branch 'fix-ci' into update-optimized-positions
  • fix: Merge pull request #397 from cucapra/bug-fix
  • fix: Merge pull request #432 from cucapra/fix-ci
  • fix: Merge pull request #437 from cucapra/parent-map-fix
  • fix: Revert "Generate comb groups for Calyx backend"
  • …and 280 more

Architecture

  • 0 containers · 1 bounded contexts · 0 dependency edges (baseline)

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

cucapra/dahlia was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 20 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit bd68b131ee14f46dd9d2099f86ead01f7d756a71 — the exact code this score is about.
  • Scored under rubric-2026.09.15 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-b51f968c9b10.