Skip to content

Parser: target module layout for splitting src/parser/mod.rs #2650

Open

Description

@s5dsn-eqee

Part of #2591, scoped to the parser only.

#2591 agreed on a series of pure-move PRs but did not fix the target layout. #944 and #1581 both went per-statement (~35 files, one per top-level keyword). #1581 stalled as one large
PR, and its author noted that shared helpers ended up placed arbitrarily.

Proposed layout

A flat layout mirroring src/ast/, so a struct in ast/ddl.rs is parsed in parser/ddl.rs:

src/parser/
  mod.rs        Parser struct, token cursor, errors, identifiers, lists, statement dispatch
  expr.rs       precedence climbing, prefix/infix, function calls, literals
  query.rs      SELECT, set ops, CTEs, FROM/joins, windows
  data_type.rs
  ddl.rs        CREATE TABLE, columns, constraints, DROP   (existing create.rs, alter.rs stay beside)
  dml.rs        INSERT / UPDATE / DELETE                   (existing merge.rs stays beside)
  dcl.rs        GRANT / REVOKE / roles / policies
  statement.rs  SHOW / SET / DECLARE / transactions / EXPLAIN / misc

Order

Smallest conflict surface first:

  • dcl
  • dml
  • data_type
  • statement
  • ddl
  • query
  • expr

@alamb @LucaCappelletti94 wdyt?

Activity

  1. LucaCappelletti94 commented on Oct 16, 2026

    @LucaCappelletti94
    Contributor

    Yeah a tree layout seems sensible to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions