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.57.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.57-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.57-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.57-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.57-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.57-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.57-cp312-abi3-macosx_10_12_x86_64.whl (489.1 kB view details)

Uploaded CPython 3.12+macOS 10.12+ x86-64

File details

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

File metadata

  • Download URL: hogql_parser_rs-1.3.57.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.57.tar.gz
Algorithm Hash digest
SHA256 26d76c1dab2800c13f6e08d9fe298624d794ca44c4f36aec61d832309397c840
MD5 9e3b3aa45fbdacabc9e7266227640163
BLAKE2b-256 02fa24df7e905121758c2742f9d7d7daa7226aac8dd0cd7aef756b14e974da3c

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.57-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ed690ee45b2264bb9a55a6730b75493da2d6d1b922c77fa1156e20bf8c0ddd4f
MD5 76850b5edb244ebc372f09a0b067b7c2
BLAKE2b-256 71ce85add8e057d864cb3920c22d2427247d151536ba8f74e7b6030efb45afcb

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.57-cp312-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 db84b95ccc89caab8e6600bc56b6fddc267891806f8b44b4bad00ec74538145e
MD5 78bd9cbb9b68d9aa0ef2be44c6a44742
BLAKE2b-256 d1c16bdeeb8aea89bf2107978c1961be81f03171e1b4f46377044f8d18cac7e3

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.57-cp312-abi3-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 117dd9246b3a5ee50698467b4bd590ce34bd83e579847a145241a6954ea8a753
MD5 b0d9701e46efd409182b27c40872d0c0
BLAKE2b-256 8264937d42ab622f0d680d3a57258217c32baa4083a9f3c25d0ef68466a7da9e

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.57-cp312-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 ed840e3885804091457060abd420a7aa34601263b5b74f99a8e582c6e097c5c2
MD5 03ee48ea819ddfc33f734eb7d6015eb8
BLAKE2b-256 60cf27ee02fd4ba24a584d6c759d299cdb45f5be2a2ea3ccc1ce546f334772a2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.57-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8c27ea715f997407f1724661fde97e3fbe342af336670c0ca1313da5738e87df
MD5 85a3c5a08ebec33cc4fefc8acdb27069
BLAKE2b-256 5524c537b22000a7ebdba6d40b8498572ec55c3a6fbdc1a3876cd82a4dd93271

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for hogql_parser_rs-1.3.57-cp312-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 ea335bad259bf77f41c4564027d0ee4b3b92806fe111ef6d9721f9c235dc8d7d
MD5 42e57cbdac974e379724b137267d0099
BLAKE2b-256 e63408dac270c5cfcf4b3623995cb721dbd7a83a5a62cc124ba379dd9991b2f3

See more details on using hashes here.

Provenance

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