Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add Grit node compilers #2689

Merged
merged 11 commits into from
May 3, 2024
Merged

Conversation

arendjr
Copy link
Contributor

@arendjr arendjr commented May 3, 2024

Summary

This provides most of the node compilers which compile syntax nodes produced by our Grit parser into Grit pattern data structures on which the pattern matching algorithm operates.

It's a sizable chunk of code at once, but these represent relatively straight-forward ports of node compilers as found in the Marzano engine. See here for a reference on which this is based: https://github.com/getgrit/gritql/tree/main/crates/core/src/pattern_compiler

The main differences are:

  • Rather than compiling from TreeSitter nodes, we compile from the CST produces by our own parser. An advantage we have is that our CST has much stricter typing than TreeSitter, which saves some code and helps me make sure I didn't miss anything :)
  • I added a few comments here and there, although I will admit docs are scarce here. Fortunately individual node compilers are very low on complexity, though I'd like to document the variable compiler a bit more.
  • We produce typed errors instead of using anyhow for everything.

This represents some more progress towards #2582

Test Plan

None yet, since this doesn't yet provide much of use on its own. Once the other bindings are complete, I can work towards pattern tests.

@github-actions github-actions bot added the A-Project Area: project label May 3, 2024
@arendjr arendjr changed the title chore: Grit node compilers chore: add Grit node compilers May 3, 2024
Copy link

codspeed-hq bot commented May 3, 2024

CodSpeed Performance Report

Merging #2689 will improve performances by 17.75%

Comparing arendjr:grit-node-compilers (c6ec477) with main (2207d75)

Summary

⚡ 1 improvements
✅ 87 untouched benchmarks

Benchmarks breakdown

Benchmark main arendjr:grit-node-compilers Change
eucjp.json[uncached] 5.8 ms 4.9 ms +17.75%

@arendjr arendjr merged commit 26a94cc into biomejs:main May 3, 2024
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Project Area: project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant