Popeye style hero saying I YAM WHAT I YAM for the YAM YAML parser and emitter project

YAM

spinach-powered parsing

YAML 1.2 | C11 GitHub Repo API Docs

A fast, minimal, zero-copy YAML parser and emitter with SIMD scanning, event-driven parsing, merge and alias support, and dependable error reporting.

396/402Suite Passes
663Total Tests
423 MB/s*Scanner
172 MB/s*Parser Avg

Build and Run

Build with a C11 compiler (GCC/Clang tested on Linux and macOS).

make              # build libyam.a
make test-all     # run all tests
make test-suite   # run YAML Test Suite (needs submodules)
make bench        # scanner benchmark on your machine

Core Capabilities

Scanner

SIMD-accelerated tokenization (SSE4.2 and NEON with scalar fallback), producing a flat token stream.

Parser

Event API with indent tracking, block structure handling, merge key expansion, alias resolution, and event safety limits.

Emitter

Roundtrip output in block, flow, or minimal style, with auto-quoting for ambiguous plain scalars.

Schema support: Failsafe, JSON, Core, or fully custom resolution rules.

Architecture

YAM keeps scanner and parser responsibilities clean: raw tokens first, structure and properties in parser, then emit text.

Input Bytes
Scanner
Tokens
Parser
Events
Emitter

Quick API Snapshot

Event Loop

yam_event evt;
while (yam_parse_next(parser, &evt) == YAM_OK) {
  if (evt.type == YAM_EVT_STREAM_END) break;
  /* consume event */
}

Error Reporting

if (yam_parse_next(parser, &evt) != YAM_OK) {
  const char *msg = yam_parser_error(parser);
  yam_mark mark = yam_parser_error_mark(parser);
  printf("%d:%d: %s\n", mark.line, mark.col, msg);
}

Performance and Reliability

Throughput (10 MB benchmark)*

Scanner: 423 MB/s avg, 425 MB/s best

Parser: 172 MB/s avg across block, mixed, and JSON

SIMD: SSE4.2 * Intel Core Ultra 7 155H

Test Status

Passes 396 of 402 YAML Test Suite cases.
(6 have no expected output).

Project test count: 663 total tests, 0 failures.