Skip to main content

Hand-rolled Rust HogQL parser with C++-parity AST output

Project description

hogql_parser_rs

ALL(*) variant of the rust HogQL parser. Loads the same serialized ATN that ANTLR generates for cpp and implements the runtime simulator (lexer ATN sim, DFA cache, SLL/LL prediction, semantic predicates).

Why a separate crate

hogql_parser_rs is a hand-rolled Pratt + recursive-descent parser, fast but ~99.88% cpp grammar parity (36 cpp-accept rust-reject divergences per 30 000 Hypothesis examples). hogql_parser_backtrack_rs is its sibling exploring sequential backtracking on top of the same Pratt core.

This crate explores the third path: implement the same algorithm class that cpp uses (adaptive ALL(*)). Grammar parity by construction; perf TBD vs the Pratt parser.

See PARSER_BENCHMARK_BASELINE.md for the perf baseline this variant will be measured against.

Status

Scaffold only. Every entry point returns a NotImplementedError envelope.

Implementation roadmap:

  • M1: ATN deserializer (parse .interp byte format)
  • M2: Lexer ATN simulator + mode stack
  • M3: Parser with SLL prediction
  • M4: LL fallback for full-context decisions
  • M5: Semantic predicates + HogQLX modes
  • M6: Visitor parity (matches cpp's emit JSON shape)

Selecting in Python

Exposed via the rust-json backend in posthog/hogql/parser.py.

Building locally

maturin develop --release -m rust/hogql/parser/Cargo.toml

Coexists with hogql_parser_rs and hogql_parser_backtrack_rs — all three wheels install side by side under distinct Python module names.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hogql_parser_rs-1.3.61.tar.gz (215.8 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ x86-64

hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_aarch64.whl (2.1 MB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ ARM64

hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ x86-64

hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_aarch64.whl (1.9 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.28+ ARM64

hogql_parser_rs-1.3.61-cp312-abi3-macosx_11_0_arm64.whl (468.1 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

hogql_parser_rs-1.3.61-cp312-abi3-macosx_10_12_x86_64.whl (495.2 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

Details for the file hogql_parser_rs-1.3.61.tar.gz.

File metadata

  • Download URL: hogql_parser_rs-1.3.61.tar.gz
  • Upload date:
  • Size: 215.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hogql_parser_rs-1.3.61.tar.gz
Algorithm Hash digest
SHA256 7cbe3df2165759986d322db06ad887149cccc16c6aaf96aef828674998891bab
MD5 d811ad96c094ea99ab43c38337e75c21
BLAKE2b-256 1062223a826142bad96aacd7ae6c42a8ca68f579c054f504b85d01272c39d69d

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61.tar.gz:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a128003cba56cc4c2b6c1134d08b2516d9b83c2f3e12988dacc8738431eb9a94
MD5 6826db601fd23233c385b36f73bcc964
BLAKE2b-256 e63613d4cb0987eb1284da1a5eda073ebfa3247d8d7d652216c24c5aecefdd0b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_x86_64.whl:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 b2050bed0212edac17b24a683929b49e736c7158317ea7ee465e967278862dd3
MD5 354e77a3cfa23593773770cd0c97317b
BLAKE2b-256 c084e3477645af77f40e1c54aac37063dce3cd195780e49aaa70836c041c7ca9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61-cp312-abi3-musllinux_1_2_aarch64.whl:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b9ed6a1a282f224569c21833c44a26f8bd1be11c695705cd45436debc1fc9da3
MD5 d854d9130e85cd7412e13492320ce6e2
BLAKE2b-256 236e2e284758a8d88be25dd4dda3ea9553d80cf1297be08591e0a5de7b643c29

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_x86_64.whl:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5f6a64a4df0beeb6393fbc811e63e9ef61b47341f3084ba6922b3da39b533077
MD5 41f7c9452c068ef4d0591730a4c326ff
BLAKE2b-256 34440873611b633d50125faa9c4c80186c170b9a9bb9cbc8cec48b7a1c4554b1

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61-cp312-abi3-manylinux_2_28_aarch64.whl:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hogql_parser_rs-1.3.61-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.61-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 335f5046643ef785b6bf05f4200ed06a678e158cf63e9b2a1308594515738f8a
MD5 6299c97bf75af5f00e911e3d57cc999b
BLAKE2b-256 0064d0e023e085431b52a0a49059ca11bfbf1cd0a5f854f54e956f665e670ab4

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61-cp312-abi3-macosx_11_0_arm64.whl:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hogql_parser_rs-1.3.61-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.61-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 17ecab941518394ee01ddb35b8570446efdfdbdc868599e3e79922d7e35e8ed4
MD5 16dc5e0731afe2e0f2d789b549297745
BLAKE2b-256 17b7c68349c635277a51364f6ebe9465721bdf3db338599206ed01638e2def55

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.61-cp312-abi3-macosx_10_12_x86_64.whl:

Publisher: build-hogql-parser-rs.yml on PostHog/posthog

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page