-
Notifications
You must be signed in to change notification settings - Fork 6
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
IRfmt derive #20
Closed
Closed
IRfmt derive #20
Conversation
This file contains 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
Merged
could we call this IR instead of ASM ? like irfmt, irparser, irprinter etc? assembly traditionally denotes machine instructions. |
Merged
vaivaswatha
added a commit
that referenced
this pull request
Jan 28, 2024
Backport from #20 This PR introduces the `irfmt/printers` module with common printer functions. In #20 we implement `asm_format` directives as macros. These macros will use the printer functions defined here (and more to come). As secondary goal we want to make it easier for downstream developers to implement their own printers, while trying to keep some kind of standardized format. For this reason we also implement Printable for some more IR objects in pliron. The change also removes the `PrintableIter` trait in favor of the `list_with_sep` and `iter_with_sep` printer functions in the irfmt package. This change ensures that we have a single trait for printing in the library. As discussed in #21 we do not require developers to add the type_id or attribute_id manually to the printer anymore. `pliron` now implements a printer for TypeObj/AttribObj that will always print the IDs. --------- Co-authored-by: urso <steffen.siering at gmail.com> Co-authored-by: Vaivaswatha N <[email protected]>
vaivaswatha
pushed a commit
that referenced
this pull request
Feb 8, 2024
This is an intermediary step backporting some changes from #20 into main. This PR focuses on moving the existing parsers into the `irfmt::parsers` module. Idea is to have parsers (and helpers) under the `irfmt` module for discoverability, similar to the `irfmt::printers` module. In addition to that I implemented the `Parsable` trait for `AttrObj` and `Ptr<TypeObj>` by copying the former `attr_parse` and `type_parse` function as is into the trait. I did this change to improve symmetry: If a type implements `Printable`, then it should implement `Parsable` as well. Besides implementing `Parsable` for the 2 types there is no change in the implementation logic. Just moving symbols around. Co-authored-by: urso <steffen.siering at gmail.com>
Merged
vaivaswatha
pushed a commit
that referenced
this pull request
Mar 5, 2024
WIP implementation of Printable derive macro. Still need to add tests and docstrings. The if format input parser has been updated to use combine to ensure we have only a single parser combinator library within the project. Backport from #20 . Follow ups This PR only adds the Printable derive macro interpreting and translating the ir format input. We still might have to add some of the directives to pliron. The change is already quite big, so I opted to split the effort here. --------- Co-authored-by: urso <steffen.siering at gmail.com>
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.
No description provided.