8000 Add OpenPulseVisitor Skeleton and Initial OpenPulse AST Handling by vinayswamik · Pull Request #229 · qBraid/pyqasm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add OpenPulseVisitor Skeleton and Initial OpenPulse AST Handling #229

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

vinayswamik
Copy link
Collaborator

Summary of changes

This PR introduces the initial implementation of the OpenPulseVisitor. This visitor is designed to traverse and interact with elements in an OpenPulse program, providing a foundation for OpenPulse AST handling within the pyqasm framework.
This foundational work sets up the structure for OpenPulse support in pyqasm, enabling future development of OpenPulse parsing, validation, and transformation features. The current implementation provides scaffolding and type checks, with detailed TODOs for each OpenPulse construct.

  • Implement the detailed logic for each visitor method (frame/port/waveform management, function call evaluation, etc.).
  • Integrate with the rest of the pyqasm pipeline for end-to-end OpenPulse support.

Fixes #183

Copy link
Contributor

👋 Hey there! It looks like the changelog might need an update.

Please take a moment to edit the CHANGELOG.md with:

  • A brief, one-to-two sentence summary of your changes.
  • A link back to this PR for reference.
  • (Optional) A small working example if you've added new features.

calibration_stmts: list[openpulse_ast.Statement] = block_body.body
pulse_visitor = OpenPulseVisitor(module=self, is_def_cal=True)

result.extend(pulse_visitor.visit_basic_block(calibration_stmts))
Copy link
Member

Choose a reason for hiding this comment

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

I like this approach! Makes it very segregated from original visitor

Copy link
Member
@TheGupta2012 TheGupta2012 left a comment

Choose a reason for hiding this comment

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

Thanks @vinayswamik , I like the segregated approach for pulse semantics!

Building on it, I've given some preliminary comments for refactoring. From the outset, let's keep the code organization in check - we don't want the OpenPulseVisitor to grow in size like our original visitor.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 16.21622% with 186 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pyqasm/pulse/openpulse_visitor.py 11.64% 167 Missing ⚠️
src/pyqasm/visitor.py 29.62% 19 Missing ⚠️

📢 Thoughts on this report? Let us know!

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.

[FEATURE] Use openpulse.parser.parse_openpulse to parse cal and defcal blocks in program
3 participants
0