Skip to content

Expression Parser #54

Open
Open

Description

@nickzoic

The Expression plugin uses the Python parser ("ast") to parse input into an AST and then transforms it into a DuckDB SQL string to run it within the database, rather than eval-ing the Python directly. This makes it hugely quicker but does make errors very hard to understand, especially because the parser understands far more complicated syntax than we have any intention of supporting.

Replacing this with a pypeg2 or similar parser would help. See branch nick/expression-parser

Activity

  1. nickzoic commented on Mar 15, 2026

    @nickzoic
    CollaboratorAuthor

    It'd also give us nicer column name escaping where columns have inconvenient names, maybe using `

    Another aspect of this is that we quick often want to do something like mean(score1, score2, score3, score4) where those are scores from 4 replicates ... but we might not know how many replicates we're going to have at the time we write the program! So it'd be neat if our syntax allows us to wildcard columns, perhaps something like mean(score$) to average all columns matching that pattern. Obviously that's going to require a special parser.

  2. nickzoic commented on May 12, 2026

    @nickzoic
    CollaboratorAuthor

    The pypeg2 parser is now merged! I think it's way better.

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