Skip to content

Move the math expression parser from Pest to Chumsky and add more features#2685

Merged
Keavon merged 1 commit into
GraphiteEditor:masterfrom
urisinger:Math
Jul 26, 2026
Merged

Move the math expression parser from Pest to Chumsky and add more features#2685
Keavon merged 1 commit into
GraphiteEditor:masterfrom
urisinger:Math

Conversation

@urisinger

Copy link
Copy Markdown
Contributor

Part of #2026

Switches to the chumsky parser for performance, remove Unit support until #586 is resolved.

Improves parser performance by about 40%, while also reducing compile times and improving readability.

@Keavon Keavon changed the title Add if statments to math parser and switch to chumsky parser Add if statements to math parser and switch to Chumsky parser Jun 5, 2025
@Keavon Keavon changed the title Add if statements to math parser and switch to Chumsky parser Move the math expression parser from Pest to Chumsky and add more features Jun 9, 2025
@Keavon
Keavon marked this pull request as draft June 14, 2025 22:14
@Keavon
Keavon force-pushed the master branch 2 times, most recently from 34dced3 to 5cacab2 Compare June 20, 2025 06:47
@Keavon

Keavon commented Jun 20, 2025

Copy link
Copy Markdown
Member

I have rebased this branch to remove merge commits, so you'll need to git reset --hard to its new ref here on origin.

@RegenJacob

Copy link
Copy Markdown

How far is this?

I might be interested in implementing some math expressions from #2026
I figured this PR would be a blocking factor before I could do that.

@urisinger

Copy link
Copy Markdown
Contributor Author

How far is this?

I might be interested in implementing some math expressions from #2026
I figured this PR would be a blocking factor before I could do that.

Its ready for review, its just not being merged becuase without variadics of some form this node is pretty useless, creating the custom error message for the node is also a difficult task.

@Keavon
Keavon force-pushed the master branch 4 times, most recently from 3697b7d to 90533e6 Compare March 11, 2026 12:15
@Keavon
Keavon marked this pull request as ready for review March 16, 2026 21:32

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 14 files


Since this is your first cubic review, here's how it works:

  • cubic automatically reviews your code and comments on bugs and improvements
  • Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
  • Add one-off context when rerunning by tagging @cubic-dev-ai with guidance or docs links (including llms.txt)
  • Ask questions if you need clarification on any suggestion

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread libraries/math-parser/src/value.rs
Comment thread libraries/math-parser/src/parser.rs
Comment thread node-graph/gmath-nodes/src/lib.rs Outdated
Comment thread libraries/math-parser/src/constants.rs
Comment thread libraries/math-parser/src/constants.rs Outdated
Comment thread libraries/math-parser/src/lexer.rs
Comment thread libraries/math-parser/benches/bench.rs
Comment thread libraries/math-parser/src/lib.rs
Comment thread libraries/math-parser/src/diagnostic.rs Outdated
Comment thread libraries/math-parser/src/constants.rs
@Keavon
Keavon force-pushed the master branch 3 times, most recently from e58c1de to df8001f Compare March 17, 2026 00:10
@Keavon
Keavon force-pushed the master branch 4 times, most recently from 9b97ab7 to 2e842cb Compare March 19, 2026 11:00
@Annonnymmousss

Copy link
Copy Markdown
Contributor

All the AI reviews are mostly valid.

Comment thread libraries/math-parser/src/parser.rs
Comment thread libraries/math-parser/src/constants.rs
Comment thread libraries/math-parser/src/value.rs
Comment thread libraries/math-parser/src/lib.rs
Comment thread libraries/math-parser/src/diagnostic.rs Outdated
@Annonnymmousss

Copy link
Copy Markdown
Contributor

There are some unused imports too.

@Keavon
Keavon force-pushed the master branch 2 times, most recently from f07c79b to 76938eb Compare April 29, 2026 12:16
@Keavon
Keavon force-pushed the master branch 2 times, most recently from 4b7a823 to 847b8e9 Compare May 17, 2026 14:37
@timon-schelling
timon-schelling force-pushed the master branch 2 times, most recently from 15fcaac to d5f0140 Compare May 17, 2026 15:37
@Keavon
Keavon force-pushed the Math branch 2 times, most recently from c2f0c11 to b1c49fe Compare July 16, 2026 02:34
…r, adding functions, comparisons, logic, and conditionals
@Keavon

Keavon commented Jul 26, 2026

Copy link
Copy Markdown
Member

!build (Run ID 30219912385)

@github-actions

Copy link
Copy Markdown
📦 Web Build Complete for 4cd1e56
https://589e9f20.graphite.pages.dev

Wasm: 36.28 MB — JS: 0.44 MB — CSS: 0.09 MB — Fonts: 0.30 MB — Images: 0.09 MB — All Assets: 37.21 MB

@Keavon
Keavon merged commit 0952933 into GraphiteEditor:master Jul 26, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants