Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/provisioned-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,9 @@ jobs:
"-DCMAKE_BUILD_TYPE=$mode" -DBUILD_TESTING=ON \
"-DCMAKE_CXX_FLAGS=-Wall -Wextra -Wpedantic -Werror" \
-DCEL_PARSER_ENABLE_PARITY=ON \
"-DCEL_PARSER_REFERENCE_SOURCE=$REFERENCE_SOURCE" \
-DCEL_PARSER_BUILD_MEASUREMENTS=ON
"-DCEL_PARSER_REFERENCE_SOURCE=$REFERENCE_SOURCE"
cmake --build "build/provisioned-$mode"
ctest --test-dir "build/provisioned-$mode" --output-on-failure
if [ "$mode" = Release ]; then
build/provisioned-Release/measurement 100000
fi
done
- name: Matching instrumented source builds
shell: bash
Expand All @@ -55,8 +51,7 @@ jobs:
-DCEL_PARSER_ENABLE_PARITY=ON \
"-DCEL_PARSER_REFERENCE_SOURCE=$REFERENCE_SOURCE" \
"-DCMAKE_CXX_FLAGS=-Wall -Wextra -Wpedantic -Werror -fsanitize=address,undefined -fno-omit-frame-pointer" \
"-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address,undefined" \
-DCEL_PARSER_BUILD_MEASUREMENTS=ON
"-DCMAKE_EXE_LINKER_FLAGS=-fsanitize=address,undefined"
cmake --build build/provisioned-sanitized
if [ "$(uname)" = Darwin ]; then
export ASAN_OPTIONS=detect_leaks=0
Expand All @@ -72,8 +67,7 @@ jobs:
cmake --preset clang-tidy \
"-DCMAKE_CXX_FLAGS=-Wall -Wextra -Wpedantic -Werror" \
-DCEL_PARSER_ENABLE_PARITY=ON \
"-DCEL_PARSER_REFERENCE_SOURCE=$REFERENCE_SOURCE" \
-DCEL_PARSER_BUILD_MEASUREMENTS=ON
"-DCEL_PARSER_REFERENCE_SOURCE=$REFERENCE_SOURCE"
cmake --build --preset clang-tidy
ctest --preset clang-tidy
cargo fmt --manifest-path build/provisioned-Debug/parity-reference/Cargo.toml --check
Expand Down
2 changes: 2 additions & 0 deletions .scout/memory/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

- [[knowledge/admit-numeric-values-by-literal-form-not-converted-binary64-payload.md|Admit numeric values by literal form, not converted binary64 payload]] (pattern, 0.99) `parser` `literals` `rust-parity` `tuple-selectors`
- [[knowledge/custom-parser-emitters-must-transfer-runtime-capture-ownership.md|Custom parser emitters must transfer runtime capture ownership]] (pattern, 0.97) `ownership` `public-contracts` `operation-emitters`
- [[knowledge/delegate-public-header-checks-and-license-installation-to-cpp-library.md|Delegate public-header checks and license installation to cpp-library]] (decision, 0.99) `cmake` `cpp-library` `testing` `licenses`
- [[knowledge/initialize-shared-installation-defaults-before-cpm-runtime-and-parser-targets.md|Initialize shared installation defaults before CPM runtime and parser targets]] (decision, 0.10) `cmake` `cpm` `dependencies` `installation`
- [[knowledge/isolate-apple-numeric-conversion-from-the-caller-s-floating-point-environment.md|Isolate Apple numeric conversion from the caller's floating-point environment]] (decision, 0.99) `parser` `floating-point` `macos` `locale` `compatibility`
- [[knowledge/keep-cel-runtime-out-of-parser-installation.md|Keep cel-runtime out of parser installation]] (decision, 0.99) `cmake` `cpm` `dependencies` `installation`
- [[knowledge/keep-operator-local-storage-out-of-recursive-precedence-frames.md|Keep operator-local storage out of recursive precedence frames]] (discovery, 0.98) `parser` `recursion` `stack-usage` `MSVC`
- [[knowledge/pin-cpm-dependencies-to-reviewed-commits.md|Pin CPM dependencies to reviewed commits]] (decision, 0.10) `cmake` `cpm` `dependencies` `supply-chain` `installation`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: "Delegate public-header checks and license installation to cpp-library"
entity_type: decision
confidence: 0.99
created: 2026-11-19T04:10:28Z
last_accessed: 2026-11-19T04:10:28Z
last_reinforced: 2026-11-19T04:10:28Z
access_count: 1
sources:
- "CMakeLists.txt:17-31"
- "CMakeLists.txt:43-50"
relationships:
- type: relates_to
target: "Keep cel-runtime out of parser installation"
tags: ["cmake", "cpp-library", "testing", "licenses"]
tier: knowledge
---

# Delegate public-header checks and license installation to cpp-library

Keep the public-header list in `cpp_library_setup(HEADERS ...)` as the source for cpp-library's automatic standalone header checks in top-level testing builds. Do not recreate per-header generated translation units or object-library targets.

Let cpp-library install the root `LICENSE` automatically; declare the additional Unicode notice with `LICENSE_FILES licenses/Unicode-3.0.txt` rather than a separate `install(FILES ...)` block. Private `src` include directories remain necessary for white-box tests; standalone public-header checks do not replace that access.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: "Isolate Apple numeric conversion from the caller's floating-point environment"
entity_type: decision
confidence: 0.99
created: 2026-11-19T05:47:01Z
last_accessed: 2026-11-19T05:47:01Z
last_reinforced: 2026-11-19T05:47:01Z
access_count: 1
sources:
- "src/parser.cpp:180-194"
- "tests/tests.cpp:129-153"
- "src/lexer.hpp:21-23"
- "docs/lexical-contract.md:105-109"
tags: ["parser", "floating-point", "macos", "locale", "compatibility"]
tier: knowledge
---

# Isolate Apple numeric conversion from the caller's floating-point environment

`strtod_l(..., LC_C_LOCALE)` isolates the locale but still obeys the caller's rounding mode. Preserve the lexer's round-to-nearest contract by saving the environment with `std::feholdexcept`, selecting `FE_TONEAREST`, converting, and restoring the saved environment with `std::fesetenv` before checking errors.

Keep allocating or otherwise throwing C++ operations outside the save/restore region. Restore the caller's rounding mode and existing exception flags rather than leaking conversion state. The parser regression covers directed rounding, decimal values, radix ties, overflow, and underflow through real tokenization.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ last_accessed: 2026-11-18T06:31:07Z
last_reinforced: 2026-11-18T06:31:07Z
access_count: 1
sources:
- "CMakeLists.txt:22-24"
- "CMakeLists.txt:42"
- "CMakeLists.txt:17-35"
- "docs/validation.md:121-130"
supersedes: "[[Initialize shared installation defaults before CPM runtime and parser targets]]"
tags: ["cmake", "cpm", "dependencies", "installation"]
Expand All @@ -18,11 +17,11 @@ relationships:
target: "Pin CPM dependencies to reviewed commits"
- type: relates_to
target: "Initialize shared installation defaults before CPM runtime and parser targets"
votes_up: 1
votes_up: 2
votes_down: 0
last_voted: 2026-11-18T06:46:33Z
last_voted: 2026-11-19T04:10:10Z
---

# Keep cel-runtime out of parser installation

Set `CEL_INSTALL` before adding `cel-runtime` so both projects see the intended option. Add the runtime with its versioned commit URI and keep CPM's short-form `EXCLUDE_FROM_ALL` default; do not override it to `NO`. With `cpp-library` 6.0.2, CPM registry resolution supplies the package/version without an explicit `cpp_library_map_dependency`. The source-consumer test remains; installed-consumer testing is intentionally omitted, and the generated package check verifies component presence only.
Let `cpp_library_setup` initialize the default `CEL_INSTALL` option before adding `cel-runtime`. Add the runtime with its versioned commit URI and keep CPM's short-form `EXCLUDE_FROM_ALL` default; do not override it to `NO`. CPM registry resolution supplies the package/version without an explicit `cpp_library_map_dependency`. Package validation relies on cpp-library's generated component-presence check, without custom source-consumer or installed-consumer tests.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ last_accessed: 2026-11-18T06:31:11Z
last_reinforced: 2026-11-18T06:31:11Z
access_count: 1
sources:
- "CMakeLists.txt:6"
- "CMakeLists.txt:24"
- "docs/evidence.md:94-95"
- "CMakeLists.txt:5-6"
- "CMakeLists.txt:33-35"
- "docs/evidence.md:96-100"
supersedes: "[[Pin CPM dependencies to reviewed commits]]"
tags: ["cmake", "cpm", "dependencies", "supply-chain"]
tier: knowledge
Expand All @@ -20,11 +20,11 @@ relationships:
target: "Keep cel-runtime out of parser installation"
- type: relates_to
target: "Initialize shared installation defaults before CPM runtime and parser targets"
votes_up: 1
votes_up: 2
votes_down: 0
last_voted: 2026-11-18T06:46:38Z
last_voted: 2026-11-19T04:10:12Z
---

# Pin runtime source with a versioned CPM URI

Pin `cel-runtime` with a CPM URI that includes both the compatibility release (`1.1.1`) and reviewed full commit SHA `e47232f8ed6cb83bc11f4cb418a8a2249c2415cf`. Keep the release tag-to-commit relationship in `docs/evidence.md`. `cpp-library` 6.0.2 resolves the dependency from CPM's registry, so do not add a separate `cpp_library_map_dependency` for this CPM package.
Pin `cel-runtime` with a CPM URI that includes both the compatibility release (`1.1.2`) and reviewed full commit SHA `a819042cfa3fab8ede82052518f2b7f5175af5ad`. Keep the release tag-to-commit relationship in `docs/evidence.md`. `cpp-library` resolves the dependency from CPM's registry, so do not add a separate `cpp_library_map_dependency` for this CPM package.
64 changes: 16 additions & 48 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,16 @@ cmake_minimum_required(VERSION 3.24)

include(cmake/CPM.cmake)

set(CPP_LIBRARY_VERSION "" CACHE STRING "CEL parser package version override")
CPMAddPackage("gh:stlab/cpp-library@6.0.2")
CPMAddPackage("gh:stlab/cpp-library@6.1.0")
include(${cpp-library_SOURCE_DIR}/cpp-library.cmake)

# Enable dependency tracking before project()
cpp_library_enable_dependency_tracking()

# Now declare project
project(parser LANGUAGES CXX)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
include(GNUInstallDirs)

if(PROJECT_IS_TOP_LEVEL)
include(CTest)
endif()

# Both cel packages share CEL_INSTALL; choose its default before adding dependencies.
option(CEL_INSTALL "Enable installation for cel libraries" ${PROJECT_IS_TOP_LEVEL})
CPMAddPackage("gh:stlab/cel-runtime@1.1.1#e47232f8ed6cb83bc11f4cb418a8a2249c2415cf")
include(CTest)

# Setup library
cpp_library_setup(
Expand All @@ -33,47 +23,33 @@ cpp_library_setup(
TESTS tests.cpp lookup_test.cpp type_test.cpp expression_test.cpp cached_test.cpp parity_driver_test.cpp header_layers_test.cpp
cursor_copy_fail.cpp lexer_copy_fail.cpp parser_copy_fail.cpp standard_library_fail.cpp
converting_registration_fail.cpp converting_result_fail.cpp nontrivial_registration_fail.cpp token_interface_fail.cpp
LICENSE_FILES licenses/Unicode-3.0.txt
DOCS_INPUTS README.md docs/build.md docs/get-started.md docs/libraries.md
docs/language.md docs/reference.dox
DOCS_EXCLUDE_SYMBOLS cel::detail cel::detail::* cel::parser_detail cel::parser_detail::*
DOCS_OPTIONS "USE_MDFILE_AS_MAINPAGE = ${CMAKE_CURRENT_SOURCE_DIR}/README.md"
"EXCLUDE_SYMBOLS = cel::detail cel::detail::* cel::parser_detail cel::parser_detail::*"
"FULL_PATH_NAMES = NO"
)

# Initialize cpp-library's default CEL_INSTALL before the same-namespace runtime.
CPMAddPackage("gh:stlab/cel-runtime@1.1.2#a819042cfa3fab8ede82052518f2b7f5175af5ad")
target_link_libraries(parser PUBLIC cel::runtime)

# Exercise parity-driver helpers in ordinary unit tests without the driver's main().
if(TARGET parity_driver_test)
target_sources(parity_driver_test PRIVATE tools/parity/driver.cpp)
target_compile_definitions(parity_driver_test PRIVATE CEL_PARITY_NO_MAIN)
endif()
install(FILES LICENSE licenses/Unicode-3.0.txt
DESTINATION "${CMAKE_INSTALL_DATADIR}/licenses/cel-parser")

if(PROJECT_IS_TOP_LEVEL AND BUILD_TESTING)
# Give white-box tests access to implementation headers without exporting them.
foreach(test tests lookup_test type_test expression_test parity_driver_test cursor_copy_fail lexer_copy_fail)
target_include_directories(${test} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")
endforeach()
foreach(header parser.hpp parser/diagnostic.hpp parser/lookup.hpp parser/compiler.hpp parser/all.hpp)
string(MAKE_C_IDENTIFIER "${header}" header_id)
set(header_source "${CMAKE_CURRENT_BINARY_DIR}/header_${header_id}.cpp")
file(GENERATE OUTPUT "${header_source}" CONTENT "#include <cel/${header}>\n")
add_library(header_${header_id} OBJECT "${header_source}")
target_link_libraries(header_${header_id} PRIVATE cel::parser)
endforeach()
configure_file(tests/source_consumer.cmake.in source_consumer.cmake @ONLY)
add_test(NAME source_consumer
COMMAND "${CMAKE_COMMAND}" "-DCONFIG=$<CONFIG>"
-P "${CMAKE_CURRENT_BINARY_DIR}/source_consumer.cmake")
set_tests_properties(source_consumer tests PROPERTIES TIMEOUT 180)
endif()

option(CEL_PARSER_BUILD_MEASUREMENTS "Build execution timing workloads" OFF)
if(CEL_PARSER_BUILD_MEASUREMENTS)
add_executable(measurement tools/measurement.cpp)
target_link_libraries(measurement PRIVATE cel::parser)
set_target_properties(measurement PROPERTIES CXX_EXTENSIONS OFF)
if(BUILD_TESTING)
add_test(NAME measurement_contracts COMMAND measurement 10)
endif()
set_tests_properties(tests PROPERTIES TIMEOUT 180)
endif()

# Compare C++ and Rust results on shared fixtures; Python and Cargo are test-only.
option(CEL_PARSER_ENABLE_PARITY "Require the local public Rust reference differential gate" OFF)
set(CEL_PARSER_REFERENCE_SOURCE "" CACHE PATH "Local cel-rs checkout for test-only parity")
if(CEL_PARSER_ENABLE_PARITY)
Expand All @@ -98,7 +74,9 @@ if(CEL_PARSER_ENABLE_PARITY)
add_executable(parity_driver tools/parity/driver.cpp)
target_include_directories(parity_driver PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/src")
target_link_libraries(parity_driver PRIVATE cel::parser)
set_target_properties(parity_driver PROPERTIES CXX_EXTENSIONS OFF)
cpp_library_copy_runtime_dlls(parity_driver)

# Run Python tooling tests as well as end-to-end C++/Rust comparisons.
add_test(NAME parity_comparator COMMAND "${Python3_EXECUTABLE}" -m unittest discover
-s "${CMAKE_CURRENT_SOURCE_DIR}/tools/parity" -p "test_*.py")
add_test(NAME differential COMMAND "${Python3_EXECUTABLE}"
Expand All @@ -107,13 +85,3 @@ if(CEL_PARSER_ENABLE_PARITY)
--rust "${reference_build}/target/release/cel-parity-reference${CMAKE_EXECUTABLE_SUFFIX}")
set_tests_properties(differential PROPERTIES TIMEOUT 180)
endif()

foreach(tool cached_decoded cached_test measurement parity_driver parity_driver_test)
if(TARGET ${tool})
if(MSVC)
target_compile_options(${tool} PRIVATE /W4 /WX)
else()
target_compile_options(${tool} PRIVATE -Wall -Wextra -Wpedantic -Werror)
endif()
endif()
endforeach()
5 changes: 3 additions & 2 deletions docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ prefix is needed.

## Before you begin

Use CMake 3.24 or later, Ninja, Git, and a C++20 compiler with floating-point
`std::from_chars` and IEEE binary64 `double`. Do not enable fast-math.
Use CMake 3.24 or later, Ninja, Git, and a C++20 compiler with IEEE binary64
`double`. Numeric conversion uses C-locale `strtod_l` on Apple platforms and
floating-point `std::from_chars` elsewhere. Do not enable fast-math.
The first configuration downloads pinned build infrastructure and
`cel-runtime`. You need Git read access to both repositories; no separate
runtime checkout is required.
Expand Down
26 changes: 14 additions & 12 deletions docs/evidence.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ pinned to the original baseline.
The runtime source upstream is
[stlab/cel-runtime](https://github.com/stlab/cel-runtime).
The previous P4 baseline used release `v1.0.1` at revision
`a8e753b040664172fd3f526f9cf46029858ff788`. The parser pins release `v1.1.1`
at revision `e47232f8ed6cb83bc11f4cb418a8a2249c2415cf` because its
`a8e753b040664172fd3f526f9cf46029858ff788`. The parser pins release `v1.1.2`
at revision `a819042cfa3fab8ede82052518f2b7f5175af5ad` because its
record-registration API uses the runtime's record adapters. The parser consumes
the public target from CPM and exports the matching minimum package version; it
neither copies runtime implementation nor includes private headers. Rebuild the
Expand Down Expand Up @@ -76,11 +76,13 @@ A local `rustc` stdin probe of `str::parse::<f64>()` confirmed these outcomes:
| `9007199254740993` | `9007199254740992.0` |
| `1e999999999999999999999` | Positive infinity |

The C++ implementation uses `std::from_chars`; it doesn't implement decimal
floating-point conversion. Because the standard converter leaves the output
unchanged on range failure, the adapter classifies a decimal's order as positive
or nonpositive and supplies infinity or zero only after a range error. Conversion
of representable values remains the standard converter's responsibility.
The C++ implementation delegates floating-point conversion to the platform
library: C-locale `strtod_l` on Apple platforms and `std::from_chars` elsewhere.
The Apple path uses the converter's infinity, zero, and subnormal results.
Because `std::from_chars` leaves the output unchanged on range failure, its
adapter classifies a decimal's order as positive or nonpositive and supplies
infinity or zero only after a range error. Conversion of representable values
remains the library converter's responsibility.
Power-of-two radix digits are regrouped exactly into hexadecimal digits before
the same converter runs; no intermediate fixed-width integer narrows the value.
All numeric traversal is linear and uses no locale-dependent conversion.
Expand All @@ -91,10 +93,11 @@ Production code depends on the C++20 standard library, committed Unicode
property data, and the `cel-runtime` package through `cel::runtime`.
There is no Unicode shared-library dependency.

Build infrastructure uses `stlab/cpp-library` release `v6.0.2` at
`df18f94c816df6dc4fbab8078e6b57a7d265a2c2` under BSL-1.0. Its pinned scaffold
Build infrastructure uses `stlab/cpp-library` release `v6.1.0` at
`13ff79ac9fbbf575bbab0ab3dee0c752b4501fcc` under BSL-1.0. Its pinned scaffold
provides CMake presets, doctest 2.5.3 (MIT), generated negative-compilation tests,
CTest, exports, installation, CI, and strict Doxygen configuration.
CTest, standalone public-header checks, exports, license installation, CI,
and strict Doxygen configuration.
Doxygen-awesome-css 2.5.0 (MIT) supplies the documentation theme. CPM.cmake
0.43.2 is MIT-licensed. Doxygen, Ninja, Clang tools, and Python are
build/generation tools, not exported package dependencies.
Expand Down Expand Up @@ -144,5 +147,4 @@ boundaries, compound separation, producer cursor termination, and static
non-clonability. The differential tooling never rewrites source or exempts C++
acceptance. Named diagnostic differences and selected callback-error
normalization apply only to responses, not expressions. See
[validation](validation.md) for configuration, diagnostic rulings,
source consumers, and warmed timing boundaries.
[validation](validation.md) for configuration and diagnostic rulings.
2 changes: 0 additions & 2 deletions docs/expression-grammar.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,6 @@ The following cases in `tests/expression_test.cpp` cover the implementation:
| `recursive input` | Bounded nesting, long arithmetic/unary/cast/member/lazy/list chains |

`tests/type_test.cpp` additionally verifies exact span-output prefix parsing.
The `source_consumer` test builds the public compiler and runtime APIs from a
source-tree consumer.

The differential fixtures cover retained production families with identical
sources. Narrower scalar/parameter availability, canonical record carriers,
Expand Down
Loading
Loading