Skip to content

Parser refactor to support values, types, instructions#40

Open
robpatterson13 wants to merge 7 commits into
mainfrom
rob/parsing-refactor
Open

Parser refactor to support values, types, instructions#40
robpatterson13 wants to merge 7 commits into
mainfrom
rob/parsing-refactor

Conversation

@robpatterson13

@robpatterson13 robpatterson13 commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Implements parsing of arbitrary values, types, and instructions:

  • #[derive(Parse)] now has two new attributes: #[syntax_class(...)] and #[pattern = "..."]
  • A new chumsky parser generator from a declarative pattern, allowing for specific atoms in the grammar to be bound to payloads in instructions/values/types
  • Allow patterns on structs as well as enums
  • Fixes issue with greedy parser; if pattern A is a subset of pattern B, pattern B is moved above pattern A
  • Moved old implementation to legacy_codegen.rs for backward compatibility
  • Added tests and documentation with grammar for patterns and examples of usage

Future work:

  • Expand accepted symbols
  • Allow for parser overrides, i.e. allow a user to supply their own impl Parse to parse within patterns (similar to the legacy parse_with, but for atoms in a pattern, not just the entire parsing pipeline for that instruction)
  • Formalize the step from surface syntax -> resolved runtime form

…enerator; implemented parser generation for instruction, value, and type enums
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://QuEraComputing.github.io/vihaco/pr-preview/pr-40/

Built to branch gh-pages at 2026-07-21 20:05 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@robpatterson13
robpatterson13 requested a review from kaihsin July 22, 2026 13:05
@robpatterson13
robpatterson13 marked this pull request as ready for review July 22, 2026 13:05
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.

1 participant