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.59.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.59-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.59-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.59-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.59-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.59-cp312-abi3-macosx_11_0_arm64.whl (467.6 kB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

hogql_parser_rs-1.3.59-cp312-abi3-macosx_10_12_x86_64.whl (493.5 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: hogql_parser_rs-1.3.59.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.59.tar.gz
Algorithm Hash digest
SHA256 26c45476646ed4ba5044fe46f311ce3683af3af767d55883c485e75937e62483
MD5 e6e2f81c9d35c405a35dfa77381efe88
BLAKE2b-256 87fbcd8d74ac9a9120524ff3f1fda0e6e9c83e03e303cedffa9c572071a8d616

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.59-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 eddf93f7b759a1cedc1f9e095ce6b858f852915a0ed11ab4886d746fbf9482b6
MD5 57ed35bcd54fa9378e712f31c6b05f52
BLAKE2b-256 36f76c3466b3a6aba9645795af1ea1d935a6613e365e50aacf410c520ebbca60

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.59-cp312-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 693ec39eab7f24ed00a66f19ef5703c88c91f2c22ca1aa4b65000596e1aacf23
MD5 8f16a3a13f84a383d42f836c9642ca9c
BLAKE2b-256 a135abbc145c9deb4005fa93c613c4666213bf799e99835adc1c9b36b86b0402

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.59-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b7309cfa8676f3c9240bb158ba4b570de0c0e8a2e747088e292ca5d55e3a7d1
MD5 d51c63a412e3413479b385b01879c8d3
BLAKE2b-256 ca7d03971574d951b706ddf8468a2474adbfe602e527efe313e897c0ce1a02f9

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.59-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 998e9f1f56a2f0c541f5697b0b61a05c14ae4b23d27ab3a4f3925b2e2bbd8aca
MD5 67a8f815905b234f98b6c51c91f491cb
BLAKE2b-256 df2672d813795d6b1b4d79531b2f03ffa6b04ab31bd2718d93e8542d75c4d2c3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.59-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4da317dd23da2fa8693257bf4d7e7beaf8657cb6724eb0c7e5af5c938459b361
MD5 a2a7ba30a4251d4ac8377734ed08e663
BLAKE2b-256 25ff2e6ff37c125c39a8c653d750d903d76e85849ad6d6a25342bf78b69a782e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.59-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e4596db63e4b9e5e8c2d1e84ad425288d9bc8c519a85740e8e35cefd0e0924db
MD5 be594bd9eef0ad54b11e79caf89dd0dd
BLAKE2b-256 21b50264152f4cef432e1ee42cc371577e0f276ac2d3783cfd7f9b9bafd54664

See more details on using hashes here.

Provenance

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