Skip to content
CAI
Software that uses CAICheck a score

com-lihaoyi/fastparse

52.5

Adequate · 28 September 2026

14.1k

lines of production code

Scala

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

This system is a high-performance, cross-platform parsing library built on the fastparse framework, designed to parse various programming languages and data formats. It provides dedicated parsers for CSS, Python, and Scala, leveraging macro-based optimizations for speed and supporting Scala 2.12, 2.13, and 3 across JVM, Scala.js, and Native targets. The project includes comprehensive test suites and benchmarks to validate parsing accuracy and performance against real-world codebases.

How it got here

2014–2018 — multi-language parser expansion and infrastructure

22 changes.

The project expanded its core fastparse library to support Scala 3 and streaming input while implementing initial parsers for CSS and Python 2. This period also involved significant infrastructure work, including migrating the build system to Mill and establishing comprehensive performance benchmarks and test suites across multiple platforms.

2021–2024 — Scala 3 support and performance optimization

8 changes.

The project introduced native support for Scala 3, utilizing inline macros and extension methods to enhance parsing performance and integration with modern compiler features. Concurrently, the codebase was refactored to consolidate macro implementations for improved efficiency and expanded compatibility across Scala 2.12, 2.13, and native targets. Extensive regression tests were added to ensure stability against real-world Scala codebases.

Features

Add interactive JavaScript demo for parsing examples

A new Scala.js-based demo application (DemoMain) has been added to the project, providing an interactive web interface where users can test various parsers including Scala, math, JSON, CSS, and Python. The demo exposes these parsing capabilities to the browser via JS exports, allowing real-time evaluation of input strings against the respective parser rules and displaying success results or detailed failure traces directly in the UI.

demo · high confidence

Added benchmark suite for CSS, JSON, Jsonnet, Python, and Scala parsing

The \perftests/bench2\ directory now includes a new set of performance benchmarks for parsing CSS, JSON, Jsonnet, Python, and Scala source files. These tests utilize the \fastparse\ library to measure parsing speed and buffer behavior against various input datasets, providing a standardized way to evaluate parser performance improvements.

perftests/bench2 · high confidence

Added native-specific character predicate utilities

A new \CharPredicates\ object has been introduced in the native source directory to provide fast, pre-computed character predicates (such as \isLetter\, \isDigit\, and \isPrintableChar\) optimized for the native target. This implementation uses bitwise operations for letter detection and explicitly excludes Unicode SPECIAL block characters to align with Scala.js limitations, ensuring consistent parsing behavior across platforms.

fastparse/src-native · high confidence

Added performance benchmarks for CSS, JSONnet, Python, and Scala parsing

The \perftests/bench1\ module now includes a suite of performance benchmarks for parsing various languages and formats. This adds specific test suites for CSS (using \bootstrap.css\), JSONnet (using a cross-validation set of files like \prometheus.jsonnet\), Python (using \cross\_validation.py\), and Scala (using \GenJSCode.scala\). The benchmarks utilize a custom \FastParseParser\ implementation for JSONnet and standard parsers for the other formats, measuring parse performance against real-world input files.

perftests/bench1 · high confidence

Added performance benchmarks for JSON, Python, and Scala parsing

New benchmark suites have been added to the \perftests/compare\ module to measure parsing performance across different libraries. The \JsonBench\ suite compares \fastparse\ against \circe\, \argonaut\, \ujson\, \json4s\, \play\, and \combinators\ using a sample JSON file. The \PythonBench\ suite benchmarks \fastparse\ against \jython\ using a Python source file. The \ScalaBench\ suite compares \fastparse\ against \scalac\ (via \ScalacParser\) using a Scala source file. These benchmarks allow users to see how \fastparse\'s parsing speed compares to other popular parsers in their respective domains.

perftests/compare · high confidence

Added performance test resources for fastparse and Kubernetes monitoring stacks

The \perftests/resources\ directory has been populated with a new set of benchmark input files. This includes \GenJSCode.scala\, a large Scala source file used to test the fastparse library's parsing performance. Additionally, numerous \.jsonnet\ files have been added to provide complex configuration templates for Kubernetes monitoring components, including Prometheus, Grafana, Alertmanager, Kube-state-metrics, Nginx, and OAuth2-proxy, alongside supporting assets like \bootstrap.css\ and \cross\_validation.py\.

perftests · high confidence

Fastparse library source for Scala 2 is introduced

The core parsing library source code for Scala 2 is now available in the \fastparse/src-2/fastparse\ directory. This package defines the primary API entry points, including the \P\ type alias and macro-based combinators for sequence (\\~\, \\~/\), alternation (\\|\), repetition (\rep\), and transformation (\map\, \flatMap\). It also provides implicit conversions that enable extension methods on \String\ and \P\ types, allowing users to write declarative parsing expressions with features like whitespace handling, capturing, and optional matching.

fastparse/src-2/fastparse · high confidence

Initial CSS parser and pretty printer implementation

Introduces a new CSS parsing library that implements the CSS Syntax Level 3 specification. The change adds an AST definition (Ast.scala) covering tokens, selectors, and rules, a parser (CssParser.scala) built on the fastparse library to tokenize and structure CSS input, and a pretty printer (PrettyPrinter.scala) to format the parsed AST back into readable CSS text. This provides the core capability to parse and serialize CSS stylesheets within the application.

cssparse/src · high confidence

Initial Python 2 parser implementation

Added a new Python 2 parser module in \pythonparse\ that manually transcribes the Python 2 grammar into the \fastparse\ library. The implementation includes lexical analysis for tokens (identifiers, numbers, strings, keywords) and defines grammars for expressions (including operators, comparisons, and comprehensions) and statements (including control flow, imports, and decorators), enabling the parsing of Python 2 source code into an Abstract Syntax Tree.

pythonparse/src · high confidence

Introduce Basic and Literals syntax definitions for fastparse

Added new \Basic.scala\ and \Literals.scala\ files in the \scalaparse.syntax\ package to define core parsing primitives. \Basic.scala\ provides utilities for handling whitespace, newlines, operators, and character predicates, while \Literals.scala\ implements parsers for integers, floats, booleans, strings (including interpolation and triple-quoted strings), comments, and escape sequences. These components form the foundational syntax layer for the parser, leveraging the \fastparse\ library.

scalaparse/src/scalaparse/syntax · high confidence

Platform-specific character predicate implementations for Scala.js and JVM

Added new \CharPredicates\ objects in the \fastparse\ package for both Scala.js (\src-js\) and JVM (\src-jvm\) targets to provide fast, pre-computed character classification. These utilities expose methods for identifying letters, digits, symbols, and printable characters, with the JVM implementation leveraging \java.lang.Character.UnicodeBlock\ for more robust printable character detection while the Scala.js version uses a simplified check excluding ISO control and surrogate characters.

fastparse/src-js, fastparse/src-jvm · high confidence

Scala 3 support with inline macros and extension methods

The fastparse library now supports Scala 3, introducing a new package implementation that utilizes Scala 3's inline macros and extension methods. This change replaces previous implicit function-based definitions with inline extension methods for parser combinators (such as \\|\, \\~\, \rep\, and \map\), enabling better performance and integration with Scala 3's compile-time features while maintaining the same parsing API for users.

fastparse/src-3/fastparse · high confidence

Architecture

Migration from sbt to Mill build system

The project has switched its build tool from sbt to Mill. This change introduces a new \build.mill\ configuration file, a \mill\ launcher script, and a \.gitignore\ updated for Mill's output directories (\out/\, \.metals/\, etc.). The build now supports cross-compilation for Scala 2.12, 2.13, and 3.3.3 across JVM, Scala.js, and Scala Native platforms, replacing the previous sbt-based structure.

(repo-wide) · high confidence

Behavioural changes

Added Scala 2.12 compatibility shim for @nowarn

The library now includes a \NoWarn\ object in the \fastparse.internal\ package to support Scala 2.12. Since the \@nowarn\ annotation was introduced in Scala 2.13, this change provides a compatibility shim for Scala 2.12 users, allowing the codebase to suppress warnings consistently across both Scala 2.12 and 2.13 versions without compilation errors.

fastparse/src-2.12 · high confidence

Consolidated macro implementations for parsing performance

The internal macro logic for fastparse has been reorganized into dedicated source files (MacroImpls.scala and MacroRepImpls.scala) within the src-2 directory. This change consolidates the implementation of core parsing operations—such as literal string matching, mapping, collecting, and repetition (\.rep\/\.repX\)—into optimized macro-based inlining. For users, this results in improved parsing performance and reduced runtime overhead by moving complex logic from shared function bodies into compile-time inlined code, while maintaining the same public API behavior.

fastparse/src-2/fastparse/internal · high confidence

FastParse 3.1.1 documentation release

The documentation has been updated to reflect the FastParse 3.1.1 release, which fixes spurious warnings (issue \#285). The changelog also records previous updates including Scala-Native 0.5.0 support, dropped support for older Scala versions, and various bug fixes in error reporting and parsing behavior.

readme · high confidence

Improved error reporting and streaming input support

Fastparse now provides significantly more detailed error messages through a new \TracedFailure\ type that aggregates terminal and group-level parser expectations, allowing users to see exactly which low-level tokens (like literals or character classes) were expected at a failure point. The library also introduces \ParserInputSource\ to support streaming reads via \geny.Readable\, enabling efficient parsing of large inputs without loading them entirely into memory, and fixes line and column number reporting to correctly handle Windows-style newlines.

repository · high confidence

Improved whitespace and error reporting for unclosed comments

The library now provides proper failure messages when parsing whitespace that includes comments (Java, Jsonnet, Script) if a comment is left unclosed. Previously, such errors might have been silent or less descriptive; now, the \Whitespace\ trait implementations in \Whitespace.scala\ explicitly detect end-of-input while inside a comment state and report a specific failure (e.g., expecting \\*/\), improving the debugging experience for users parsing languages with comments.

fastparse/src/fastparse · high confidence

Internal refactoring to isolate private APIs and introduce streaming support

The library has moved internal implementation details into the \fastparse.internal\ package to prevent namespace pollution when importing \fastparse.\_\. Additionally, a new \ParserInputSource\ wrapper has been introduced to support streaming reads via \geny.Readable\, and a high-performance circular buffer (\UberBuffer\) has been added to the internal package to support these operations.

fastparse/src/fastparse/internal · medium confidence

Reintroduce Scala 3 compatibility and trailing comma support

The scalaparse library has been updated to support Scala 3 by replacing the deprecated \\[\_: P\]\ context bound syntax with \\[\_p: P\]\ in parser definitions. Additionally, trailing comma functionality is re-enabled for lists of expressions, arguments, and type arguments via the new \TrailingCommaOps\ and \repTC\ methods, allowing users to write more flexible and modern Scala code structures.

scalaparse/src/scalaparse · high confidence

Scala 3 macro implementations for parsing performance

The library introduces new Scala 3-specific macro implementations in the \fastparse.internal\ package to optimize parsing performance. \MacroInlineImpls\ provides inlined logic for literal string matching, filtering, and sequence parsing, while \MacroRepImpls\ implements high-performance macros for repetition operators (\rep\/\repX\) that handle whitespace consumption and cut semantics directly in the generated code. A \NoWarn\ compatibility shim is also added to support older Scala 3 versions by mapping to \scala.annotation.nowarn\.

fastparse/src-3/fastparse/internal · high confidence

Test coverage

Added JVM-specific regression tests for Scala parsing; Added Scala 2.13-specific test infrastructure for ScalacParser; Added comprehensive test suite for fastparse; Added source-map verification tests for Scala.js; Added test suite for CSS parsing and pretty-printing; Added test suite for Python parser; Added test utilities for validating parsing success and failure traces; Added unit tests for Scala parser success, failure, and trailing comma handling.

Dependencies

Add Scalatex SBT plugin for README generation

The build configuration now includes the Scalatex SBT plugin (version 0.3.11) to enable automatic generation of the project README from source files.

(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

Score

  • CAI 54 → 52 (-1.2)
  • Rubric changed (rubric-2026.09.8 → rubric-2026.09.16) — scores are not directly comparable.

Lenses

  • Code Health 90 → 90 (+0.0)
  • Architecture 99 → 83 (-15.9)
  • Maturity 45 → 44 (-1.0)
  • Readiness 43 → 43 (+0.0)
  • Security 72 → 72 (+0.0)

Resolved (2)

  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)

New (2)

  • Dependency hygiene PARTLY measured — sbt declarations read, no exact version to grade for currency
  • Projects may be oversized for their cohesion

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

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

Survey your own repository

com-lihaoyi/fastparse 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 28 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 475d042bc267c53e3ac7d383dc01271cdb4862a6 — the exact code this score is about.
  • Scored under rubric-2026.09.16 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-2d9048c36d26.