Skip to content

About

Production JSON parser and validator built on Grip for Lean 4

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

lean-grip-json

CI Release Lean 4 License

An exact, RFC-8259 JSON value parser and renderer for Lean 4, built on grip. It is pure and byte-oriented: it performs no IO and does not depend on a terminal or a JSON-specific runtime.

Quick start

import GripJson

#eval Grip.Json.parseString "{\"answer\": 42}"
-- .ok (obj #[("answer", num 42 0)])

Numbers are represented exactly as a mantissa and decimal exponent; parsing never rounds through Float. Strings validate UTF-8 and decode JSON escapes, including surrogate pairs. The parser returns positioned Grip.ParseError values on failure.

Problem

Lean programs need JSON parsing that preserves exact numbers, validates the full format, and reports where invalid input occurs.

Development

This project is maintained by its author with AI-assisted development tools. Changes are reviewed, tested, and remain the maintainer's responsibility.

Related projects

oatp uses grip-json for its JSON configuration.

Install

Pin the newest release tag (the Release badge above shows it) in place of vX.Y.Z:

require «grip-json» from git
  "https://github.com/jonaprieto/lean-grip-json.git" @ "vX.Y.Z"

Build and verification

lake build GripJson GripJsonTest Examples tests demo readme conformance bench
bash tools/run-conformance.sh
lake exe bench

The checked-in JSONTestSuite corpus gates grammar behavior. The benchmark keeps separate rows for Grip's allocation-light validator, the Grip DOM parser, Lean's standard DOM parser, and the cross-language reference harnesses. Only the validator is the strict no-DOM cross-language task; the DOM rows are reported as local comparison context.

License

Apache-2.0.

About

Production JSON parser and validator built on Grip for Lean 4

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages