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.58.tar.gz (214.1 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.58-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.58-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.58-cp312-abi3-manylinux_2_28_x86_64.whl (2.1 MB view details)

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

hogql_parser_rs-1.3.58-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.58-cp312-abi3-macosx_11_0_arm64.whl (465.0 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

hogql_parser_rs-1.3.58-cp312-abi3-macosx_10_12_x86_64.whl (489.5 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: hogql_parser_rs-1.3.58.tar.gz
  • Upload date:
  • Size: 214.1 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.58.tar.gz
Algorithm Hash digest
SHA256 78cbe925c4967dc50944e9549cbdd82f4684bae890809ad05308e4394a98bc7a
MD5 937b4a20701ccf5580b152f3288cadc9
BLAKE2b-256 1cc9d884cf09c7d35bbb78272b59b68c32abe200a0b799f82c4369c5ba555969

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58.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.58-cp312-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.58-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ba64a2bbad5c4f4700c5815e62838b34dcee104e2b410a904a7234004fa75ad1
MD5 e4483a654533723ef4c127f0dbbd07cf
BLAKE2b-256 2bfb1fccb60df52cf820ad976fa11630d1219259ec3a5bc7e2f3b9b40dc66af9

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58-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.58-cp312-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.58-cp312-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0370fc98e07cb3f8fc628fe42e995f01955142df910863199c6e974e512044f9
MD5 48c7874f2ae2b552e653e9e04a6d7a5b
BLAKE2b-256 4fa13bd3b416d634386309e0e617474e317971c274ad37e6293c25ab80139b9c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58-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.58-cp312-abi3-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.58-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aa2c4f1777e8b9dda90166b6f1cc6f64c3219a6c71c551331201eb992d185022
MD5 14ce36db8788272bae00094be727bbdf
BLAKE2b-256 0c0038d1302ed9b9405072348e476bb4dd5312253532f90f23423fbc0bf4ba42

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58-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.58-cp312-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.58-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c1da16d58e2cb6fbcde0e7e8677dc06b289439ca42bd39b7e1d394845feeda7a
MD5 7a511074598e54f7405a26cf8a7c13fd
BLAKE2b-256 f4d7b40c6093b60112e91893c2f79520bef81026733817ba4b437c41f78b147c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58-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.58-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.58-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7147214c15684a5c84814a2f9d8aa7bf4da617748f11cbe513fb417b942a59d6
MD5 b83daea00e28cff9d47045228beb3a6f
BLAKE2b-256 2f7d805dd705c1bf21c38441aa7908085776677fc60440d99c3c5aa3e4b36798

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58-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.58-cp312-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.58-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 a3db3784000d3c869120819d74b6fa391dc0ac2eb5536a979abd16aba42b0f0d
MD5 5c41fc2e8af45188d0a97c06e3543cdc
BLAKE2b-256 5493dbb8576ed687b7ebbb1427f51ee1d361422f94dcb2a1c7342f98c98a14fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for hogql_parser_rs-1.3.58-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