{"id":51570042,"url":"https://github.com/vgnapuga/meon","last_synced_at":"2026-07-29T19:00:31.893Z","repository":{"id":365303003,"uuid":"1270523931","full_name":"vgnapuga/meon","owner":"vgnapuga","description":"Declarative flat parsing engine. No AST - only SoA tables, zero-copy spans and SIMD/SWAR","archived":false,"fork":false,"pushed_at":"2026-07-19T19:09:27.000Z","size":596,"stargazers_count":30,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-07-19T20:23:15.258Z","etag":null,"topics":["data-oriented-design","declarative","flat-parsing","open-source","parsing-engine","performance","rust","rustlang","simd","zero-copy"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vgnapuga.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-15T19:51:57.000Z","updated_at":"2026-07-19T19:07:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/vgnapuga/meon","commit_stats":null,"previous_names":["vgnapuga/meon"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/vgnapuga/meon","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgnapuga%2Fmeon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgnapuga%2Fmeon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgnapuga%2Fmeon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgnapuga%2Fmeon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vgnapuga","download_url":"https://codeload.github.com/vgnapuga/meon/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vgnapuga%2Fmeon/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36045787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-29T02:00:04.910Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-oriented-design","declarative","flat-parsing","open-source","parsing-engine","performance","rust","rustlang","simd","zero-copy"],"created_at":"2026-07-10T19:00:23.039Z","updated_at":"2026-07-29T19:00:31.888Z","avatar_url":"https://github.com/vgnapuga.png","language":"Rust","funding_links":[],"categories":["Libraries"],"sub_categories":["Parsing"],"readme":"# meon\n\nEN | [**RU**](https://github.com/vgnapuga/meon/blob/main/README_RU.md)\n\n\u003e Declarative flat parsing engine for text formats.\n\n* **meon**\n  * [***GitHub***](https://github.com/vgnapuga/meon/blob/main/meon/README.md)\n  * [***crates.io***](https://crates.io/crates/meon)\n* **meon-macros**\n  * [***GitHub***](https://github.com/vgnapuga/meon/blob/main/meon-macros/README.md)\n  * [***crates.io***](https://crates.io/crates/meon-macros)\n* **meon-md**\n  * [***GitHub***](https://github.com/vgnapuga/meon/blob/main/meon-md/README.md)\n  * [***crates.io***](https://crates.io/crates/meon-md)\n* **meon-json**\n  * [***GitHub***](https://github.com/vgnapuga/meon/blob/main/meon-json/README.md)\n  * [***crates.io***](https://crates.io/crates/meon-json)\n\n* [***CHANGELOG.md***](https://github.com/vgnapuga/meon/blob/main/CHANGELOG.md)\n* [***ARCHITECTURE.md***](https://github.com/vgnapuga/meon/blob/main/ARCHITECTURE.md)\n* [***BENCHMARKS.md***](https://github.com/vgnapuga/meon/blob/main/benches/README.md)\n  * [***MD_COMPARE.md***](https://github.com/vgnapuga/meon/blob/main/benches/MD_COMPARE.md)\n  * [***JSON_COMPARE.md***](https://github.com/vgnapuga/meon/blob/main/benches/JSON_COMPARE.md)\n* [***FUZZING.md***](https://github.com/vgnapuga/meon/blob/main/fuzz/README.md)\n\n---\n\n## What is meon\n\nMost text parsers build a tree. `meon`([wiki](https://en.wikipedia.org/wiki/Meon_(philosophy))) builds a table.\n\nYou describe a grammar once with `define_parser!` and get back a content struct\nwhere every element kind lives in its own flat `Vec`. Headings in one vec,\nbold spans in another, links in a third. No tree traversal, no allocator\npressure from node objects, no virtual dispatch. Just contiguous arrays of\n`u32` byte-offset pairs that you iterate at native speed.\n\n---\n\n## Flat output — hardware-friendly by design\n\nA typical parser hands you a heterogeneous AST. To find all bold spans you\nwalk the tree, match node types, and collect what you need. Cache misses\naccumulate as you jump between pointer-linked nodes of varying sizes.\n\n`meon` inverts this. The output is a struct-of-arrays:\n\n```\nMarkdownContent {\n    source:         \u0026[u8]         ← original bytes, borrowed\n    texts:          Vec\u003cSpan\u003e     ← all plain text runs\n    bolds:          Vec\u003cSpan\u003e     ← all bold spans\n    italics:        Vec\u003cSpan\u003e     ← all italic spans\n    codes:          Vec\u003cSpan\u003e     ← all inline code spans\n    links:          Vec\u003cLink\u003e     ← all links and images\n    headings:       Vec\u003c(Heading, Span)\u003e\n    fenced_codes:   Vec\u003cSpan\u003e\n    bullet_items:   Vec\u003c(BulletItem, Span)\u003e\n    ...\n}\n```\n\nAll spans are `u32` byte offsets — 8 bytes per span. Access to any element\nkind is O(1). Iterating all bold spans is a single forward scan over a\ncontiguous array. The CPU prefetcher is happy.\n\n---\n\n## Spans — zero-copy access into the source\n\nEvery element is represented as a `Span { start: u32, end: u32 }` — a\nhalf-open byte range `[start, end)` into the original source slice. Nothing\nis copied. Nothing is decoded unless you ask for it.\n\n```rust\nlet src = b\"**bold** and *italic*\\n\";\nlet c = MarkdownParser::parse(src);\n\n// Resolve a span to a string slice — zero copy, borrow from source.\n// Returns `None` on invalid UTF-8 instead of panicking.\nlet text: \u0026str = c.str(c.bolds[0]).unwrap();\nassert_eq!(text, \"bold\");\n\n// Or work with raw bytes, no UTF-8 check\nlet bytes: \u0026[u8] = c.bytes(c.italics[0]);\n\n// Every field also gets a generated `_clean` (delimiters stripped) and\n// `_raw` (delimiters included) accessor — zero-copy byte-slice iterators.\nlet raw: \u0026[u8] = c.bolds_raw().next().unwrap();\nassert_eq!(raw, b\"**bold**\");\n```\n\nThe content struct borrows the source for its entire lifetime. When the struct\nis dropped the source is released. No intermediate representations persist.\n\n---\n\n## Context-free extraction — parse one type without parsing everything\n\nEvery grammar rule generates a `find_*` standalone iterator. It scans the raw\nsource for one element kind only, with no knowledge of surrounding elements,\nactive blocks, or paragraph state.\n\n```rust\n// Full parse — all element kinds in one pass\nlet content = MarkdownParser::parse(src);\n\n// Standalone — only bold spans, nothing else computed\nfor span in MarkdownParser::find_bolds(src) {\n    println!(\"{}\", std::str::from_utf8(\u0026src[span.start as usize..span.end as usize]).unwrap());\n}\n\n// Headings with metadata — level and content span\nfor (heading, span) in MarkdownParser::find_headings(src) {\n    println!(\"h{}: {}\", heading.level, std::str::from_utf8(\u0026src[span.start as usize..span.end as usize]).unwrap());\n}\n\n// Links and images — structured type, two spans inside\nfor link in MarkdownParser::find_links(src) {\n    let text = std::str::from_utf8(\u0026src[link.text.start as usize..link.text.end as usize]).unwrap();\n    let url  = std::str::from_utf8(\u0026src[link.url.start  as usize..link.url.end  as usize]).unwrap();\n    println!(\"[{}]({})  image={}\", text, url, link.is_image);\n}\n```\n\nStandalone iterators are faster than a full parse when only one element kind\nis needed — they skip all cross-element bookkeeping. Same-type block nesting\n(`\u003e \u003e` opening two blockquote frames) matches the full parse, capped by the\ngrammar's `max_nest`. The remaining trade-off is opacity: a bold marker\ninside a fenced code block will be matched by `find_bolds` but suppressed by\nthe full parser. This divergence is by design and documented — and closable:\n\n```rust\n// Build the opaque-region map once (fenced blocks, code spans, autolinks),\n// then run any number of context-aware finders over it.\nlet ctx = MarkdownParser::context(src);\nfor span in MarkdownParser::find_context_bolds(src, \u0026ctx) {\n    // bold markers inside code spans and fenced blocks are skipped,\n    // matching the full parse\n}\n```\n\nEvery rule that is not itself opaque gets a `find_context_*` variant; the\nmap is built by one streaming pass and shared across all of them.\n\n---\n\n## Declarative grammar — one invocation, full parser\n\nThe engine has no built-in knowledge of any text format. You describe your\nformat as a grammar and the engine compiles it into a parser at build time:\n\n```rust\nuse meon::define_parser;\n\ndefine_parser!(MyFormat {\n    sep = b' ', eol = b'\\n', tab = b'\\t', escape = b'\\\\', max_nest = 4;\n\n    inline {\n        on_trigger(b'*') {\n            symmetric b'*' {\n                parse_inside = true;\n                balanced     = false;\n                1 =\u003e italics [40],\n                2 =\u003e bolds   [40],\n            }\n        }\n        fallback =\u003e texts [10];\n    }\n    lines {\n        line(b'#', max = 6) |n|:\n            Heading { level: NonZeroU8::new(n).unwrap_or(NonZeroU8::MIN) }\n            =\u003e headings [200];\n    }\n    blocks {\n        block_simple {\n            fence(b'`', min = 3) =\u003e fenced_codes [400];\n        }\n        fallback =\u003e paragraphs [80];\n    }\n});\n\n// Generated:\n// MyFormatParser::parse(src) -\u003e MyFormatContent\u003c'_\u003e\n// MyFormatParser::find_bolds(src) -\u003e impl Iterator\u003cItem = Span\u003e\n// MyFormatParser::find_headings(src) -\u003e impl Iterator\u003cItem = (Heading, Span)\u003e\n// MyFormatParser::context(src) -\u003e ParseContext\n// MyFormatParser::find_context_bolds(src, \u0026ctx) -\u003e impl Iterator\u003cItem = Span\u003e\n// MyFormatContent::bolds_clean() -\u003e impl Iterator\u003cItem = \u0026[u8]\u003e\n// MyFormatContent::bolds_raw()   -\u003e impl Iterator\u003cItem = \u0026[u8]\u003e\n// ... and more\n```\n\nEverything — the content struct, the parse method, all find_* iterators, all\naccessors — is generated at compile time. There is no runtime dispatch, no\nvtable, no grammar interpreter.\n\n---\n\n## Repository structure\n\n```\nmeon/                 ← workspace root (this file)\n├── meon/             ← parsing engine + runtime macros\n├── meon-macros/      ← define_parser! proc-macro\n├── meon-md/          ← Markdown grammar built on meon\n├── meon-json/        ← JSON reader grammar built on meon\n├── benches/          ← criterion benchmarks\n└── fuzz/             ← cargo-fuzz harness\n```\n\n`meon-md` is a concrete grammar that parses a useful subset of Markdown. It\ndemonstrates that the engine covers real-world complexity, and serves as\nthe benchmark and fuzz target for the project.\n\n`meon-json` is a second reference grammar — a flat, span-based JSON reader. It\nshows the engine is not Markdown-specific: a structurally opposite format —\ndeep nesting, containers, `key: value` pairs, line breaks as ordinary content\n— falls out of the same `define_parser!` primitives, emitting one flat `Vec`\nper element kind (objects, arrays, strings, members) instead of a tree.\n\n---\n\n## Feature flags\n\n| Feature  | Effect                                            |\n|----------|---------------------------------------------------|\n| `avx2`   | 32-byte SIMD search (requires nightly + AVX2 CPU) |\n| `avx512` | 64-byte SIMD search (implies `avx2`)              |\n\nWithout either flag the crate compiles on stable Rust.\n\n---\n\n## License\n\n`meon` is available under the\n[***MIT***](./LICENSE-MIT) *OR* [***APACHE-2.0***](./LICENSE-APACHE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvgnapuga%2Fmeon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvgnapuga%2Fmeon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvgnapuga%2Fmeon/lists"}