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.60.tar.gz (215.6 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.60-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.60-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.60-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.60-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.60-cp312-abi3-macosx_11_0_arm64.whl (467.7 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

hogql_parser_rs-1.3.60-cp312-abi3-macosx_10_12_x86_64.whl (494.2 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: hogql_parser_rs-1.3.60.tar.gz
  • Upload date:
  • Size: 215.6 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.60.tar.gz
Algorithm Hash digest
SHA256 bc7561b59d57990496e48a371cf2f445b88f167f045051fb11e911f41e67da21
MD5 1e03538de790294a77340613b6b54fc6
BLAKE2b-256 9b321e53b08964176717e96d940b5f4be5c3caca73c75d964be011865ba61825

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.60-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3853f8aac7918dc4a48fa73d6e10386e49dd6de3518b2c5cd2f1f02b059757ce
MD5 07522ae8aea9dda08344926a5db67f8a
BLAKE2b-256 866d79d23855aa4219be3d0c9ef5b9fcec944a9402e5a962f77d9546c6528a3b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.60-cp312-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 f2ae0f5dd798810225d631cf2879a931f0f07d995f928e4db9bc19e0c8df5b4f
MD5 b2dbca7b3b6a68e676d9b15445d988a7
BLAKE2b-256 f56aa53534235cbc1943dfc027a1a9cba1b6cc386bbdf8dc93c19902fab5649d

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.60-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4ab2bb4f7d77b33b309856b66ebcda7c862a447e82609dd7a70f17bed8b1ec82
MD5 6be543bb186a1704f8ecdad50d9cfefe
BLAKE2b-256 5930b0d347bc37663d0cba0fc6f3cabe8149afea128d8a8752df091a853a2326

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.60-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c77578c72c366be3fccc179241bf163e16b69687f7ce5e46004e58d57b262d69
MD5 cddf33d5c0678e6448367a7ec1e78848
BLAKE2b-256 d6ddc840eaf04c34a7df93855e1ad2745488ce1cbf3909cc3a0176f7de018dd1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.60-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 85100f6b10d8402cd2590e194da861e9c9c0698e1d8df86ab352e71dad05faa2
MD5 ba1b7d7028ddf63e20298c113b759f6b
BLAKE2b-256 a19bcedb56244af2872de952c1713ba8726de580a07828f06030b3a63147d8d0

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.60-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 5f93bb01925dacda1d8b9cccdcd84c4ebb0e046e47e4b15dd2fe531b50c55264
MD5 557c22c94250ed95aa66776364373470
BLAKE2b-256 306ceb951d6bb2aa400d7006dc1647aa25c544d0ccb1bb2d2430083562f97f1e

See more details on using hashes here.

Provenance

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