Add dialect! macro - #115
Open
robpatterson13 wants to merge 3 commits into
Open
robpatterson13 wants to merge 3 commits into
robpatterson13 wants to merge 3 commits into
Conversation
robpatterson13
added this pull request to stack #116
September 23, 2026 19:24
Contributor
|
…nd runtime structs
…private` mod; split `dialect.rs` into separate modules
robpatterson13
force-pushed
the
rob/dialect-macro
branch
from
September 23, 2026 19:36
59eed8a to
668d2a8
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
dialect!for declaring a dialect’s instructions in one place. The macro generates runtime instruction structs and separately parsable syntax structs, with support for custom patterns, distinct syntax, and runtime payload types (like is currently supported through thecomposite!macro).It also exposes an instruction enumerator for downstream (vihaco internal) macros. Callers can select every instruction or named instructions in a chosen order; each descriptor includes its types, mnemonic, and original declaration position. You can read the docstrings in
crates/vihaco-runtime-derive/src/dialect/enumerator.rsfor explanation of the callback macro mechanism and how it is used by consumers.The branch adds validation for duplicate names, unsupported forms, and malformed declarations, plus parsing and compile-fail tests.