{"library":"openpulse","title":"OpenPulse Python AST Reference","description":"OpenPulse (version 1.0.1) is a Python library providing a reference Abstract Syntax Tree (AST) for the OpenPulse grammar. It enables the representation and manipulation of pulse-level definitions (`cal` and `defcal` blocks) within the OpenQASM 3 ecosystem, reusing classical types and statements from the `openqasm3` library. The library includes AST nodes and a parser, serving as a foundational component for tools that process pulse-level control in quantum computing.","language":"python","status":"active","last_verified":"Thu Apr 16","install":{"commands":["pip install openpulse"],"cli":null},"imports":["from openpulse import parser","from openpulse import ast"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from openpulse import parser\nfrom openpulse.ast import Program\n\n# Define a simple OpenPulse string\npulse_string = \"\"\"\nOPENQASM 3.0;\ncal {\n  waveform w = sine(1.0, 0.5, 0.0, 0.0);\n  play(0, w);\n}\n\"\"\"\n\n# Parse the OpenPulse string into an AST\nast_program = parser.parse(pulse_string)\n\n# Verify the type of the parsed program\nassert isinstance(ast_program, Program)\nprint(\"Successfully parsed OpenPulse program.\")\n# print(ast_program.pretty_print()) # Uncomment to see structured output if available\n","lang":"python","description":"This quickstart demonstrates how to use the `openpulse.parser` to parse a basic OpenPulse string into its Abstract Syntax Tree representation. The resulting `Program` object is an instance of the `openpulse.ast.Program` class, allowing programmatic inspection and manipulation of the pulse-level instructions.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}