openqasm / openpulse-python Goto Github PK
View Code? Open in Web Editor NEWReference Python package to work with OpenPulse
License: Apache License 2.0
Reference Python package to work with OpenPulse
License: Apache License 2.0
Update arguments in CalibrationDefinition from List[ClassicalArgument]
to List[Union[ClassicalArgument, Expression]]
in sync with OpenQASM.
This will allow scenario like defcal rx(pi/2)
.
The openqasm3 library provides a py.typed
file, which signals to downstream libraries to read the inline type annotations. We could do the same thing here for the openpulse package.
The spec makes explicit provisions for global barrier statements, but there is no mention of any equivalent for delay
. This could be convenient to add. Strictly speaking, if we supported this in the OpenPulse spec, this would apply to delay
instructions within cal blocks, and would not apply to delay
instructions outside of cal blocks (which retain the existing OpenQASM semantics). We should poll the TSC to see whether this would be reasonable to support at the OpenQASM level.
The following OpenPulse program fails to parse
cal {
// while(true) {
int x;
}
The error I see is
In [10]: parse("""cal {
...: // while(true) {
...: int x;
...: }
...: """)
---------------------------------------------------------------------------
ParseCancellationException Traceback (most recent call last)
File ~/source/interpres/.venv/lib/python3.10/site-packages/openqasm3/parser.py:87, in parse(input_, permissive)
86 try:
---> 87 tree = parser.program()
88 except (RecognitionException, ParseCancellationException) as exc:
File ~/source/interpres/.venv/lib/python3.10/site-packages/openqasm3/_antlr/_4_11/qasm3Parser.py:640, in qasm3Parser.program(self)
639 self.state = 131
--> 640 self.statement()
641 self.state = 136
File ~/source/interpres/.venv/lib/python3.10/site-packages/openqasm3/_antlr/_4_11/qasm3Parser.py:919, in qasm3Parser.statement(self)
918 self.state = 155
--> 919 self.calStatement()
920 pass
File ~/source/interpres/.venv/lib/python3.10/site-packages/openqasm3/_antlr/_4_11/qasm3Parser.py:3352, in qasm3Parser.calStatement(self)
3351 self.state = 423
-> 3352 self.match(qasm3Parser.RBRACE)
3353 except RecognitionException as re:
File ~/source/interpres/.venv/lib/python3.10/site-packages/antlr4/Parser.py:126, in Parser.match(self, ttype)
125 else:
--> 126 t = self._errHandler.recoverInline(self)
127 if self.buildParseTrees and t.tokenIndex==-1:
128 # we must have conjured up a new token during single token insertion
129 # if it's not the current symbol
File ~/source/interpres/.venv/lib/python3.10/site-packages/antlr4/error/ErrorStrategy.py:703, in BailErrorStrategy.recoverInline(self, recognizer)
702 def recoverInline(self, recognizer:Parser):
--> 703 self.recover(recognizer, InputMismatchException(recognizer))
File ~/source/interpres/.venv/lib/python3.10/site-packages/antlr4/error/ErrorStrategy.py:697, in BailErrorStrategy.recover(self, recognizer, e)
696 context = context.parentCtx
--> 697 raise ParseCancellationException(e)
ParseCancellationException: None
Note that the OpenQASM parser doesn't have a problem with the following
while (true) {
// while(true) {
int x;
}
ExternArgument
is now exported in openqasm. We can remove https://github.com/openqasm/openpulse-python/blob/5b5c7ae7af352b0ae2cca16e311fbd4114d999cd/source/openpulse/openpulse/ast.py#LL21C2-L21C2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.